Bug #90799 unread_result did not reset to false after conn.get_rows (C extension)

Submitted: 9 May 2018 6:17 Modified: 25 Jun 2018 22:02
Reporter: jie zhang Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / Python Severity:S3 (Non-critical)
Version: OS:Linux
Assigned to: CPU Architecture:Any

[9 May 2018 6:17] jie zhang
Description:
`conn.unread_result` always True after calling `conn.get_rows()` (when using extension).

This meant different behavior depending on whether using C extension or not.

mysql-connector-python version: 8.0.11

Please see code below. Thanks!

How to repeat:
Install pip mysql-connector-python:

    pip install mysql-connector-python

using C extension:

```python
import mysql.connector

conn = mysql.connector.connect(user='root', password='3707', database='spider')

cur = conn.cursor()

cur.execute('select * from bilibili')

print('conn.unread_result', conn.unread_result)  # True
conn.get_rows()
print('conn.unread_result', conn.unread_result)  # <---- True, expect False
```

use pure version:

```python
import mysql.connector

conn = mysql.connector.connect(user='root', password='3707', database='spider', use_pure=True)

cur = conn.cursor()

cur.execute('select * from bilibili')

print('conn.unread_result', conn.unread_result)  # True
conn.get_rows()
print('conn.unread_result', conn.unread_result)  # False
```
[9 May 2018 9:50] Chiranjeevi Battula
Hello jie zhang,

Thank you for the bug report and test case.
Verified this behavior on MySQL Connector/Python 8.0.11.

Thanks,
Chiranjeevi.
[9 May 2018 9:51] Chiranjeevi Battula
Results:
conn.unread_result True
conn.unread_result True
[12 Jun 2018 21:14] Philip Olson
Posted by developer:
 
This is documented with WL #11951, thank you for the bug report and helping make C/Python predictable :)
[25 Jun 2018 22:02] Philip Olson
A major effort took place to synchronize the C and Python implementations of this connector in the upcoming 8.0.12 release, and fixing this bug was part of it. Thank you for the report!

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.055 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.