|
37 | 37 | from lib.core.common import unArrayizeValue
|
38 | 38 | from lib.core.common import wasLastResponseDBMSError
|
39 | 39 | from lib.core.compat import xrange
|
| 40 | +from lib.core.convert import decodeBase64 |
40 | 41 | from lib.core.convert import getUnicode
|
41 | 42 | from lib.core.convert import htmlUnescape
|
42 | 43 | from lib.core.data import conf
|
@@ -126,6 +127,9 @@ def _oneShotUnionUse(expression, unpack=True, limited=False):
|
126 | 127 | try:
|
127 | 128 | retVal = ""
|
128 | 129 | for row in json.loads(output):
|
| 130 | + # NOTE: for cases with automatic MySQL Base64 encoding of JSON array values, like: ["base64:type15:MQ=="] |
| 131 | + for match in re.finditer(r"base64:type\d+:([^ ]+)", row): |
| 132 | + row = row.replace(match.group(0), decodeBase64(match.group(1), binary=False)) |
129 | 133 | retVal += "%s%s%s" % (kb.chars.start, row, kb.chars.stop)
|
130 | 134 | except:
|
131 | 135 | retVal = None
|
@@ -254,7 +258,7 @@ def unionUse(expression, unpack=True, dump=False):
|
254 | 258 |
|
255 | 259 | if Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.ORACLE, DBMS.PGSQL, DBMS.MSSQL, DBMS.SQLITE) and expressionFields and not any((conf.binaryFields, conf.limitStart, conf.limitStop, conf.forcePartial, conf.disableJson)):
|
256 | 260 | match = re.search(r"SELECT\s*(.+?)\bFROM", expression, re.I)
|
257 |
| - if match and not (Backend.isDbms(DBMS.ORACLE) and FROM_DUMMY_TABLE[DBMS.ORACLE] in expression) and not re.search(r"\b(MIN|MAX|COUNT)\(", expression): |
| 261 | + if match and not (Backend.isDbms(DBMS.ORACLE) and FROM_DUMMY_TABLE[DBMS.ORACLE] in expression) and not re.search(r"\b(MIN|MAX|COUNT|EXISTS)\(", expression): |
258 | 262 | kb.jsonAggMode = True
|
259 | 263 | if Backend.isDbms(DBMS.MYSQL):
|
260 | 264 | query = expression.replace(expressionFields, "CONCAT('%s',JSON_ARRAYAGG(CONCAT_WS('%s',%s)),'%s')" % (kb.chars.start, kb.chars.delimiter, expressionFields, kb.chars.stop), 1)
|
|
0 commit comments