aboutsummaryrefslogtreecommitdiffstats
path: root/util/sqlite3.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-08-01 17:25:40 +0200
committerKim Alvefur <zash@zash.se>2022-08-01 17:25:40 +0200
commite3836f22e00b8f91612efb545e6e0d3f3fd7de46 (patch)
treeb0b96b4fa43be1d1c7410466144e4804f3174dd6 /util/sqlite3.lua
parent320d4032a21e0effe9e5a7628fdc2b5baf260066 (diff)
downloadprosody-e3836f22e00b8f91612efb545e6e0d3f3fd7de46.tar.gz
prosody-e3836f22e00b8f91612efb545e6e0d3f3fd7de46.zip
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?
Diffstat (limited to 'util/sqlite3.lua')
-rw-r--r--util/sqlite3.lua10
1 files changed, 10 insertions, 0 deletions
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;