Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 64c241f

Browse files
committed
limiting original UNION query results to only 1 result (potentially speeding things up in some cases)
1 parent e00f4a8 commit 64c241f

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/core/agent.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,12 @@ def forgeInbandQuery(self, query, position, count, comment, prefix, suffix, char
582582
if query.startswith("SELECT "):
583583
query = query[len("SELECT "):]
584584

585-
inbandQuery = self.prefixQuery("UNION ALL SELECT ", prefix=prefix)
585+
limitOriginal = ""
586+
if where == PAYLOAD.WHERE.ORIGINAL:
587+
if Backend.getIdentifiedDbms() in (DBMS.MYSQL, ):
588+
limitOriginal = "%s " % (queries[Backend.getIdentifiedDbms()].limit.query % (1, 1))
589+
590+
inbandQuery = self.prefixQuery("%sUNION ALL SELECT " % limitOriginal, prefix=prefix)
586591

587592
if limited:
588593
inbandQuery += ",".join(char if _ != position else '(SELECT %s)' % query for _ in xrange(0, count))

0 commit comments

Comments
 (0)