summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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