Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试学习如何BEGIN ... COMMIT在 SQLite 中使用。我正在尝试这段代码:
BEGIN ... COMMIT
BEGIN INSERT INTO fields VALUES ('field1') COMMIT;
但它失败了
Error: near "INSERT": syntax error
但是,仅使用 insert 语句时,它会成功:
INSERT INTO fields VALUES ('field1');
由于您在事务中拥有它,因此您必须以 ; 结束每个语句
BEGIN; INSERT INTO fields VALUES ('field1'); COMMIT;