From: Andrew M. <an...@ob...> - 2004-07-30 07:11:31
|
>I'm using version 0.36 of the Sybase module, linked against Sybase OCS >libraries. >I want to use the cursor.rowcount value, but it always seems to return -1, did I >understand something wrong? > > >>> db = Sybase.connect("XXX", "XXX", "XXX") > >>> c = db.cursor() > >>> c.execute("select * from pers") > >>> print c.rowcount > -1 > >>> print len(c.fetchall()) > 7 I can't speak for the Sybase module, but pyPgSQL (a python postgres connector) only initialises this variable after you've fetched your rows. In their case, it appears to be a limitation of the Postgres C API, rather than a problem with the python adaptor: I think the database is reserving the right to return partial results while still performing the query (so even it doesn't know how many rows will be returned). -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ |