diff options
author | Pixel <pixel@nobis-crew.org> | 2008-10-04 08:32:35 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2008-10-04 08:32:35 -0700 |
commit | a826ac0246963a3e7043ce249a2b2ea359423d3c (patch) | |
tree | 237679462b4f45f84ad224d16e87336e8ed729da | |
parent | ba76e2efe6eee9c38822c935c1ecf598ed3f0747 (diff) |
Adding number of operations done during opentable
-rw-r--r-- | lib/dblib.lua | 8 |
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) |