RE: Having a problem with rowcount

[email protected]
Newsgroups gmane.comp.python.sybase
Message-ID <71E7879B20E1C84B9055F73AD9B79CD8229C5D@msg1-il.integration.sungard.corp>
The rowcount is not set for selections, only for update and delete. This
is a behavior of the underlying database (Sybase does it, Oracle does
it, I suppose Microsoft does it too, though I don't really know). The
rationale is that this way the DBMS doesn't really have to check all the
possible rows until you ask to fetch them.

Hope this helps,
	Shai.


-----Original Message-----
From: Nicholas Veeser [mailto:[email protected]] 
Sent: Saturday, April 19, 2003 00:52
To: [email protected]
Subject: [python-sybase] Having a problem with rowcount


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, 
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 = Sybase.connect( cfg['dsn'], cfg['user'], cfg['pass'] )
cursor = conn.cursor()
cursor.execute ("SELECT id, queuetype FROM Components")

print "XXX: rowcount:", cursor.rowcount

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

connect.close()

Thanx
Nicholas
_______________________________________________
Python-sybase mailing list
[email protected]
https://object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.