cursor.rowcount does not reset when executing the same statement a second time · Issue #193 · oracle/python-cx_Oracle (original) (raw)
The cursor.rowcount attribute seems to increment when running the same query multiple times, when I expected it to reset. Example:
cur = mycon.cursor() STMT = "SELECT * FROM DUAL WHERE 1=:s"
cur.execute(STMT, [0]) _ = cur.fetchone() print cur.rowcount
cur.execute(STMT, [1]) _ = cur.fetchone() print cur.rowcount
cur.execute(STMT, [1]) _ = cur.fetchone() print cur.rowcount
cur.execute(STMT, [0]) _ = cur.fetchone() print cur.rowcount
Expected output:
Actual output:
Documentation
PEP 249 suggests the rowcount should reset to zero every time execute() is called:
https://www.python.org/dev/peps/pep-0249/#rowcount
Answer the following questions:
- What is your version of Python? Is it 32-bit or 64-bit?
Python 2.6.6, 64-bit
Same behaviour observed on Python 2.7.12, 64-bit - What is your version of cx_Oracle?
6.3 - What is your version of the Oracle client (e.g. Instant Client)? How was it
installed? Where is it installed?
Installed via pip, /usr/lib64/python2.6/site-packages/cx_Oracle.so - What is your version of the Oracle Database?
12.1c - What is your OS and version?
RHEL6