MySQL (version 3.23.33 on Linux 2.2.5-15) is returning an empty string from
mysql_info() following an UPDATE query.
The docs say:
char *mysql_info(MYSQL *mysql)
Description
Retrieves a string providing information about the most recently executed query, but
only for the statements listed below. For other statements, mysql_info() returns NULL.
The format of the string varies depending on the type of query, as described below.
The numbers are illustrative only; the string will contain values appropriate for the
query.
INSERT INTO ... SELECT ...
String format: Records: 100 Duplicates: 0 Warnings: 0
INSERT INTO ... VALUES (...),(...),(...)...
String format: Records: 3 Duplicates: 0 Warnings: 0
LOAD DATA INFILE ...
String format: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
ALTER TABLE
String format: Records: 3 Duplicates: 0 Warnings: 0
UPDATE
String format: Rows matched: 40 Changed: 40 Warnings: 0
Test program:
#include <mysql.h>
int main()
{
MYSQL mysql;
char* info;
mysql_init(&mysql);
mysql_real_connect(&mysql, "localhost", 0, 0, "test", MYSQL_PORT, 0, 0);
mysql_query(&mysql, "CREATE TABLE tinfo(id INT, name VARCHAR(40))");
mysql_query(&mysql, "INSERT INTO tinfo VALUES(42, 'Tom')");
mysql_query(&mysql, "INSERT INTO tinfo VALUES(43, 'Dick')");
mysql_query(&mysql, "INSERT INTO tinfo VALUES(44, 'Harry')");
mysql_query(&mysql, "UPDATE tinfo SET id = 45, name = 'Monty'");
info = mysql_info(&mysql);
printf("info: [%s]\n", info ? info : "NULL");
mysql_query(&mysql, "DROP TABLE tinfo");
mysql_close(&mysql);
}
Output from test program:
info: []
I know the queries are succeeding, because I looked at the table after running a
version of the test program which didn't have the "DROP TABLE" line in it.
Is this a known bug? I saw a similar report in the archives from last year, but no
reply to it.
Who needs Cupid? Matchmaker.com is the place to meet somebody.
FREE Two-week Trial Membership at http://www.matchmaker.com/home?rs=200015
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php