Re[2]: [python-sybase] Problem with calling stored procedures
Dave Cole
djc at object-craft.com.au
13 Apr 2002 13:08:18 +1000
>>>>> "Harri" == Harri Pasanen <harri.pasanen@trema.com> writes:
>> begin tran
>> go
>> select * from authors
>> go
>> sp_helpindex authors
>> go
Harri> Maybe a dumb question, but why would you be opening a
Harri> transaction in the Sybase module if not explicitly asked?
The begin tran is implicit as the connection is in chained transaction
mode by default. To turn off this behaviour you need to pass the
auto_commit flag to the Sybase.connect() function.
Harri> I'd expect what I'm doing in python be the same as above,
Harri> without the "begin tran" line.
The other way to get it to happen is this:
set chained on
go
select * from authors
go
sp_helpindex authors
go
The Sybase documentation says:
If you set chained transaction mode, Adaptive Server
implicitly invokes a begin transaction before the following
statements: delete, insert, open, fetch, select, and
update. You must still explicitly close the transaction with a
commit.
To cancel all or part of a transaction, use the rollback
command. The rollback command must appear within a
transaction; you cannot roll back a transaction after it is
committed.
- Dave
--
http://www.object-craft.com.au