[python-sybase] Problem with calling stored procedures
Dave Cole
djc at object-craft.com.au
04 Apr 2002 00:47:06 +1000
> 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 to shed some light on the problem:
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()
db.commit()
cmd = "sp_helpindex %s" % table
print db.execute(cmd)
test('authors')
- Dave
--
http://www.object-craft.com.au