WanderInCode / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

rowcount seems numerical overflow #259

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

src_cnxn=pyodbc.connect(src_connectstring)
src_curs=src_cnxn.cursor()

checkresults_exe=src_curs.execute("locking row for access SELECT ITEM_ID, 
(count(*)(bigint))  AS count_audit FROM DBNAME1.TABLE1 WHERE  
END_DT>=(('2011-01-01'(DATE))-interval '6' month)  GROUP BY ITEM_ID ORDER BY 
count_audit DESC")

checkresults_exe.rowcount  ##This returns a negative number

What is the expected output? What do you see instead?
The result should be a positive long integer, but it gives me a negative number.

What version of the product are you using? On what operating system?
pyodbc 3.0.3
python 2.7.2
teradata ODBC 64bit

Original issue reported on code.google.com by chuangt...@gmail.com on 9 May 2012 at 12:29

GoogleCodeExporter commented 8 years ago
If the value is always -1, it is probably the driver.  The rowcount value is 
supposed to be -1 when the previous statement was not one that modifies or 
selects rows.  Note that pyodbc does not examine the SQL - it simply calls 
SQLRowCount.

For example, if you execute a "create table ..." statement, the rowcount should 
be -1.

Is the value some other negative number?

Original comment by mkleehammer on 26 Jun 2012 at 1:35

GoogleCodeExporter commented 8 years ago
The value depends on the number of rows in a table. If the number is less than 
one billion, it can correctly show the positive number. If the number is larger 
than a threshold, it shows a negative number, such as -49,186,683 records, 
-1,820,934,434 or  -1,799,086,733 records.

Original comment by chuangt...@gmail.com on 26 Jun 2012 at 9:15