OPENBUS-3045 Correção da ativação do PRAGMA foreign_keys

Conforme https://www.sqlite.org/foreignkeys.html o pragma de
foreign_keys não pode ser ativado ou desativado numa transação.

(cherry picked from commit 05caf37b)
parent 6e67e1b7
...@@ -367,9 +367,9 @@ local stmts = {} ...@@ -367,9 +367,9 @@ local stmts = {}
function DataBase:__init() function DataBase:__init()
local conn = self.conn local conn = self.conn
self:aexec("PRAGMA foreign_keys=ON;")
self:aexec("BEGIN;") self:aexec("BEGIN;")
self:aexec(SQL_create_tables) self:aexec(SQL_create_tables)
self:aexec("PRAGMA foreign_keys=ON;")
local pstmts = {} local pstmts = {}
for _, action in ipairs(actions) do for _, action in ipairs(actions) do
local sql = buildSQL(action) local sql = buildSQL(action)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment