[Sqlrelay-discussion] Python bindings and rowcount
Brought to you by:
mused
|
From: Jonathan K. <jka...@vo...> - 2008-05-09 19:39:27
|
Hi,
(This is a resend because I didn't see it show up in the mailing list.)
I'm running the latest release of SQLRelay, 0.39.4, which is talking to an Oracle database.
I've looked at the archives of the mailing list and haven't seen my issue mentioned before.
I have a problem with the python db api 2.0-esque bindings, PySQLRDB; cur.rowcount always returns 0 (cur.rowCount() from PySQLClient works fine).
>>> from SQLRelay import PySQLRDB
>>> con = PySQLRDB.connect('localhost', 9200, '', 'username', 'password', 0, 1)
>>> cur = con.cursor()
>>> cur.execute("select 1 from dual")
>>> cur.rowcount
0
>>> cur.fetchall()
[[Decimal("1")]]
>>> cur.rowcount
0
>>> from SQLRelay import PySQLRClient
>>> con = PySQLRClient.sqlrconnection('localhost', 9200, '', 'username', 'password', 0, 1)
>>> cur = PySQLRClient.sqlrcursor(con)
>>> cur.sendQuery("select 1 from dual")
1
>>> cur.rowCount()
1
I looked at PySQLRDB.py, PySQLRClient.py, and CSQLRelay.C.
In rowCount(), in PySQLRClient.py, the value returned comes from CSQLRelay.rowCount(self.cursor), which comes from ((sqlrcursor *)sqlrcur)->rowCount().
In execute(), in PySQLRDB.py, rowcount is assigned to either CSQLRelay.totalRows(self.cursor) or CSQLRelay.affectedRows(self.cursor), which come from ((sqlrcursor *)sqlrcur)->totalRows() or ((sqlrcursor *)sqlrcur)->affectedRows(), respectively.
So, rowCount returns 1, and both totalRows and affectedRows return 0.
Does anyone know why cur.rowcount, from PySQLRDB.py, would always return 0?
Thank you,
Jonathan Kaczynski
|