(self, query)
| 1253 | return query |
| 1254 | |
| 1255 | def whereQuery(self, query): |
| 1256 | if conf.dumpWhere and query: |
| 1257 | if Backend.isDbms(DBMS.ORACLE) and re.search(r"qq ORDER BY \w+\)", query, re.I) is not None: |
| 1258 | prefix, suffix = re.sub(r"(?i)(qq)( ORDER BY \w+\))", r"\g<1> WHERE %s\g<2>" % conf.dumpWhere, query), "" |
| 1259 | else: |
| 1260 | match = re.search(r" (LIMIT|ORDER).+", query, re.I) |
| 1261 | if match: |
| 1262 | suffix = match.group(0) |
| 1263 | prefix = query[:-len(suffix)] |
| 1264 | else: |
| 1265 | prefix, suffix = query, "" |
| 1266 | |
| 1267 | if conf.tbl and "%s)" % conf.tbl.upper() in prefix.upper(): |
| 1268 | prefix = re.sub(r"(?i)%s\)" % re.escape(conf.tbl), "%s WHERE %s)" % (conf.tbl, conf.dumpWhere), prefix) |
| 1269 | elif re.search(r"(?i)\bWHERE\b", prefix): |
| 1270 | prefix += " AND %s" % conf.dumpWhere |
| 1271 | else: |
| 1272 | prefix += " WHERE %s" % conf.dumpWhere |
| 1273 | |
| 1274 | query = prefix |
| 1275 | if suffix and not all(re.search(r"ORDER BY", _, re.I) is not None for _ in (query, suffix)): |
| 1276 | query += suffix |
| 1277 | |
| 1278 | return query |
| 1279 | |
| 1280 | # SQL agent |
| 1281 | agent = Agent() |
no test coverage detected