Il ven, 2002-02-08 alle 12:47, de ZORZI Frederic ha scritto:
> > Hi all,
> > Is it possible to use cursors and their functions (dictfetchall, 
> > fetchone...)  with zpsycopg connection ?
> > 
> 
> Easy stupid :) :
> 
> conn = getattr(self, self.connection_id)
> db = conn().db
>               
> curs = db.cursor()
> curs.execute("select * from support limit 2")
> return "%s" % curs.dictfetchall()
> 
> 
> Now, how about managing transactions ?

zope manages them for you. you get a commit() at the end of the page and
a rollback() in case of an uncatched exception. if you want to do
transaction management yourself, create your own connection/cursor in an
external method.

ciao,
federico

-- 
Federico Di Gregorio
Debian GNU/Linux Developer & Italian Press Contact        [EMAIL PROTECTED]
INIT.D Developer                                           [EMAIL PROTECTED]
     One key. One input. One enter. All right. -- An american consultant
           (then the system crashed and took down the *entire* network)

Attachment: msg09360/pgp00000.pgp
Description: PGP signature

Reply via email to