Bug #69616 Executing multi=true query with SHOW GLOBAL STATUS returns no rows

Submitted: 28 Jun 2013 18:23 Modified: 4 Jul 2013 9:49
Reporter: Mike Reust Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / Python Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: Geert Vanderkelen CPU Architecture:Any

[28 Jun 2013 18:23] Mike Reust
Description:
Multi doesn't seem to work well with multiple "SHOW GLOBAL STATUS LIKE 'x'" statements.  It returns 0 rows.

How to repeat:
query = "SHOW GLOBAL STATUS LIKE 'queries';" \
        "SHOW GLOBAL STATUS LIKE 'Com_select;" \
        "SHOW GLOBAL STATUS LIKE 'Com_insert;" \
        "SHOW GLOBAL STATUS LIKE 'Com_update;" \
        "SHOW GLOBAL STATUS LIKE 'Com_delete;"

cursor = conn.cursor()
cursor.execute(query, multi=True)
cursor.with_rows #returns false
[1 Jul 2013 4:01] Shane Bester
is it intended that the single quotes are missing from the last 4 queries?
[1 Jul 2013 4:05] Mike Reust
No, the missing comments is a typo.  The issue persists, even with the comments fixed.
[4 Jul 2013 9:49] Geert Vanderkelen
Hi Mike,

You should loop over the results like this:

for result in cursor.execute(query, multi=True):
    if result.with_rows:
        print(result.fetchall())

Please check the example 'multi_resultsets.py' in the source.

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

Page generated in 0.039 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.