From 686eacda9ab1d22312b3fa9e245d7bf5f1e5431a Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 21 Feb 2012 13:38:18 +0000 Subject: [PATCH] minor update regarding --hex --- lib/core/agent.py | 7 +------ lib/core/common.py | 15 ++++++++------- xml/queries.xml | 6 +++++- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/core/agent.py b/lib/core/agent.py index 98f069110..eb1f1b1e5 100644 --- a/lib/core/agent.py +++ b/lib/core/agent.py @@ -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()] diff --git a/lib/core/common.py b/lib/core/common.py index 028796553..aea439e21 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -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, _) diff --git a/xml/queries.xml b/xml/queries.xml index 0910c03b8..79d0d486f 100644 --- a/xml/queries.xml +++ b/xml/queries.xml @@ -303,7 +303,7 @@ - + @@ -316,6 +316,7 @@ + @@ -456,6 +457,7 @@ + @@ -502,6 +504,7 @@ + @@ -569,6 +572,7 @@ +