from gluon.sql import *
db=DAL('sqlite://test.db')

db.define_table('test',
    db.Field('subject'),
    db.Field('num','integer',default=0),
    )

db.test.insert(subject="sub",num="1")
db.test.insert(subject="sub",num="2")
db.test.insert(subject="sub",num="3")


if run this python script, all the queries are not committed.


if i append this line at the end
db.executesql("COMMIT;")

the queries do commit but i got the following error

Traceback (most recent call last):
  File "./test.py", line 23, in <module>
    db.executesql("COMMIT;")
  File "gluon/sql.py", line 1256, in executesql
  File "gluon/sql.py", line 846, in <lambda>
sqlite3.OperationalError: cannot commit - no transaction is active


actually what is the right way to commit or even disable transaction
when i use DAL for python script?

--

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


Reply via email to