Name

mysql_info —

Synopsis

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

Example

/* 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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.