On Wednesday, July 11, 2018 at 9:46:32 AM UTC-4, Wei Ken Chang wrote:
>
> Hi , I am web2py beginner... 
> I want to begin transaction (DB) in the controller then pass this dB 
> connection to multiple modules ( each modules run different SQL 
> insert/update/delete), if one of module action failed so I will revert back 
> (dB connection) else (all modules success ) dB will commit.
>

If this is all happening within a single HTTP request, web2py already wraps 
the whole request inside a transaction, so no need to do anything explicit 
on your part (you don't even have to call db.commit(), and if the HTTP 
request ultimately results in an error, web2py will also automatically call 
db.rollback()).

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to