The model, controllers view are executed in
try:
run model, controller, view
SQLDB.close_all_instances(SQLDB.commit)
except:
SQLDB.close_all_instances(SQLDB.rollback)
log exception
SQLDB.close_all_instances(action) acts on all databases created in the
thread. Notice that you cannot close a connection manually (it may
interfere with connection pools if enabled) but you can commit/
rollback manually.
For example you can have a controller like
def index():
db.mytable.insert(myfield='myvalue')
db.commit()
db.mytable.insert(myfield='myothervalue')
db.commit()
return dict()
This should work fine. Let me know if it does not and which database
you use.
Hope this helps.
Massimo
On Nov 7, 3:43 pm, Jiff <[EMAIL PROTECTED]> wrote:
> On 7 nov, 18:33, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > you can do db.commit() to commit before the autocommit
>
> Well, the PB it that I don't know exactly when the autocommit takes
> place!?
>
> My concern is about a DB failure while making the many2many "copy":
> it *must* be complete, and as Murphy's law is an old friend... I'd
> prefer
> to switch to a manual BEGIN/COMMIT; but AFAIK, it is only possible in
> web2py by issuing entirely manual SQL orders (?)
>
> JY
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---