Bug #11902 mysql_stmt_attr_set CURSOR_TYPE_READ_ONLY nested queries imcomplete row set
Submitted: 13 Jul 2005 9:04 Modified: 13 Jul 2005 11:56
Reporter: Berto van de Kraats Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.0.10-beta OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[13 Jul 2005 9:04] Berto van de Kraats
Description:
If cursors are enabled, and queries on the same table are nested then the outer query returns "end of set" too early.

How to repeat:
Compile and run the attached program (which is an automatically generated trace
of our mysql database driver). The problem reproduces if the program silently
runs and has exit status 0.

The trace contains a call to mysql_stmt_fetch that returns 101 (search for pattern "ERROR:" in attached program), while it should return 0 because there are still 31 rows left in the row set.

Special note for Konstantin (if he's the one to pick up this problem): I've
taken your comments seriously. To replay the problem on your local server, it
should suffice to change the DB_NAME, USER_NAME, USER_PWD, OWNER_NAME, OWNER_PWD
and UNIX_SOCKET constants.
You don't have to remove the database name from all queries, because they are
not there anymore.
If you are to change the statement text, then that is no problem, because now
strlen() is used instead of the hard coded integers.
[13 Jul 2005 9:05] Berto van de Kraats
Cpp trace of problem

Attachment: bug11902.cpp (text/plain), 26.92 KiB.

[13 Jul 2005 11:56] Berto van de Kraats
This may well be the same problem as bug 11909 (mysql_stmt_attr_set CURSOR_TYPE_READ_ONLY nested queries corrupt result). The return code is 101 (MYSQL_DATA_TRUNCATED). Sorry.