C中的Sqlite3,运行多个查询

时间:2012-02-04 21:50:11

标签: c sqlite

我正在编写一个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()吗?

如果我有大量查询,我宁愿不要一遍又一遍地运行这些命令

1 个答案:

答案 0 :(得分:3)

在参考资料中找到,我的不好:

  

这些例程只编译zSql中的第一个语句,因此* pzTail指向仍未编译的内容。