PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > C-API: mysql_next_result and mysql_store_result
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
C-API: mysql_next_result and mysql_store_result

Réponse
 
LinkBack Outils de la discussion
Vieux 13/02/2008, 16h24   #1
rolf_unger@hotmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut C-API: mysql_next_result and mysql_store_result

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.

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 21h41.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08824 seconds with 9 queries