Minor enhancement to be able to dump entries also on MySQL < 5.0 when DB name, table name and column(s) are provided

This commit is contained in:
Bernardo Damele 2008-10-26 17:07:55 +00:00
parent 2fcbb57e1c
commit 342a5436f4

View File

@ -784,11 +784,6 @@ class Enumeration:
def dumpTable(self):
if kb.dbms == "MySQL" and not self.has_information_schema:
errMsg = "information_schema not available, "
errMsg += "back-end DBMS is MySQL < 5.0"
raise sqlmapUnsupportedFeatureException, errMsg
if not conf.tbl:
errMsg = "missing table parameter"
raise sqlmapMissingMandatoryOptionException, errMsg
@ -804,6 +799,23 @@ class Enumeration:
rootQuery = queries[kb.dbms].dumpTable
if conf.col:
self.cachedColumns[conf.db] = {}
self.cachedColumns[conf.db][conf.tbl] = {}
for column in colList:
self.cachedColumns[conf.db][conf.tbl][column] = None
elif not self.cachedColumns:
if kb.dbms == "MySQL" and not self.has_information_schema:
errMsg = "information_schema not available, "
errMsg += "back-end DBMS is MySQL < 5.0"
raise sqlmapUnsupportedFeatureException, errMsg
self.cachedColumns = self.getColumns(onlyColNames=True)
colList = self.cachedColumns[conf.db][conf.tbl].keys()
colList.sort(key=lambda x: x.lower())
colString = ", ".join(column for column in colList)
logMsg = "fetching"
if conf.col:
colList = conf.col.split(",")
@ -813,18 +825,6 @@ class Enumeration:
logMsg += " on database '%s'" % conf.db
logger.info(logMsg)
if conf.col:
self.cachedColumns[conf.db] = {}
self.cachedColumns[conf.db][conf.tbl] = {}
for column in colList:
self.cachedColumns[conf.db][conf.tbl][column] = None
elif not self.cachedColumns:
self.cachedColumns = self.getColumns(onlyColNames=True)
colList = self.cachedColumns[conf.db][conf.tbl].keys()
colList.sort(key=lambda x: x.lower())
colString = ", ".join(column for column in colList)
if conf.unionUse:
if kb.dbms == "Oracle":
query = rootQuery["inband"]["query"] % (colString, conf.tbl.upper())