|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi all,
I have a simple procedure (basically it is a dummy procedure to test the C-API interface) CREATE PROCEDURE get_day_info( p_sDate VARCHAR(8)) BEGIN SELECT 0, 1, 1; END and can execute it inside the mysql terminal: mysql> call get_day_info('xxx'); +---+---+---+ | 0 | 1 | 1 | +---+---+---+ | 0 | 1 | 1 | +---+---+---+ 1 row in set (0.00 sec) Query OK, 0 rows affected (0.01 sec) I can also retrieve these results from the C-API with the sequence: mysql_query( conn, "call get_day_info('xxx')"); result = mysql_use_result(conn); while ( row = mysql_fetch_row(result) ) { ... do something with row[0] ... row[2] } mysql_free_result(result); So far so good: All the 3 string values that are returned by the procedure are processed and in local buffers of my application. The strange thing happens now, when I issue a: mysql_next_result(conn); It returns 0, which indicates that there are more result sets available, so I let a mysql_store_result() follow. But mysql_store_result() returns the NULL pointer, while mysql_errno() is zero. So why is 'mysql_next_result()' fooling me? I am working with libmysqlclient version 5.0.45 on MS Windows 2000. The database server is on a Unix machine and has version 5.0.32 Not sure, if this might cause some complications. I'd rather expect, that it is related with the multithreading architecture of my application. Here is a outline of my startup code: run mysql_library_init() without errors Checking with mysql_thread_safe() returns TRUE open 3 sessions to the database server each session with: conn = mysql_init(NULL) and mysql_real_connect( ...., CLIENT_MULTI_RESULTS) each session has its own Mutex to make sure, that always only one thread is using any of the mysql_something() API functions that work with the connection handle. I'm happy about any comments or hints on this. At the moment I don't see any harm, but frankly "Detecting the existence of a result" and "Seeing it gone in the next moment" sounds a bit like a memory leak, that strikes you back right in the moment, when you start to deploy the application. Thanks, Rolf. |
|
![]() |
| Outils de la discussion | |
|
|