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

Skip to content

Commit 775e424

Browse files
committed
bug fix for using --no-cast and --hex switches together
1 parent 11c7cc5 commit 775e424

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

lib/core/agent.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -278,25 +278,26 @@ def nullAndCastField(self, field):
278278
@rtype: C{str}
279279
"""
280280

281+
rootQuery = queries[Backend.getIdentifiedDbms()]
282+
281283
if field.startswith("(CASE") or field.startswith("(IIF") or conf.noCast:
282284
nulledCastedField = field
283285
else:
284-
_ = queries[Backend.getIdentifiedDbms()]
285-
nulledCastedField = _.cast.query % field
286+
nulledCastedField = rootQuery.cast.query % field
286287
if Backend.isDbms(DBMS.ACCESS):
287-
nulledCastedField = _.isnull.query % (nulledCastedField, nulledCastedField)
288+
nulledCastedField = rootQuery.isnull.query % (nulledCastedField, nulledCastedField)
288289
else:
289-
nulledCastedField = _.isnull.query % nulledCastedField
290+
nulledCastedField = rootQuery.isnull.query % nulledCastedField
290291

291-
if conf.hexConvert:
292-
if 'hex' in _:
293-
nulledCastedField = _.hex.query % nulledCastedField
294-
else:
295-
warnMsg = "switch '--hex' is currently not supported on DBMS '%s'. " % Backend.getIdentifiedDbms()
296-
warnMsg += "Going to switch it off"
297-
singleTimeWarnMessage(warnMsg)
292+
if conf.hexConvert:
293+
if 'hex' in rootQuery:
294+
nulledCastedField = rootQuery.hex.query % nulledCastedField
295+
else:
296+
warnMsg = "switch '--hex' is currently not supported on DBMS '%s'. " % Backend.getIdentifiedDbms()
297+
warnMsg += "Going to switch it off"
298+
singleTimeWarnMessage(warnMsg)
298299

299-
conf.hexConvert = False
300+
conf.hexConvert = False
300301

301302
return nulledCastedField
302303

0 commit comments

Comments
 (0)