1.mysql_sqlstate
const char *mysql_sqlstate (MySQL *mysql)
Describe
Returns a null-terminated string that contains the SQLSTATE error code for the last error. The error code consists of 5 characters. ' 00000 ' means no error. Its value is specified by ANSI SQL and ODBC.
Note: Not all MySQL errors are mapped to the SQLSTATE error code. The value ' HY000 ' (generic error) is used for unmapped errors.
return value
A null-terminated string containing the SQLSTATE error code.
2..mysql_real_connect connecting to a remote database
MySQL *mysql_real_connect (MySQL *mysql,
const char *host,//Connection host
const char *user,//database user
const char *PASSWD,//Database password
const char *DB,//Database
unsigned int port,//Port
const char *unix_socket,//If unix_socket is not NULL, the string describes the socket or named pipe that should be used. Note that the "host" parameter determines the type of connection.
The value of unsigned long client_flag//Client_flag is typically 0, however, it can also be set to a combination of the following flags to allow specific features
);
Flag Name |
Logo description |
Client_compress |
Use the compression protocol. |
Client_found_rows |
Returns the number of rows found (matched), not the number of rows affected. |
Client_ignore_space |
Spaces are allowed after the function name. Make all function names a reserved word. |
Client_interactive |
The inactivity time of interactive_timeout (superseded by wait_timeout) seconds is allowed before the connection is closed. The client's session Wait_timeout variable is set to the value of the session interactive_timeout variable. |
Client_local_files |
Allows the load DATA local processing feature. |
Client_multi_statements |
Notifies the server that a client may send multiple statements (by '; ') within a single string Separated). If this flag is not set, multi-statement execution is prohibited. |
Client_multi_results |
Notifies the server that a client can process multiple result sets from a multi-statement execution or stored program. If Client_multi_statements is set, it is set automatically. |
Client_no_schema |
Prohibit db_name.tbl_name.col_name syntax. It is used for ODBC. If this syntax is used, it can cause the parser to generate an error, which is useful when capturing flaws in some ODBC programs. |
Client_odbc |
The client is an ODBC client. It will mysqld become more ODBC-friendly. |
Client_ssl |
Use SSL (encryption protocol). This option should not be set by the application, it is set inside the client library. |
MySQL Database interface