里面有些函数功能很类似,我认为基本上是没有什么区别的。
 如 mysql_connect和 mysql_real_connect等等
 我想明白他们之间具体有什么区别。
谢谢大家。

解决方案 »

  1.   

    25.2.3.7. mysql_connect()
    MYSQL *mysql_connect(MYSQL *mysql, const char *host, const char *user, const char *passwd) Description This function is deprecated. It is preferable to use mysql_real_connect() instead. mysql_connect() attempts to establish a connection to a MySQL database engine running on host. mysql_connect() must complete successfully before you can execute any of the other API functions, with the exception of mysql_get_client_info(). The meanings of the parameters are the same as for the corresponding parameters for mysql_real_connect() with the difference that the connection parameter may be NULL. In this case, the C API allocates memory for the connection structure automatically and frees it when you call mysql_close(). The disadvantage of this approach is that you can't retrieve an error message if the connection fails. (To get error information from mysql_errno() or mysql_error(), you must provide a valid MYSQL pointer.) Return Values Same as for mysql_real_connect(). Errors Same as for mysql_real_connect(). 
      

  2.   

    和你所说完全一样。"基本上是没有什么区别的。"
    并且MySQL已经不推荐使用 mysql_connect() 了。
    由GOOGEL语言工具自动翻译如下。============================================
    25.2.3.7. mysql_connect()
    MYSQL *mysql_connect(MYSQL *mysql, const char *host, const char *user, const char *passwd) Description This function is deprecated. It is preferable to use mysql_real_connect() instead. 
    这一功能是不推荐。这是最好使用mysql_real_connect ( )代替。mysql_connect() attempts to establish a connection to a MySQL database engine running on host. mysql_connect() must complete successfully before you can execute any of the other API functions, with the exception of mysql_get_client_info(). 
    mysql_connect ( )试图建立一个连接到MySQL数据库引擎上运行的主机。 mysql_connect ( )必须成功完成,然后才能执行任何其他API函数,除了mysql_get_client_info ( ) 。The meanings of the parameters are the same as for the corresponding parameters for mysql_real_connect() with the difference that the connection parameter may be NULL. In this case, the C API allocates memory for the connection structure automatically and frees it when you call mysql_close(). The disadvantage of this approach is that you can't retrieve an error message if the connection fails. (To get error information from mysql_errno() or mysql_error(), you must provide a valid MYSQL pointer.) 
    的意义的参数是相同的相应参数mysql_real_connect ( )的区别,连接参数可能是无效的。在这种情况下,分配内存的C API的连接结构和自动释放它当调用mysql_close ( ) 。这种办法的缺点是,你不能找到一个错误信息,如果连接失败。 (要获得错误的信息mysql_errno ( )或mysql_error ( ) ,您必须提供一个有效的数据库指针。 )Return Values Same as for mysql_real_connect(). 
    相同mysql_real_connect ( ) 。Errors Same as for mysql_real_connect(). 
    相同mysql_real_connect ( ) 。