util.sql: Don't fetch row count of result sets for queries that don't have result sets

This commit is contained in:
Kim Alvefur 2013-07-12 17:03:09 +02:00
parent 3d9b1be698
commit c41f00e53f

View file

@ -178,7 +178,6 @@ end
local result_mt = { __index = {
affected = function(self) return self.__affected; end;
rowcount = function(self) return self.__rowcount; end;
} };
function engine:execute_query(sql, ...)
@ -200,7 +199,7 @@ function engine:execute_update(sql, ...)
prepared[sql] = stmt;
end
assert(stmt:execute(...));
return setmetatable({ __affected = stmt:affected(), __rowcount = stmt:rowcount() }, result_mt);
return setmetatable({ __affected = stmt:affected() }, result_mt);
end
engine.insert = engine.execute_update;
engine.select = engine.execute_query;