[DB-SIG] MS SQL Server module in development
Stuart Bishop
zen@shangri-la.dropbear.id.au
Mon, 2 Jul 2001 23:55:21 +1000 (EST)
On 2 Jul 2001, Dave Cole wrote:
> The DB library only allows a single result set to be in flight over a
> server connection. To make it possible to open multiple cursors
> simultaneously I have done the "obvious" thing of opening a new
> connection for each cursor.
>
> This introduces the problem: how can I implement Connection.commit()
> and Connection.rollback()?
>
> I really have two options:
>
> 1) Do not allow multiple simultaneous cursors on a connection.
>
> 2) Implement Cursor.commit() and Cursor.rollback()
>
> Can anyone else think of any other options?
Implement Cursor.commit() and Cursor.rollback().
To emulate 'standard' commit/rollback behaviour
Connection.commit() and Connection.rollback() then simply
to call the corresponding method on all Cursor objects that
it has produced (which is easy as your Connection.cursor()
method maintains a dictionary of weak references to the Cursor
objects it produces).
Oh... I see... The real problem will be what to do if one of the
commits or rollbacks fails while the Connection object is iterating
over its list of cursors... bugger. It might be worth looking
at how the PerlDBI, JDBC or ODBC drivers handle the situation.
--
Stuart Bishop <zen@shangri-la.dropbear.id.au>