summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2010-10-25 17:03:44 -0700
committerPixel <pixel@nobis-crew.org>2010-10-25 17:03:44 -0700
commit6a5b9f63793f7efd1d923365cf32bb05a32793b0 (patch)
tree60b5c3987242da717f588ee21cdc4c7754fb8b65
parent515b99ca7aa343e99adc130ecf88036cb0cb5e57 (diff)
Adding 'read_only' on the opentable statement, and trying to be slightly smart about nextrow and the BLOB type at least.
-rw-r--r--lib/dblib.lua13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/dblib.lua b/lib/dblib.lua
index f9130be..8a1f7e1 100644
--- a/lib/dblib.lua
+++ b/lib/dblib.lua
@@ -227,7 +227,7 @@ END;
}
end,
- opentable = function(db, tablename, ddl, force_create)
+ opentable = function(db, tablename, ddl, force_create, read_only)
local tname
if db._.prefix and db._.prefix ~= "" and db._.odbc_name == "oracle" then
tname = db._.fq .. db._.prefix .. db._.fq .. '.' .. db._.fq .. db.sql_escape(tablename) .. db._.fq
@@ -239,7 +239,7 @@ END;
local operations = 0
local dfields = db:Desc(tablename)
- if force_create or dfields == nil then
+ if force_create or dfields == nil and not read_only then
-- table doesn't exist, create it
local q = "CREATE TABLE " .. tname .. " ("
local k, v, first
@@ -298,7 +298,7 @@ END;
db:SafeQuery("DROP TABLE " .. tname .. ";", "update")
end
end
- else
+ else not read_only
-- table exists, let's check it.
local i
local any_common = false
@@ -780,7 +780,12 @@ END;
if t._.db._.rset:next() ~= 0 then
row = {}
for k, v in pairs(t._.db._.fieldsNames) do
- row[v] = t._.db._.rset:getString(k)
+ local ftype = get_canon_type(t._.ddl[v] and t._.ddl[v].type or "varchar", v, t._.db)
+ if ftype == "BLOB"
+ row[v] = t._.db._.rset:getBlob(k)
+ else
+ row[v] = t._.db._.rset:getString(k)
+ end
end
end
return row