diff options
author | Ted Trask <ttrask01@yahoo.com> | 2013-09-29 03:00:23 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2013-09-29 03:00:23 +0000 |
commit | 3f507e4e6710b559ed1efe4260b043b6c1b1694d (patch) | |
tree | 0945026af37e5e8a5de915f324c944b8909838c6 | |
parent | 96d4ddff1fc5d4868642728148e266bf7be18d1e (diff) | |
download | acf-lib-3f507e4e6710b559ed1efe4260b043b6c1b1694d.tar.bz2 acf-lib-3f507e4e6710b559ed1efe4260b043b6c1b1694d.tar.xz |
Change db.name to db.database and fix bug with calling db.escape
-rw-r--r-- | db.lua | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -32,7 +32,7 @@ export.databaseconnect = function(dbobject) end -- connect to data source - dbobject.con = assert(dbobject.env:connect(dbobject.name, dbobject.user, dbobject.password, dbobject.host, dbobject.port)) + dbobject.con = assert(dbobject.env:connect(dbobject.database, dbobject.user, dbobject.password, dbobject.host, dbobject.port)) return true end return false @@ -127,7 +127,7 @@ end export.listcolumns = function(dbobject, table) local result = {} if dbobject.engine == engine.postgresql then - local col = dbobject.getselectresponse("SELECT a.attname AS field FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname = '"..escape(dbobject, table).."' AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid ORDER BY a.attnum") + local col = dbobject.getselectresponse("SELECT a.attname AS field FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname = '"..dbobject.escape(table).."' AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid ORDER BY a.attnum") for i,c in ipairs(col) do result[#result+1] = c.field end @@ -169,8 +169,8 @@ engine = { ["postgresql"] = 1, } -create = function(engine, name, user, password, host, port) - local dbobject = {engine=engine, name=name, user=user, password=password, host=host, port=port} +create = function(engine, database, user, password, host, port) + local dbobject = {engine=engine, database=database, user=user, password=password, host=host, port=port} for n,f in pairs(export) do dbobject[n] = function(...) return f(dbobject, ...) end end |