made --search -D on MSSQL consistent with other DBMSes - issue #81

This commit is contained in:
Bernardo Damele 2012-07-20 23:37:56 +01:00
parent 7f10b01265
commit 60242f92c5
2 changed files with 11 additions and 6 deletions

View File

@ -158,15 +158,16 @@ class Enumeration(GenericEnumeration):
return kb.data.cachedTables return kb.data.cachedTables
def searchTable(self): def searchTable(self):
rootQuery = queries[Backend.getIdentifiedDbms()].search_table
foundTbls = {} foundTbls = {}
tblList = conf.tbl.split(",") tblList = conf.tbl.split(",")
rootQuery = queries[Backend.getIdentifiedDbms()].search_table
tblCond = rootQuery.inband.condition tblCond = rootQuery.inband.condition
#dbCond = rootQuery.inband.condition2 #dbCond = rootQuery.inband.condition2
tblConsider, tblCondParam = self.likeOrExact("table") tblConsider, tblCondParam = self.likeOrExact("table")
if not len(kb.data.cachedDbs): if conf.db and conf.db != CURRENT_DB:
enumDbs = conf.db.split(",")
elif not len(kb.data.cachedDbs):
enumDbs = self.getDbs() enumDbs = self.getDbs()
else: else:
enumDbs = kb.data.cachedDbs enumDbs = kb.data.cachedDbs
@ -247,7 +248,13 @@ class Enumeration(GenericEnumeration):
if len(tbls) == 0: if len(tbls) == 0:
foundTbls.pop(db) foundTbls.pop(db)
return foundTbls if not foundTbls:
warnMsg = "no databases contain any of the provided tables"
logger.warn(warnMsg)
return
conf.dumper.dbTables(foundTbls)
self.dumpFoundTables(foundTbls)
def searchColumn(self): def searchColumn(self):
rootQuery = queries[Backend.getIdentifiedDbms()].search_column rootQuery = queries[Backend.getIdentifiedDbms()].search_column

View File

@ -154,12 +154,10 @@ class Search:
foundTbls = {} foundTbls = {}
tblList = conf.tbl.split(",") tblList = conf.tbl.split(",")
rootQuery = queries[Backend.getIdentifiedDbms()].search_table rootQuery = queries[Backend.getIdentifiedDbms()].search_table
tblCond = rootQuery.inband.condition tblCond = rootQuery.inband.condition
dbCond = rootQuery.inband.condition2 dbCond = rootQuery.inband.condition2
whereDbsQuery = "" whereDbsQuery = ""
tblConsider, tblCondParam = self.likeOrExact("table") tblConsider, tblCondParam = self.likeOrExact("table")
for tbl in tblList: for tbl in tblList: