@@ -1026,8 +1026,19 @@ def getColumns(self, onlyColNames=False):
10261026 infoMsg = "fetching columns "
10271027
10281028 if len (colList ) > 0 :
1029- condQuery = " AND (%s)" % " OR " .join ("%s LIKE '%%%s%%'" % (condition , unsafeSQLIdentificatorNaming (col )) for col in colList )
1030- infoMsg += "like '%s' " % ", " .join (unsafeSQLIdentificatorNaming (col ) for col in colList )
1029+ message = "do you want to use LIKE operator to "
1030+ message += "retrieve column names similar to the "
1031+ message += "ones provided with the -C option? [Y/n]"
1032+
1033+ test = readInput (message , default = "Y" )
1034+
1035+ if not (isinstance (test , basestring ) and test .upper () == "N" ):
1036+ condQuery = " AND (%s)" % " OR " .join ("%s LIKE '%%%s%%'" % (condition , unsafeSQLIdentificatorNaming (col )) for col in colList )
1037+ infoMsg += "LIKE '%s' " % ", " .join (unsafeSQLIdentificatorNaming (col ) for col in colList )
1038+ else :
1039+ condQuery = " AND (%s)" % " OR " .join ("%s = '%s'" % (condition , unsafeSQLIdentificatorNaming (col )) for col in colList )
1040+ infoMsg += "'%s' " % ", " .join (unsafeSQLIdentificatorNaming (col ) for col in colList )
1041+
10311042 else :
10321043 condQuery = ""
10331044
@@ -1446,7 +1457,8 @@ def dumpTable(self):
14461457 try :
14471458 if not unsafeSQLIdentificatorNaming (conf .db ) in kb .data .cachedColumns \
14481459 or unsafeSQLIdentificatorNaming (tbl ) not in \
1449- kb .data .cachedColumns [unsafeSQLIdentificatorNaming (conf .db )]:
1460+ kb .data .cachedColumns [unsafeSQLIdentificatorNaming (conf .db )] \
1461+ or not kb .data .cachedColumns [unsafeSQLIdentificatorNaming (conf .db )][unsafeSQLIdentificatorNaming (tbl )]:
14501462 warnMsg = "unable to enumerate the columns for table "
14511463 warnMsg += "'%s' on database" % unsafeSQLIdentificatorNaming (tbl )
14521464 warnMsg += " '%s', skipping" % unsafeSQLIdentificatorNaming (conf .db )
@@ -1460,7 +1472,7 @@ def dumpTable(self):
14601472
14611473 infoMsg = "fetching"
14621474 if conf .col :
1463- infoMsg += " columns '%s'" % colString
1475+ infoMsg += " column(s) '%s'" % colString
14641476 infoMsg += " entries for table '%s'" % unsafeSQLIdentificatorNaming (tbl )
14651477 infoMsg += " on database '%s'" % unsafeSQLIdentificatorNaming (conf .db )
14661478 logger .info (infoMsg )
0 commit comments