摘要: 1、通常从MySQL数据库中检索数据有4个步骤:(1)发出查询: 用mysql_query发出查询。(2)检索数据: 用mysql_store_result/mysql_use_result(3)处理数据:用mysql_fetch_row, mysql_fetch_field(4)整理所需要的数据:用mysql_free_result允许MySQL进行必要的整理工作。2、例子:结构化的数据库查询输出/* * MysqlQuery2.c * * Created on: Sep 8, 2013 * Author: root */#include #include #include MY... 阅读全文
posted @ 2013-09-08 14:47 wangle100 阅读(324) 评论(0) 推荐(0) 编辑
摘要: 1、执行SQL语句函数: int mysql_query(MYSQL* mysql, const char * query); query:所有的sql语句2、例子: 向children表插入一条语句,查看sql语句改动的行数量。/* * MysqlQuery.c * * Created on: Sep 8, 2013 * Author: root */#include #include #include int main(){ MYSQL my_connection; int res; mysql_init(&my_connection); //if(my... 阅读全文
posted @ 2013-09-08 14:46 wangle100 阅读(568) 评论(0) 推荐(0) 编辑
摘要: 命令行后面加入 -l mysqlclient例如: 对mysqlQuery.c编译,使用gcc mysqlQuery.c -o mysqlQuery -l mysqlclient,即可编译成功。 阅读全文
posted @ 2013-09-08 13:09 wangle100 阅读(1433) 评论(0) 推荐(1) 编辑