Yes, I do, but failed .
is it ok for u ?
the database I use is mysql . Even I insert a row into mysql through mysql 
client manually, no change at all, either.

########  module code start ###############
os.chdir(/path/to/web2py/)
from gluon.shell import env
globals().update(env('my_application_name', import_models=True))
while True:
    print "count", db(db.mytable.id>0).count()
    ### no change at all when i insert a row into db.mytable
    time.sleep(5)
########  module code end ###############

module name is count.py
execute it with this command: 
python count.py

python version is 2.5.4
web2py version is 1.72.3, 1.74.4 also failed
system is windows xp
web2py is installed from source


Thank you, mdipierro


在2009-12-28,mdipierro <mdipie...@cs.depaul.edu> 写道:
>How do you insert the row?
>The commit goes after you insert the row.
>
>Massimo
>
>On Dec 27, 8:15 pm, 王怀玉 <why00...@163.com> wrote:
>> i had done as your advice.
>>
>> no change at all .
>> you can try it by yourself.
>>
>> thank you very very much !
>>
>> 在2009-12-27,mdipierro <mdipie...@cs.depaul.edu> 写道:
>>
>> >If I understand the problem, you need to do
>>
>> >db.commit()
>>
>> >On Dec 27, 3:45 am, 王怀玉 <why00...@163.com> wrote:
>> >> to reuse model definition in a module, so i use gluon.shell.env .
>> >> code in module is like this:
>> >> ########  module code start ###############
>> >> os.chdir(/path/to/web2py/)
>> >> from gluon.shell import env
>> >> globals().update(env('my_application_name', import_models=True))
>> >> while True:
>> >>     print "count", db(db.mytable.id>0).count()
>> >>     ### no change at all when i insert a row into db.mytable
>> >>     time.sleep(5)
>> >> ########  module code end ###############
>> >> then, execute the module. the problem is that when a row is inserted into 
>> >> db.mytable, the result printed by module doesn't change at all.
>>
>> >> how can i solve this ? thank you very much !
>>
>> >--
>>
>> >You received this message because you are subscribed to the Google Groups 
>> >"web2py-users" group.
>> >To post to this group, send email to web...@googlegroups.com.
>> >To unsubscribe from this group, send email to 
>> >web2py+unsubscr...@googlegroups.com.
>> >For more options, visit this group 
>> >athttp://groups.google.com/group/web2py?hl=en.
>>
>>
>
>--
>
>You received this message because you are subscribed to the Google Groups 
>"web2py-users" group.
>To post to this group, send email to web...@googlegroups.com.
>To unsubscribe from this group, send email to 
>web2py+unsubscr...@googlegroups.com.
>For more options, visit this group at 
>http://groups.google.com/group/web2py?hl=en.
>
>

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to