From 775e424bf2bcaf66ff2a400be913721dafa94f48 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 8 Mar 2012 15:04:52 +0000 Subject: [PATCH] bug fix for using --no-cast and --hex switches together --- lib/core/agent.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/core/agent.py b/lib/core/agent.py index f45b8c500..eec5c356a 100644 --- a/lib/core/agent.py +++ b/lib/core/agent.py @@ -278,25 +278,26 @@ class Agent: @rtype: C{str} """ + rootQuery = queries[Backend.getIdentifiedDbms()] + if field.startswith("(CASE") or field.startswith("(IIF") or conf.noCast: nulledCastedField = field else: - _ = queries[Backend.getIdentifiedDbms()] - nulledCastedField = _.cast.query % field + nulledCastedField = rootQuery.cast.query % field if Backend.isDbms(DBMS.ACCESS): - nulledCastedField = _.isnull.query % (nulledCastedField, nulledCastedField) + nulledCastedField = rootQuery.isnull.query % (nulledCastedField, nulledCastedField) else: - nulledCastedField = _.isnull.query % nulledCastedField + nulledCastedField = rootQuery.isnull.query % nulledCastedField - if conf.hexConvert: - if 'hex' in _: - nulledCastedField = _.hex.query % nulledCastedField - else: - warnMsg = "switch '--hex' is currently not supported on DBMS '%s'. " % Backend.getIdentifiedDbms() - warnMsg += "Going to switch it off" - singleTimeWarnMessage(warnMsg) + if conf.hexConvert: + if 'hex' in rootQuery: + nulledCastedField = rootQuery.hex.query % nulledCastedField + else: + warnMsg = "switch '--hex' is currently not supported on DBMS '%s'. " % Backend.getIdentifiedDbms() + warnMsg += "Going to switch it off" + singleTimeWarnMessage(warnMsg) - conf.hexConvert = False + conf.hexConvert = False return nulledCastedField