Minor represenation fix

This commit is contained in:
Miroslav Stampar 2013-02-15 14:48:24 +01:00
parent 67157fa2ba
commit 014e4e0055
2 changed files with 8 additions and 3 deletions

View File

@ -212,7 +212,7 @@ class Dump(object):
if table and isListLike(table): if table and isListLike(table):
table = table[0] table = table[0]
maxlength = max(maxlength, len(normalizeUnicode(table) or str(table))) maxlength = max(maxlength, len(unsafeSQLIdentificatorNaming(normalizeUnicode(table) or str(table))))
lines = "-" * (int(maxlength) + 2) lines = "-" * (int(maxlength) + 2)
@ -232,6 +232,7 @@ class Dump(object):
if table and isListLike(table): if table and isListLike(table):
table = table[0] table = table[0]
table = unsafeSQLIdentificatorNaming(table)
blank = " " * (maxlength - len(normalizeUnicode(table) or str(table))) blank = " " * (maxlength - len(normalizeUnicode(table) or str(table)))
self._write("| %s%s |" % (table, blank)) self._write("| %s%s |" % (table, blank))
@ -263,6 +264,7 @@ class Dump(object):
for column in colList: for column in colList:
colType = columns[column] colType = columns[column]
column = unsafeSQLIdentificatorNaming(column)
maxlength1 = max(maxlength1, len(column or "")) maxlength1 = max(maxlength1, len(column or ""))
maxlength2 = max(maxlength2, len(colType or "")) maxlength2 = max(maxlength2, len(colType or ""))
@ -299,6 +301,8 @@ class Dump(object):
for column in colList: for column in colList:
colType = columns[column] colType = columns[column]
column = unsafeSQLIdentificatorNaming(column)
blank1 = " " * (maxlength1 - len(column)) blank1 = " " * (maxlength1 - len(column))
if colType is not None: if colType is not None:

View File

@ -18,6 +18,7 @@ from lib.core.common import randomInt
from lib.core.common import randomStr from lib.core.common import randomStr
from lib.core.common import safeStringFormat from lib.core.common import safeStringFormat
from lib.core.common import safeSQLIdentificatorNaming from lib.core.common import safeSQLIdentificatorNaming
from lib.core.common import unsafeSQLIdentificatorNaming
from lib.core.data import conf from lib.core.data import conf
from lib.core.data import kb from lib.core.data import kb
from lib.core.data import logger from lib.core.data import logger
@ -101,7 +102,7 @@ def tableExists(tableFile, regex=None):
if conf.verbose in (1, 2) and not hasattr(conf, "api"): if conf.verbose in (1, 2) and not hasattr(conf, "api"):
clearConsoleLine(True) clearConsoleLine(True)
infoMsg = "[%s] [INFO] retrieved: %s\r\n" % (time.strftime("%X"), table) infoMsg = "[%s] [INFO] retrieved: %s\r\n" % (time.strftime("%X"), unsafeSQLIdentificatorNaming(table))
dataToStdout(infoMsg, True) dataToStdout(infoMsg, True)
if conf.verbose in (1, 2): if conf.verbose in (1, 2):
@ -197,7 +198,7 @@ def columnExists(columnFile, regex=None):
if conf.verbose in (1, 2) and not hasattr(conf, "api"): if conf.verbose in (1, 2) and not hasattr(conf, "api"):
clearConsoleLine(True) clearConsoleLine(True)
infoMsg = "[%s] [INFO] retrieved: %s\r\n" % (time.strftime("%X"), column) infoMsg = "[%s] [INFO] retrieved: %s\r\n" % (time.strftime("%X"), unsafeSQLIdentificatorNaming(column))
dataToStdout(infoMsg, True) dataToStdout(infoMsg, True)
if conf.verbose in (1, 2): if conf.verbose in (1, 2):