Re[2]: [python-sybase] Problem with calling stored procedures

Harri Pasanen harri.pasanen at trema.com
Wed, 3 Apr 2002 17:33:53 +0200 (CEST)


On 04 Apr 2002 01:03:10 +1000 Dave Cole <djc@object-craft.com.au> wrote:

> 
> > > import Sybase
> > > Sybase._ctx.debug = 1
> > > db = Sybase.connect('SYBASE', 'sa', '', 'pubs2')
> > > 
> > > def test(table):
> > >     print "Test table:", table
> > >     c = db.cursor()
> > >     c.execute('select * from '+table)
> > >     c.fetchall()
> > >     c.close()
> > >     cmd = "sp_helpindex %s" % table
> > >     print db.execute(cmd)
> > > 
> > > test('authors')
> > 
> > Ahh...  It does fail - it returns a status code from the stored
> > procedure of -6.  I have no idea what that means...
> > 
> > What I did discover though is that the problem is transaction related.
> > If I knew a lot more about isolation levels and how they interact with
> > stored procedures I might be able to give a more meaningful answer.
> 
> Try this in ISQL:
> 
> begin tran
> go
> select * from authors
> go
> sp_helpindex authors
> go
> 

Maybe a dumb question, but why would you be opening a transaction in the
Sybase module if not explicitly asked?

I'd expect what I'm doing in python be the same as above, without the
"begin tran" line.


-Harri