This commit is contained in:
Miroslav Stampar 2011-08-16 06:14:40 +00:00
parent df4abf1af1
commit 262996fc5b
2 changed files with 26 additions and 25 deletions

View File

@ -211,10 +211,9 @@ class Dump:
for column in colList: for column in colList:
colType = columns[column] colType = columns[column]
maxlength1 = max(maxlength1, len(column))
if colType is not None: maxlength1 = max(maxlength1, len(column or ""))
maxlength2 = max(maxlength2, len(colType)) maxlength2 = max(maxlength2, len(colType or ""))
maxlength1 = max(maxlength1, len("COLUMN")) maxlength1 = max(maxlength1, len("COLUMN"))
lines1 = "-" * (maxlength1 + 2) lines1 = "-" * (maxlength1 + 2)

View File

@ -1141,10 +1141,11 @@ class Enumeration:
if not isNoneValue(columnData): if not isNoneValue(columnData):
name = safeSQLIdentificatorNaming(columnData[0]) name = safeSQLIdentificatorNaming(columnData[0])
if len(columnData) == 1: if name:
columns[name] = "" if len(columnData) == 1:
else: columns[name] = ""
columns[name] = columnData[1] else:
columns[name] = columnData[1]
if conf.db in kb.data.cachedColumns: if conf.db in kb.data.cachedColumns:
kb.data.cachedColumns[safeSQLIdentificatorNaming(conf.db)][safeSQLIdentificatorNaming(tbl, True)] = columns kb.data.cachedColumns[safeSQLIdentificatorNaming(conf.db)][safeSQLIdentificatorNaming(tbl, True)] = columns
@ -1242,27 +1243,28 @@ class Enumeration:
query = agent.limitQuery(index, query, field) query = agent.limitQuery(index, query, field)
column = inject.getValue(query, inband=False, error=False) column = inject.getValue(query, inband=False, error=False)
if not onlyColNames: if not isNoneValue(column):
if Backend.getIdentifiedDbms() in ( DBMS.MYSQL, DBMS.PGSQL ): if not onlyColNames:
query = rootQuery.blind.query2 % (unsafeSQLIdentificatorNaming(tbl), column, unsafeSQLIdentificatorNaming(conf.db)) if Backend.getIdentifiedDbms() in ( DBMS.MYSQL, DBMS.PGSQL ):
elif Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2): query = rootQuery.blind.query2 % (unsafeSQLIdentificatorNaming(tbl), column, unsafeSQLIdentificatorNaming(conf.db))
query = rootQuery.blind.query2 % (unsafeSQLIdentificatorNaming(tbl.upper()), column) elif Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2):
elif Backend.isDbms(DBMS.MSSQL): query = rootQuery.blind.query2 % (unsafeSQLIdentificatorNaming(tbl.upper()), column)
query = rootQuery.blind.query2 % (conf.db, conf.db, conf.db, conf.db, column, conf.db, elif Backend.isDbms(DBMS.MSSQL):
conf.db, conf.db, unsafeSQLIdentificatorNaming(tbl)) query = rootQuery.blind.query2 % (conf.db, conf.db, conf.db, conf.db, column, conf.db,
elif Backend.isDbms(DBMS.FIREBIRD): conf.db, conf.db, unsafeSQLIdentificatorNaming(tbl))
query = rootQuery.blind.query2 % (tbl, column) elif Backend.isDbms(DBMS.FIREBIRD):
query = rootQuery.blind.query2 % (tbl, column)
colType = inject.getValue(query, inband=False, error=False) colType = inject.getValue(query, inband=False, error=False)
if Backend.isDbms(DBMS.FIREBIRD): if Backend.isDbms(DBMS.FIREBIRD):
colType = firebirdTypes.get(colType, colType) colType = firebirdTypes.get(colType, colType)
column = safeSQLIdentificatorNaming(column) column = safeSQLIdentificatorNaming(column)
columns[column] = colType columns[column] = colType
else: else:
column = safeSQLIdentificatorNaming(column) column = safeSQLIdentificatorNaming(column)
columns[column] = None columns[column] = None
if columns: if columns:
if conf.db in kb.data.cachedColumns: if conf.db in kb.data.cachedColumns: