[python-sybase] Having a problem with rowcount

Nicholas Veeser nicholas.veeser at plumtree.com
Fri, 18 Apr 2003 14:51:57 -0700


So I am using FreeTDS with Python and Sybase.py.

I am do a connection, cursor, execute a query and can fetch the results =
of the query.
All that works.

But when I go to change the code to check the rowcount for the status of =
the query,=20
it is always -1.   Should it not be set to the number of rows in the =
query, which for my
query is like 50.

Here is the code (basically):

conn =3D Sybase.connect( cfg['dsn'], cfg['user'], cfg['pass'] )
cursor =3D conn.cursor()
cursor.execute ("SELECT id, queuetype FROM Components")

print "XXX: rowcount:", cursor.rowcount

while (1):
        row =3D cursor.fetchone()
        if row =3D=3D None: break
        print row

connect.close()

Thanx
Nicholas