mirror of
https://github.com/bjc/prosody.git
synced 2025-04-04 13:47:41 +03:00
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?
This commit is contained in:
parent
320d4032a2
commit
e3836f22e0
1 changed files with 10 additions and 0 deletions
|
@ -164,6 +164,16 @@ function engine:execute(sql, ...)
|
||||||
if not success then return success, err; end
|
if not success then return success, err; end
|
||||||
local prepared = self.prepared;
|
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];
|
local stmt = prepared[sql];
|
||||||
if not stmt then
|
if not stmt then
|
||||||
local err;
|
local err;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue