summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/dblib.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/dblib.lua b/lib/dblib.lua
index d11e1ff..b514375 100644
--- a/lib/dblib.lua
+++ b/lib/dblib.lua
@@ -156,6 +156,7 @@ _luadb = {
opentable = function(db, tablename, ddl)
local fields, alters = _luadb.generate_fields(db, ddl)
local tname = "`" .. db._.prefix .. db.sql_escape(tablename) .. "`"
+ local operations = 0
if db:SafeQuery("DESC " .. tname) ~= 0 then
-- table doesn't exist, create it
@@ -163,6 +164,7 @@ _luadb = {
local q = "CREATE TABLE " .. tname .. " ("
local k, v, first
first = true
+ operations = -1
for k, v in pairs(fields) do
if not first then
@@ -223,6 +225,7 @@ _luadb = {
if db:SafeQuery(q) ~= 0 then
error("Error altering table " .. tname .. ": " .. db:ErrNO() .. " - " .. db:Error() .. " - query run = " .. q)
end
+ operations = operations + 1
end
end
dfields, d = d, nil
@@ -247,6 +250,7 @@ _luadb = {
if db:SafeQuery(q) ~= 0 then
error("Error altering table " .. tname .. ": " .. db:ErrNO() .. " - " .. db:Error() .. " - query run = " .. q)
end
+ operations = operations + 1
end
end
end
@@ -255,6 +259,7 @@ _luadb = {
if db:SafeQuery(q) ~= 0 then
error("Error altering table " .. tname .. ": " .. db:ErrNO() .. " - " .. db:Error() .. " - query run = " .. q)
end
+ operations = operations + 1
end
end
@@ -265,6 +270,7 @@ _luadb = {
if db:SafeQuery(q) ~= 0 then
error("Error altering table " .. tname .. ": " .. db:ErrNO() .. " - " .. db:Error() .. " - query run = " .. q)
end
+ operations = operations + 1
end
end
@@ -288,7 +294,7 @@ _luadb = {
ddl = ddl,
conditions = "1",
},
- }
+ }, operations
end,
compare_fields = function(ddl, field)