[egenix-users] Hi all, bug or feature?
Rafael Pinilla
rafaelpinilla at free.fr
Thu May 17 14:05:02 CEST 2007
hi all.
i'm in the process to make SQL requests in an automatic way. Right now,
the data are in a Sybase SQL anywhere 7 database providing native ODBC
driver as System DSN on Win32 platform.
The base is quite complex, with more than 20 tables and more than
800.000 records in one table, 5 years old, with integrity reference
checking from beginning.
I installed mxODBC, with test license, and I tried to reach my data.
After I figured out how to firt create an instance of the connexion,
then an instance of the cursor, I tried hard coded SQL statement.
I gracefully had a sequence of tuples result. As I wanted to count some
results, i tried cursor.rowcount() Afortunately the results were very
different from direct SQL based request (like isql statements).
A deeper look showed me that the sequence of tuples were right until the
last row, and then, a variable amount of null tuples were added.
So, cursor.rowcount return the good number of rows, but there are more
empty (null) rows than expected. I really can't figure why.
I found a workaound using
i=1
courant = list(cur.fetchone())
while courant[1] <> () :
print i
courant = cur.fetchone()
print courant
i = i+1
In these lines, I convert the tuple in a list to let python make a test
on the first (second, yes I figure) item. This is a right
cursor.rowcount workaround for suspicious dummies.
So, this bug dont stop me. Perhaps is it a bug, perhaps an unknown
feature. I can give more information, perhaps a shelve of the resulting
tuple. Ask me if you want. Perhaps the cursor.rowcount method should
make a test to stop inserting null tuples at the end of the sequence of
(good) tuples.
Thanks for your reaction.
Rafael
More information about the egenix-users
mailing list