gpt4 book ai didi

c - C中的Sqlite3,运行多个查询

转载 作者:太空狗 更新时间:2023-10-29 15:36:38 25 4
gpt4 key购买 nike

我正在编写 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com