You are here : cpp0mysql_errno

mysql_errno() - 0

 For the connection specified by mysql,
        mysql_errno() returns the error
        code for the most recently invoked API function that can succeed
        or fail. A return value of zero means that no error occurred.
        Client error message numbers are listed in the MySQL
        errmsg.h header file. Server error message
        numbers are listed in mysqld_error.h.
        Errors also are listed at Appendix B, Errors, Error Codes, and Common Problems.mysqlmysql_errno()mysql_errno()errmsg.hmysqld_error.hAppendix B, Errors, Error Codes, and Common ProblemsErrors, Error Codes, and Common ProblemsNote


          Some functions such as
          mysql_fetch_row() do not set
          mysql_errno() if they succeed.
          A rule of thumb is that all functions that have to ask the
          server for information reset
          mysql_errno() if they succeed.NoteSome functions such as
          mysql_fetch_row() do not set
          mysql_errno() if they succeed.
          A rule of thumb is that all functions that have to ask the
          server for information reset
          mysql_errno() if they succeed.mysql_fetch_row()mysql_fetch_row()mysql_errno()mysql_errno()mysql_errno()mysql_errno()MySQL-specific error numbers returned by
        mysql_errno() differ from
        SQLSTATE values returned by
        mysql_sqlstate(). For example,
        the mysql client program displays errors
        using the following format, where 1146 is the
        mysql_errno() value and
        '42S02' is the corresponding
        mysql_sqlstate() value:mysql_errno()mysql_errno()mysql_sqlstate()mysql_sqlstate()mysqlmysqlmysql1146mysql_errno()mysql_errno()'42S02'mysql_sqlstate()mysql_sqlstate()shell> SELECT * FROM no_such_table;
ERROR 1146 (42S02): Table 'test.no_such_table' doesn't existSELECT * FROM no_such_table;SELECT * FROM no_such_table;


Syntax

unsigned int mysql_errno(MYSQL *mysql)


Example

shell> SELECT * FROM no_such_table;
ERROR 1146 (42S02): Table 'test.no_such_table' doesn't exist


Output / Return Value

 An error code value for the last
        mysql_xxx() call,
        if it failed. zero means no error occurred.mysql_xxx()xxxxxx


Limitations


Alternatives / See Also


Reference