Software /
code /
prosody
Changeset
12848:ccb030d988ac
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?
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 01 Aug 2022 17:25:40 +0200 |
parents | 12847:d6cdde74cd9b |
children | 12849:330bfcaa5532 |
files | util/sqlite3.lua |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/util/sqlite3.lua Fri Oct 01 02:27:53 2021 +0200 +++ b/util/sqlite3.lua Mon Aug 01 17:25:40 2022 +0200 @@ -164,6 +164,16 @@ 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;