fixes for Sybase

This commit is contained in:
Miroslav Stampar 2011-06-15 18:49:35 +00:00
parent 4d51fa8155
commit 4188df0501
2 changed files with 17 additions and 3 deletions

View File

@ -167,6 +167,14 @@ class Enumeration(GenericEnumeration):
conf.db = safeSQLIdentificatorNaming(conf.db)
if conf.col:
colList = conf.col.split(",")
else:
colList = []
for col in colList:
colList[colList.index(col)] = safeSQLIdentificatorNaming(col)
if conf.tbl:
tblList = conf.tbl.split(",")
else:
@ -202,6 +210,12 @@ class Enumeration(GenericEnumeration):
return { conf.db: kb.data.cachedColumns[conf.db]}
if colList:
table = {}
table[unsafeSQLIdentificatorNaming(tbl)] = dict(map(lambda x: (x, None), colList))
kb.data.cachedColumns[unsafeSQLIdentificatorNaming(conf.db)] = table
continue
infoMsg = "fetching columns "
infoMsg += "for table '%s' " % tbl
infoMsg += "on database '%s'" % conf.db
@ -219,8 +233,8 @@ class Enumeration(GenericEnumeration):
for name, type_ in zip(retVal[0]["%s.name" % randStr], retVal[0]["%s.usertype" % randStr]):
columns[name] = sybaseTypes.get(type_, type_)
table[tbl] = columns
kb.data.cachedColumns[conf.db] = table
table[unsafeSQLIdentificatorNaming(tbl)] = columns
kb.data.cachedColumns[unsafeSQLIdentificatorNaming(conf.db)] = table
break

View File

@ -524,7 +524,7 @@
<blind/>
</columns>
<dump_table>
<inband query="SELECT %s FROM %s..%s"/>
<inband query="SELECT %s FROM %s.%s"/>
<blind query="SELECT MIN(%s) FROM %s WHERE CONVERT(NVARCHAR(4000),%s)>'%s'" query2="SELECT MAX(%s) FROM %s WHERE CONVERT(NVARCHAR(4000),%s) LIKE '%s'" count="SELECT COUNT(*) FROM %s" count2="SELECT COUNT(*) FROM (SELECT DISTINCT %s FROM %s) AS value_table"/>
</dump_table>
<search_db>