You are here : cpp0mysql_error

mysql_error() - 0

 For the connection specified by mysql,
        mysql_error() returns a
        null-terminated string containing the error message for the most
        recently invoked API function that failed. If a function did not
        fail, the return value of
        mysql_error() may be the
        previous error or an empty string to indicate no error.mysqlmysql_error()mysql_error()mysql_error()mysql_error()A rule of thumb is that all functions that have to ask the
        server for information reset
        mysql_error() if they succeed.mysql_error()mysql_error()For functions that reset
        mysql_error(), either of these
        two tests can be used to check for an error:mysql_error()mysql_error()if(*mysql_error(&mysql))
{
  // an error occurred
}

if(mysql_error(&mysql)[0])
{
  // an error occurred
}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. See
        Section 11.2, “Setting the Error Message Language”.Section 11.2, “Setting the Error Message Language”


Syntax

const char *mysql_error(MYSQL *mysql)


Example

if(*mysql_error(&mysql))
{
  // an error occurred
}

if(mysql_error(&mysql)[0])
{
  // an error occurred
}


Output / Return Value

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


Limitations


Alternatives / See Also


Reference