我正在编写 C 程序并使用 sqlite 运行多个查询。我没有使用 sqlite3_exec()
,因为如果不为其编写回调函数就无法检索结果。
所以我有看起来像这样的源代码:
char * query = "CREATE TABLE 'items' (id int, icon int, name text); CREATE TABLE 'icons' (id int, image blob); CREATE TABLE 'playfields' (id int, name text);";
sqlite3_prepare_v2(dump_db_into,query,-1,&sqlstmt,0);
sqlite3_step(sqlstmt);
当然,只执行第一个查询。我需要多次运行 sqlite3_step()
吗?
如果我有大量查询,我宁愿避免一遍又一遍地运行这些命令
最佳答案
在引用资料中找到,我的错:
These routines only compile the first statement in zSql, so *pzTail is left pointing to what remains uncompiled.
关于c - C中的Sqlite3,运行多个查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9144869/