On 23 июл, 21:25, Kyle VanderBeek <[email protected]> wrote:
> On Jul 23, 10:16 am, [email protected] wrote:
>
> > commit() or rollback() on the connection object as necessary, eg.
>
> > con = g.pool.connection()
> > cur = con.cursor()
>
> > try:
> > # do some stuff
> > cur.execute("update .... ")
> > cur.execute("update .... ")
> > cur.execute("insert into .... ")
> > con.commit()
> > except:
> > con.rollback()
>
> I'll just shamelessly promote my little blog entry on a handy
> decorator for implementing this idiom:
>
> http://www.kylev.com/2009/05/22/python-decorators-and-database-idioms/
Thanks.
One more question.
What is about escape_string?
I tried to use
cur.escape_string(my_var)
and get error
AttributeError: 'DictCursor' object has no attribute 'escape_string'.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---