CLIENT_MULTI_RESULTS Tell the server that the client can handle multiple result sets from multiple-statement executions or stored procedures. This is automatically set if CLIENT_MULTI_STATEMENTS is set. Added in MySQL 4.1. CLIENT_NO_SCHEMA Don't allow the db_name.tbl_name.col_name syntax. This is for ODBC. It causes the parser to generate an error if you use that syntax, which is useful for trapping bugs in some ODBC programs. CLIENT_ODBC The client is an ODBC client. This changes mysqld to be more ODBC-friendly. CLIENT_SSL Use SSL (encrypted protocol). This option should not be set by application programs; it is set internally in the client library. Instead, use mysql_ssl_set() before calling mysql_real_connect().
For some parameters, it is possible to have the value taken from an option file rather than from an explicit value in the mysql_real_connect() call. To do this, call mysql_options() with the MYSQL_READ_DEFAULT_FILE or MYSQL_READ_DEFAULT_GROUP option before calling mysql_real_connect(). Then, in the mysql_real_connect() call, specify the “no-value” value for each parameter to be read from an option file:
*
For host, specify a value of NULL or the empty string (""). *
For user, specify a value of NULL or the empty string. *
For passwd, specify a value of NULL. (For the password, a value of the empty string in the mysql_real_connect() call cannot be overridden in an option file, because the empty string indicates explicitly that the MySQL account must have an empty password.) *
For db, specify a value of NULL or the empty string. *
For port, specify a value of 0. *
For unix_socket, specify a value of NULL.
If no value is found in an option file for a parameter, its default value is used as indicated in the descriptions given earlier in this section.
Return Values
A MYSQL* connection handle if the connection was successful, NULL if the connection was unsuccessful. For a successful connection, the return value is the same as the value of the first parameter. // 返回值:当连接成功时,返回MYSQL连接句柄,失败,返回NULL。当成功时,返回值与第一个参数值是// 相同的。
Errors
*
CR_CONN_HOST_ERROR
Failed to connect to the MySQL server. *
CR_CONNECTION_ERROR
Failed to connect to the local MySQL server. *
CR_IPSOCK_ERROR
Failed to create an IP socket. *
CR_OUT_OF_MEMORY
Out of memory. *
CR_SOCKET_CREATE_ERROR
Failed to create a Unix socket. *
CR_UNKNOWN_HOST
Failed to find the IP address for the hostname. *
CR_VERSION_ERROR
A protocol mismatch resulted from attempting to connect to a server with a client library that uses a different protocol version. This can happen if you use a very old client library to connect to a new server that wasn't started with the --old-protocol option. *
CR_NAMEDPIPEOPEN_ERROR
Failed to create a named pipe on Windows. *
CR_NAMEDPIPEWAIT_ERROR
Failed to wait for a named pipe on Windows. *
CR_NAMEDPIPESETSTATE_ERROR
Failed to get a pipe handler on Windows. *
CR_SERVER_LOST
If connect_timeout > 0 and it took longer than connect_timeout seconds to connect to the server or if the server died while executing the init-command.
因此mysql_real_connect()函数调用为: mysql_real_connect(mysql,"localhost","root",NULL,"test",0,NULL,0); 判断是否出错,出错调用mysql_error()函数显示出错信息,或使用mysql_errno()函数获取出错代号。
如果您对本文有任何疑问或者建议,请到讨论区发表您的意见:
>>
论坛入口 <<
上一页 1 23 下一页
上一篇:mysql存储过程及c#调用标准版 下一篇:Mysql分页查询通用存储过程
|