Mailing List
Home
Forum Home
MySQL General - General MySQL discussion
MySQL++ - Programming with the C++ API to MySQL
MaxDB - Everything about MaxDB, formerly known as SAP DB
ODBC - ODBC with the MySQL Connector/ODBC driver
MySQL on Win32 - Runing MySQL on Windows 9x/Me/NT/2000/XP
Java Help - Mostly related to the MySQL Connector/J driver
Perl - Perl support for MySQL with DBI and DBD::mysql
GUI - MySQL GUI Tools
Announcement
Subjects
mysql openssl Question
mysql:it 's a db not a dbms how it 's possible?!
Does the binary log enabling affect the MySQL performances?
Strange behavior, Table Level Permission
FULLTEXT query format question
Preventing Duplicate Entries
Comparing and writing out BLOBS
Executing MySQL Commands From Within C Program
Can 't access mysql after kernel upgrade
Mysql 4 0 Oracle Stored Procedure Trigger Conversion
Downgrade Mysql from 4 to 3 23
MySQL Cluster Software
mysql test 4 1 fails with the gis test
ERROR 2002: Can 't connect to local MySQL server through socket
Getting Identity after INSERT
Update one field with more fields from another table
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
mysql have same function mthod as Oracle decode()
 
Multi result sets in 3.51.12 - patch workaround

Multi result sets in 3.51.12 - patch workaround

2006-11-02       - By Richard Riley

 Back
All,

Using C++ OLE DB -> MyODBC I was observing random connection failures while
calling stored procedures that return their own result set. I believe this was
caused by the "extra" emtpy result set that is returned by the server to
represent the status of the actual CALL (this behaviour is documented in the
manual).

The MyODBC connector sets the CLIENT_MULTI_RESULTS when connecting to MySQL. As
per section 22.2.9 of the manual, "If you enable multiple-statement support,
you
should process the results from mysql_query() and mysql_real_query() within a
loop that checks for more results. This is true even for statements such as
DROP
TABLE that return a result but not a result set. Failure to process the result
this way may result in a dropped connection to the server."

Any easy workaround is to add these lines to handle.c -

/* Retrive and discard any pending result sets */
while (mysql_next_result(&stmt->dbc->mysql) == 0)
   mysql_free_result(mysql_store_result(&stmt->dbc->mysql));

Obviously this is no good if you genuinely want to return multple sets of data,
but it's good enough to prevent connection failures caused by the additional
empty set that results from a stored procedure call.

If this is of help to anyone (any maintainers / developers out there?) then I
can
submit a full patch. In future there is presumably a plan to support multiple
result sets properly...

Regards

Richard Riley





--
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe:    http://lists.mysql.com/myodbc?unsub=mysql@(protected)