From a826ac0246963a3e7043ce249a2b2ea359423d3c Mon Sep 17 00:00:00 2001 From: Pixel Date: Sat, 4 Oct 2008 08:32:35 -0700 Subject: Adding number of operations done during opentable --- lib/dblib.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3