limiting original UNION query results to only 1 result (potentially speeding things up in some cases)

This commit is contained in:
Miroslav Stampar 2012-05-08 13:45:53 +00:00
parent e00f4a8934
commit 64c241fe92

View File

@ -582,7 +582,12 @@ class Agent:
if query.startswith("SELECT "):
query = query[len("SELECT "):]
inbandQuery = self.prefixQuery("UNION ALL SELECT ", prefix=prefix)
limitOriginal = ""
if where == PAYLOAD.WHERE.ORIGINAL:
if Backend.getIdentifiedDbms() in (DBMS.MYSQL, ):
limitOriginal = "%s " % (queries[Backend.getIdentifiedDbms()].limit.query % (1, 1))
inbandQuery = self.prefixQuery("%sUNION ALL SELECT " % limitOriginal, prefix=prefix)
if limited:
inbandQuery += ",".join(char if _ != position else '(SELECT %s)' % query for _ in xrange(0, count))