bug fix for using --no-cast and --hex switches together

This commit is contained in:
Miroslav Stampar 2012-03-08 15:04:52 +00:00
parent 11c7cc5224
commit 775e424bf2

View File

@ -278,19 +278,20 @@ 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
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"