Skip to content

Commit 6e06df3

Browse files
committed
Minor bug fix
1 parent f01610b commit 6e06df3

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

plugins/generic/databases.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ def getSchema(self):
901901
self.getTables()
902902

903903
infoMsg = "fetched tables: "
904-
infoMsg += ", ".join(["%s" % ", ".join("%s%s%s" % (unsafeSQLIdentificatorNaming(db), ".." if Backend.isDbms(DBMS.MSSQL) or Backend.isDbms(DBMS.SYBASE) else '.', unsafeSQLIdentificatorNaming(_)) for _ in tbl) for db, tbl in kb.data.cachedTables.items()])
904+
infoMsg += ", ".join(["%s" % ", ".join("'%s%s%s'" % (unsafeSQLIdentificatorNaming(db), ".." if Backend.isDbms(DBMS.MSSQL) or Backend.isDbms(DBMS.SYBASE) else '.', unsafeSQLIdentificatorNaming(_)) for _ in tbl) for db, tbl in kb.data.cachedTables.items()])
905905
logger.info(infoMsg)
906906

907907
for db, tables in kb.data.cachedTables.items():

plugins/generic/syntax.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,16 @@ def _escape(expression, quote=True, escaper=None):
2828
if quote:
2929
for item in re.findall(r"'[^']*'+", expression):
3030
original = item[1:-1]
31-
if original and re.search(r"\[(SLEEPTIME|RAND)", original) is None: # e.g. '[SLEEPTIME]' marker
32-
replacement = escaper(original) if not conf.noEscape else original
33-
34-
if replacement != original:
35-
retVal = retVal.replace(item, replacement)
36-
elif len(original) != len(getBytes(original)) and "n'%s'" % original not in retVal and Backend.getDbms() in (DBMS.MYSQL, DBMS.PGSQL, DBMS.ORACLE, DBMS.MSSQL):
37-
retVal = retVal.replace("'%s'" % original, "n'%s'" % original)
31+
if original:
32+
if Backend.isDbms(DBMS.SQLITE) and "X%s" % item in expression:
33+
continue
34+
if re.search(r"\[(SLEEPTIME|RAND)", original) is None: # e.g. '[SLEEPTIME]' marker
35+
replacement = escaper(original) if not conf.noEscape else original
36+
37+
if replacement != original:
38+
retVal = retVal.replace(item, replacement)
39+
elif len(original) != len(getBytes(original)) and "n'%s'" % original not in retVal and Backend.getDbms() in (DBMS.MYSQL, DBMS.PGSQL, DBMS.ORACLE, DBMS.MSSQL):
40+
retVal = retVal.replace("'%s'" % original, "n'%s'" % original)
3841
else:
3942
retVal = escaper(expression)
4043

0 commit comments

Comments
 (0)