C语言 中mysql_query()函数的返回值是什么?

liangchaoxi 2013-12-23 08:04:37
C语言 中mysql_query()函数 当里面执行的SELECT 语句时,返回值是什么? 我知道不是执行SELECT \SHOW 语句的时候 成功返回0 失败返回非零, 在PHP中执行SELECT \SHOW 语句的时候 成功返回的是MYSQL_RES *。请问C中十分也是? 如果不是,执行SELECT \SHOW 语句的时候,如何释放内存?
...全文
479 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ACMAIN_CHM 2013-12-23
  • 打赏
  • 举报
回复
int mysql_query(MYSQL *mysql, const char *stmt_str) 类似这类问题,其实可以直接百度,或者查看MYSQL的官方免费手册。
引用
20.9.3.51. mysql_query() int mysql_query(MYSQL *mysql, const char *stmt_str) Description Executes the SQL statement pointed to by the null-terminated string stmt_str. Normally, the string must consist of a single SQL statement and you should not add a terminating semicolon (“;”) or \g to the statement. If multiple-statement execution has been enabled, the string can contain several statements separated by semicolons. See Section 20.9.12, “C API Support for Multiple Statement Execution”. mysql_query() cannot be used for statements that contain binary data; you must use mysql_real_query() instead. (Binary data may contain the “\0” character, which mysql_query() interprets as the end of the statement string.) If you want to know whether the statement should return a result set, you can use mysql_field_count() to check for this. See Section 20.9.3.22, “mysql_field_count()”. Return Values Zero if the statement was successful. Nonzero if an error occurred. Errors CR_COMMANDS_OUT_OF_SYNC Commands were executed in an improper order. CR_SERVER_GONE_ERROR The MySQL server has gone away. CR_SERVER_LOST The connection to the server was lost during the query. CR_UNKNOWN_ERROR An unknown error occurred.
gongheguoyingpai11 2013-12-23
  • 打赏
  • 举报
回复
http://dev.mysql.com/doc/refman/5.1/zh/apis.html#mysql-query

56,677

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧