aboutsummaryrefslogtreecommitdiffstats
path: root/util/sql.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-08-28 21:05:12 +0200
committerKim Alvefur <zash@zash.se>2017-08-28 21:05:12 +0200
commit38f73e28ae61f2222667b06ce99e44193ef82d78 (patch)
treefd5a447ceea625acd90410b509ca06e498d25171 /util/sql.lua
parente9d37d780b2e50e4f3ed34d3c355d651c0375cb2 (diff)
parent7e28119b3d3fe91b2f8541da2af90b232ab38412 (diff)
downloadprosody-38f73e28ae61f2222667b06ce99e44193ef82d78.tar.gz
prosody-38f73e28ae61f2222667b06ce99e44193ef82d78.zip
Merge 0.10->trunk
Diffstat (limited to 'util/sql.lua')
-rw-r--r--util/sql.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/util/sql.lua b/util/sql.lua
index 15749911..61d6af41 100644
--- a/util/sql.lua
+++ b/util/sql.lua
@@ -175,7 +175,11 @@ function engine:execute_query(sql, ...)
sql = self:prepquery(sql);
local stmt = assert(self.conn:prepare(sql));
assert(stmt:execute(...));
- return stmt:rows();
+ local result = {};
+ for row in stmt:rows() do result[#result + 1] = row; end
+ stmt:close();
+ local i = 0;
+ return function() i=i+1; return result[i]; end;
end
function engine:execute_update(sql, ...)
sql = self:prepquery(sql);