On Sat, 21 Feb 2015 12:22:58 +0000, Mark Lawrence
<breamore...@yahoo.co.uk> wrote:

>
>Use your context manager at the outer level.
>
>import sqlite3 as lite
>
>try:
>     with lite.connect('data.db') as db:
>     try:
>         db.execute(sql, parms)
>     except lite.IntegrityError:
>         raise ValueError('invalid data')
>except lite.DatabaseError:
>     raise OSError('database file corrupt or not found.')

The sqlite context manager doesn't close a database connection on
exit. It only ensures, commits and rollbacks are performed.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to