From e3836f22e00b8f91612efb545e6e0d3f3fd7de46 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 1 Aug 2022 17:25:40 +0200 Subject: util.sqlite3: Skip prepared statements when no parameters are given Seems CREATE INDEX is unhappy as a prepared statement. Perhaps because the table has not been COMMIT-ed yet? --- util/sqlite3.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/util/sqlite3.lua b/util/sqlite3.lua index 332f0068..4caf121a 100644 --- a/util/sqlite3.lua +++ b/util/sqlite3.lua @@ -164,6 +164,16 @@ function engine:execute(sql, ...) if not success then return success, err; end local prepared = self.prepared; + if select('#', ...) == 0 then + local ret = self.conn:exec(sql); + if ret ~= lsqlite3.OK then + local err = sqlite_errors.new(err); + err.text = self.conn:errmsg(); + return err; + end + return true; + end + local stmt = prepared[sql]; if not stmt then local err; -- cgit v1.2.3