added --hostname switch to retrieve DBMS server hostname - closes issue #69

This commit is contained in:
Bernardo Damele
2012-07-12 00:01:57 +01:00
parent 4e64c1126d
commit 53c0336b48
7 changed files with 39 additions and 2 deletions

View File

@@ -64,6 +64,9 @@ def action():
if conf.getCurrentDb:
conf.dumper.currentDb(conf.dbmsHandler.getCurrentDb())
if conf.getHostname:
conf.dumper.hostname(conf.dbmsHandler.getHostname())
if conf.isDba:
conf.dumper.dba(conf.dbmsHandler.isDba())

View File

@@ -74,7 +74,7 @@ class Dump:
def string(self, header, data, sort=True):
if isListLike(data):
self.lister(header, data, sort)
elif data is not None:
elif data is not None and len(data) > 0:
data = getUnicode(data)
if data[-1] == '\n':
@@ -125,6 +125,9 @@ class Dump:
else:
self.string("current database", data)
def hostname(self,data):
self.string("hostname", data)
def dba(self,data):
self.string("current user is DBA", data)

View File

@@ -96,6 +96,7 @@ optDict = {
"getBanner": ("boolean", "Banners"),
"getCurrentUser": ("boolean", "Users"),
"getCurrentDb": ("boolean", "Databases"),
"getHostname": "boolean",
"isDba": "boolean",
"getUsers": ("boolean", "Users"),
"getPasswordHashes": ("boolean", "Passwords"),

View File

@@ -304,6 +304,10 @@ def cmdLineParser():
action="store_true",
help="Retrieve DBMS current database")
enumeration.add_option("--hostname", dest="getHostname",
action="store_true",
help="Retrieve DBMS server hostname")
enumeration.add_option("--is-dba", dest="isDba",
action="store_true",
help="Detect if the DBMS current user is DBA")