sqlite学习笔记10 C语言中使用sqlite之查询和更新数据

这篇博客介绍了如何在C语言中使用SQLite进行数据查询和更新。通过sqlite_exec()函数和自定义回调函数处理SELECT语句的结果,同时展示了selectFromTable和updateTable两个函数的用法。
摘要由CSDN通过智能技术生成
               

前面说到的 sqlite_exec() 中的第三个参数, SQLite 将为 sql 参数内执行的每个 SELECT 语句中处理的每个记录调用这个回调函数。

本节添加了两个函数,selectFromTable和updateTable.


实例程序如下:

#include <stdio.h>#include <stdlib.h>#include "sqlite/sqlite3.h"#define DB_NANE "sqlite/test.db"sqlite3 *db = NULL;char* sql = NULL;char *zErrMsg = NULL;const char* data = "Callback function called";/* 改为全局的 */int ret = 0;typedef enum{    false,    true} bool;/*typedef int (*sqlite3_callback)(void*,    Data provided in the 4th argument of sqlite3_exec()int,      The number of columns in rowchar**,   An array of strings representing fields in the rowchar**    An array of strings representing column names);*/static int callback(void *NotUsed, in
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值