SQLite总是回复"database table is locked"
SQLite always replies with "database table is locked"
如果我在C++程序中执行这些语句(%s
代表一个选择语句,它可以变化,请假设%s
没有错误)。
BEGIN TRANSACTION;
CREATE TEMP TABLE tmp AS %s;
DROP TABLE tmp;
COMMIT;
然后 sqlite3 总是用 database table is locked
回复,除非我不在最后删除表。语句使用 sqlite3_exec()
执行。网上还有其他类似的问题,但没有答案,例如:
http://sqlite.1065341.n5.nabble.com/How-is-the-table-getting-locked-and-how-to-unlock-it-td58324.html
我怀疑PRAGMA journal_mode=WAL;PRAGMA synchronous=OFF;
是罪魁祸首,但我不确定。另外,也许逐个执行和完成语句也可能起作用?我可以检查表当前是否已锁定吗?
您正在使用sqlite3_enable_shared_cache()
或SQLITE_OPEN_SHAREDCACHE
。 – CL.
相关文章:
- Why is UINT32_MAX + 1 = 0?
- C++错误:"error: int aaa::bbb is protected within this context"
- 创建具有 new in 函数和"this is nullptr"异常的对象
- 使用 cmake 的 Linux 终端上的"Conversion to non-scalar type is requested"错误
- Is !NaN not a NaN?
- Directx 11 - CompileFromFile() is not compiling
- Centos7 g++ "to_string is not in a member of std"
- "Unable to start debugging. No process is associated with this object." - 在Visual Studio Code中使用GDB
- Where is std::hardware_destructive_interference_size?
- 将成员函数作为构造函数参数调用时出错 "Variable is not a type name"
- What is unordered_set in C++
- 你如何理解"std: :forward is just syntactic sugar"?这是真的吗?
- C++ "error: use of overloaded operator '*' is ambiguous"似乎只有一场比赛
- C++ is calculating wrong
- Is it good to use SDL_PIXELFORMAT_UNKNOWN?
- reference_wrapper导致"incomplete type is not allowed"
- 为什么即使在定义之后仍存在"Identifier is undefined error "?
- 结构中的错误"Incomplete type is not allowed"
- Crash in boost::archive::text_iarchive in_archive {is} boost
- SQLite总是回复"database table is locked"