summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2014-10-28 19:38:16 +0000
committerTed Trask <ttrask01@yahoo.com>2014-10-28 19:38:16 +0000
commit06c12c2ea537b6d33d5a649fd657afc604face4d (patch)
tree6975528f11978f520900104ea1aaa31733bb7f74
parentc0e97287356157dfdeaba0914863761b72fb59fb (diff)
downloadacf-lib-06c12c2ea537b6d33d5a649fd657afc604face4d.tar.bz2
acf-lib-06c12c2ea537b6d33d5a649fd657afc604face4d.tar.xz
Minor bug in db.lua when host or port are blank string
-rw-r--r--db.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/db.lua b/db.lua
index 0e8848f..adcc25a 100644
--- a/db.lua
+++ b/db.lua
@@ -167,15 +167,16 @@ export.listdatabases = function(dbobject)
local result = {}
if dbobject.engine == mymodule.engine.postgresql then
local cmd = {"psql", "-U", "postgres", "-lt"}
- if dbobject.host then
+ if dbobject.host and dbobject.host ~= "" then
cmd[#cmd+1] = "-h"
cmd[#cmd+1] = dbobject.host
end
- if dbobject.port then
+ if dbobject.port and dbobject.port ~= "" then
cmd[#cmd+1] = "-p"
cmd[#cmd+1] = dbobject.port
end
cmd["stderr"]=subprocess.STDOUT
+APP.logevent("calling: "..table.concat(cmd, " "))
local code, cmdresult = subprocess.call_capture(cmd)
if code ~= 0 then
error(cmdresult, 0)