Documentation Home
MySQL 9.5 C API Developer Guide
Download this Manual
PDF (US Ltr) - 1.4Mb
PDF (A4) - 1.4Mb


6.4.10 mysql_stmt_error()

const char *mysql_stmt_error(MYSQL_STMT *stmt)

Description

For the statement specified bystmt,mysql_stmt_error() returns a null-terminated string containing the error message for the most recently invoked statement API function that can succeed or fail. An empty string ("") is returned if no error occurred. Either of these two tests can be used to check for an error:

if(*mysql_stmt_errno(stmt)){  // an error occurred}if (mysql_stmt_error(stmt)[0]){  // an error occurred}

If the failed statement API function wasmysql_stmt_close(), do not callmysql_stmt_error() to obtain error information becausemysql_stmt_close() makes the statement handler invalid. Callmysql_error() instead.

The language of the client error messages may be changed by recompiling the MySQL client library. You can choose error messages in several different languages.

Return Values

A character string that describes the error. An empty string if no error occurred.

Errors

None.