Robert MacDonald writes:
> 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.
>
>
>
HI!
Yes, this is a known bug, here is a patch for it:
===== sql_parse.cc 1.118 vs edited =====
*** /tmp/sql_parse.cc-1.118-23407 Wed Mar 21 00:58:38 2001
--- edited/sql_parse.cc Wed Mar 21 14:24:21 2001
***************
*** 455,461 ****
db=strend(passwd)+1;
if (thd->client_capabilities & CLIENT_INTERACTIVE)
thd->inactive_timeout=net_interactive_timeout;
! if (thd->client_capabilities & CLIENT_TRANSACTIONS)
thd->net.return_status= &thd->server_status;
net->timeout=net_read_timeout;
if (check_user(thd,COM_CONNECT, user, passwd, db, 1))
--- 455,462 ----
db=strend(passwd)+1;
if (thd->client_capabilities & CLIENT_INTERACTIVE)
thd->inactive_timeout=net_interactive_timeout;
! if ((thd->client_capabilities & CLIENT_TRANSACTIONS) &&
! opt_using_transactions)
thd->net.return_status= &thd->server_status;
net->timeout=net_read_timeout;
if (check_user(thd,COM_CONNECT, user, passwd, db, 1))
Regards,
Sinisa
____ __ _____ _____ ___ == MySQL AB
/*/\*\/\*\ /*/ \*\ /*/ \*\ |*| Sinisa Milivojevic
/*/ /*/ /*/ \*\_ |*| |*||*| mailto:[EMAIL PROTECTED]
/*/ /*/ /*/\*\/*/ \*\|*| |*||*| Larnaca, Cyprus
/*/ /*/ /*/\*\_/*/ \*\_/*/ |*|____
^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^
/*/ \*\ Developers Team
---------------------------------------------------------------------
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