Good afternoon Chaps,
I'm looking for your advice on the best way to handle exceptions on a query
and commit. Within my application I have a universal database connection
which gets injected into objects which require database access, I then use
this connection to create cursors, run queries an
On 2008-07-04 12:34, Heston James - Cold Beans wrote:
Good afternoon Chaps,
I'm looking for your advice on the best way to handle exceptions on a query
and commit. Within my application I have a universal database connection
which gets injected into objects which require database access, I t
> I'd put the whole transaction code into a try-except:
>
> try:
> # Start of transaction
> ... do stuff ...
> except Exception:
> self.datasource.rollback()
> raise
> else:
> self.datasource.commit()
>
> This assures that a successful execution of your code results in
> th
On 2008-07-04 14:03, Heston James - Cold Beans wrote:
I'd put the whole transaction code into a try-except:
try:
# Start of transaction
... do stuff ...
except Exception:
self.datasource.rollback()
raise
else:
self.datasource.commit()
This assures that a successful exec
On 2008-07-04 14:22, M.-A. Lemburg wrote:
On 2008-07-04 14:03, Heston James - Cold Beans wrote:
I'd put the whole transaction code into a try-except:
try:
# Start of transaction
... do stuff ...
except Exception:
self.datasource.rollback()
raise
else:
self.datasource.co