minor update regarding --hex

This commit is contained in:
Miroslav Stampar
2012-02-21 13:38:18 +00:00
parent bcf3255fe1
commit 686eacda9a
3 changed files with 14 additions and 14 deletions

View File

@@ -279,12 +279,7 @@ class Agent:
@rtype: C{str}
"""
# SQLite version 2 does not support neither CAST() nor IFNULL(),
# introduced only in SQLite version 3
if Backend.isDbms(DBMS.SQLITE) or conf.noCast:
return field
if field.startswith("(CASE") or field.startswith("(IIF"):
if field.startswith("(CASE") or field.startswith("(IIF") or conf.noCast:
nulledCastedField = field
else:
_ = queries[Backend.getIdentifiedDbms()]

View File

@@ -3117,13 +3117,14 @@ def decodeHexValue(value):
"""
def _(value):
if isinstance(value, basestring) and len(value) % 2 == 0:
if Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.ORACLE, DBMS.PGSQL):
value = value.decode("hex")
elif Backend.isDbms(DBMS.MSSQL):
value = value[2:].decode("hex")
if value[1] == '\x00':
value = value.decode("utf16")
if value and isinstance(value, basestring) and len(value) % 2 == 0:
if value.lower().startswith("0x"):
value = value[2:]
value = value.decode("hex")
if len(value) > 1 and value[1] == '\x00':
value = value.decode("utf-16-le")
elif value and value[0] == '\x00':
value = value.decode("utf-16-be")
return value
return applyFunctionRecursively(value, _)