[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-db-sig
Subject:    [DB-SIG] perl-DBI like module for Python?
From:       ods () strana ! ru (Denis S !  Otkidach)
Date:       2004-05-26 11:28:08
Message-ID: Pine.LNX.4.44L.0405261923420.11961-100000 () ods ! pravda ! rfn ! ru
[Download RAW message or body]

On Wed, 26 May 2004, Anthony Tuininga wrote:

AT> > try:
AT> >     cur = con.cursor()
AT> >     cur.excecute('select foo from bar')
AT> > except con.DatabaseException:
AT> >     print 'Oops!'
AT>
AT> Huh? My reading of the DB API says that the exceptions are
AT> defined at
AT> the __MODULE__ level, not the __CONNECTION__ level. Or am I
AT> missing
AT> something??? Please inform me!

I see no problem here.

con = db_module.connect(...)
cur = con.cursor()
...
try:
    cur.excecute('select foo from bar')
except db_module.DatabaseException:
     print 'Oops!'

But exposing exceptions as connection attributes would be more
convinient.

-- 
Denis S. Otkidach
http://www.python.ru/      [ru]


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic