DAL without web2py

Posted by Jay on Stack Overflow See other posts from Stack Overflow or by Jay
Published on 2010-01-25T13:26:03Z Indexed on 2010/03/26 19:03 UTC
Read the original article Hit count: 740

Filed under:
|

I am using web2py to power my web site. I decided to use the web2py DAL for a long running program that runs behind the site. This program does not seem to update its data or the database (sometimes).

from gluon.sql import *
from gluon.sql import SQLDB

from locdb import * 
# contains
# db = SQLDB("mysql://user/pw@localhost/mydb", pool_size=10)
# db.define_table('orders', Field('status', 'integer'), Field('item', 'string'),
#    migrate='orders.table')
orderid = 20 # there is row with id == 20 in table orders
#when I do 
db(db.orders.id==orderid).update(status=6703)
db.commit()

It does not update the database, and a select on orders with this id, shows the correct data. In some circumstances a "db.rollback()" after a commit seems to help.

Very strange to say the least. Have you seen this, more importantly do you know the solution?

Jay

© Stack Overflow or respective owner

Related posts about dal

Related posts about web2py