前面说到的 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