mysql_info —


char *mysql_info(MYSQL *mysql)

Returns a string containing information about the most recent query, if the query was of a certain type. Currently, the following SQL queries supply extra information via this function: INSERT INTO (when used with a SELECT clause or a VALUES clause with more than one record), LOAD DATA INFILE, ALTER TABLE, and UPDATE. If the most recent query provided no additional information (e.g., it was not one of the above queries), this function returns a null value.

The format of the returned string depends on the query. If the query is INSERT INTO or ALTER TABLE, the string is:

Records: n Duplicates: n Warnings: n

If the query is LOAD DATA INFILE, the string is:

Records: n Deleted: n Skipped: n Warnings: n

If the query is UPDATE, the string is:

Rows matched: n Changed: n Warnings: n


/* We just sent LOAD DATA INFILE query reading a set of record from a file into
   an existing table */
printf("Results of data load: %s\n", mysql_info(&mysql));
/* The printed string looks like this:
Records: 30 Deleted: 0 Skipped: 0 Warnings: 0

Get Managing & Using MySQL, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.