尝试修改 sqlite3 插入以返回 PK。 不确定如何使用 sqlite3 专门执行此操作
Trying to modify an sqlite3 insert to return the PK. Wasn't sure how to do it with sqlite3 specifically
>我试图在表中插入一些数据,但我不确定什么标志允许我返回主键。我相信我记得MSSQL使用RETURNING,而其他一些人在最后使用了RETURNS。
有人可以帮忙附加它吗?
我正在尝试返回 TABLEA.a,我的查询和设计如下所示:
sqlite3 *db;
sqlite3_open("...",&db);
std::string query;
query = "insert into TABLEA (b,c,d,e) values (@b,"@c",@d,@e);";
//^--this needs to be modified.
sqlite3_stmt *sqlstmt;
int rc;
rc = sqlite3_prepare_v2(db, query.c_str(), 01, &sqlstmt, 0);
sqlite3_step(sqlstmt);
int ID;
ID = sqlite3_column_integer(sqlstmt,0);
你试过sqlite3_last_insert_rowid
吗?
相关文章:
- 无法在windows上使用mingw将sqlite3与c连接
- 如何使用 c++ 在 sqlite3 中打开受密码保护的数据库?
- 如何使用Qt QSqlDriver::subscribeToNotification with SQLite3?
- 在 vscode for c++ 中使用 sqlite3(未定义对 'xxx' 的引用)(我使用了 -lsqlite3)
- 如何使用C++在sqlite3数据库中执行写文件功能
- 无法使用 sqlite3 在链接器错误上生成 PROJ
- C++ SQLite3 不使用预准备语句删除
- 为什么 sqlite3 不能与 NFS 一起使用?
- 尝试修改 sqlite3 插入以返回 PK。 不确定如何使用 sqlite3 专门执行此操作
- 使用 sqlite3 时内存不足
- 使用 sqlite3 和 C++ 绑定和返回文本数据
- 使用C 和控制台的SQLITE3的怪异结果
- 使用字符"-"不起作用的 SQlite3 C 库进行全文搜索
- 可视化如何使用C++在 SQLite3 数据库上实现回滚事务
- 使用 LLVM 的 libc++ 时,__1 符号从何而来?
- 使用多个进程进行SQLite3性能测试
- DLL使用sqlite3从不同的进程写入同一个数据库文件
- 在sqlite3中使用汉字
- SQLite3 -内存使用逐渐增加,直到所有可用内存被消耗
- 如果我为多个编写器使用额外的互斥锁,我可以在 SQLite3 中使用 WAL 模式吗?