[python-sybase] problem with pending results

Dave Cole djc at object-craft.com.au
13 Apr 2002 12:44:42 +1000


>>>>> "Harri" == Harri Pasanen <harri.pasanen@trema.com> writes:

Harri> I presume you are seeing the message in the exception handler
Harri> for Sybase.Error ?

Harri> If you can, you could try closing the open cursors, call
Harri> db.commit() and then restart the operations.

Harri> Calling db.commit() in general seems to be a good idea for the
Harri> Sybase module (v0.34).  I rearranged my code to call
Harri> db.commit() before calling stored procedures, otherwise those
Harri> calls sometimes silently failed producing wrong results,
Harri> without throwing any exceptions.

The missing exception is a bug but requiring a commit() is correct
behaviour.  The DB-API specification says that in the documentation
for the Connection.commit() method:

        Commit any pending transaction to the database. Note that if
        the database supports an auto-commit feature, this must be
        initially off.

You can have the ISQL like behaviour by doing this:

db = Sybase.connect('SYBASE', user = 'sa', passwd = '', auto_commit = 1)

- Dave

-- 
http://www.object-craft.com.au