From 3ca5cddca76506a36c200af7a1c6965734b5bc19 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Sun, 20 Mar 2011 23:54:56 +0000 Subject: [PATCH] massive BUG FIX (if NULL is one of dumping values it will screw everything in corner cases because "SELECT 1 WHERE NULL IN (NULL)" and "SELECT 1 WHERE NULL NOT IN (NULL)" will always return nothing/nadda/zero/not even NULL) --- lib/core/agent.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/core/agent.py b/lib/core/agent.py index 4cc0d4791..c5352d2ac 100644 --- a/lib/core/agent.py +++ b/lib/core/agent.py @@ -677,10 +677,10 @@ class Agent: if " WHERE " in limitedQuery: limitedQuery = "%s AND %s " % (limitedQuery, uniqueField) else: - limitedQuery = "%s WHERE %s " % (limitedQuery, uniqueField) + limitedQuery = "%s WHERE ISNULL(%s,' ') " % (limitedQuery, uniqueField) limitedQuery += "NOT IN (%s" % (limitStr % num) - limitedQuery += "%s %s ORDER BY %s) ORDER BY %s" % (uniqueField, fromFrom, uniqueField, uniqueField) + limitedQuery += "ISNULL(%s,' ') %s ORDER BY %s) ORDER BY %s" % (uniqueField, fromFrom, uniqueField, uniqueField) else: if " WHERE " in limitedQuery: limitedQuery = "%s AND %s " % (limitedQuery, field)