8484from lib .core .settings import DBMS_DICT
8585from lib .core .settings import DESCRIPTION
8686from lib .core .settings import DUMMY_SQL_INJECTION_CHARS
87+ from lib .core .settings import NULL
8788from lib .core .settings import IS_WIN
8889from lib .core .settings import PLATFORM
8990from lib .core .settings import PYVERSION
@@ -1088,9 +1089,9 @@ def parsePasswordHash(password):
10881089 blank = " " * 8
10891090
10901091 if not password or password == " " :
1091- password = " NULL"
1092+ password = NULL
10921093
1093- if Backend .isDbms (DBMS .MSSQL ) and password != " NULL" and isHexEncodedString (password ):
1094+ if Backend .isDbms (DBMS .MSSQL ) and password != NULL and isHexEncodedString (password ):
10941095 hexPassword = password
10951096 password = "%s\n " % hexPassword
10961097 password += "%sheader: %s\n " % (blank , hexPassword [:6 ])
@@ -2047,7 +2048,7 @@ def getPartRun():
20472048 # Return the INI tag to consider for common outputs (e.g. 'Databases')
20482049 return commonPartsDict [retVal ][1 ] if isinstance (commonPartsDict .get (retVal ), tuple ) else retVal
20492050
2050- def getUnicode (value , encoding = None , system = False ):
2051+ def getUnicode (value , encoding = None , system = False , noneToNull = False ):
20512052 """
20522053 Return the unicode representation of the supplied value:
20532054
@@ -2059,6 +2060,13 @@ def getUnicode(value, encoding=None, system=False):
20592060 u'1'
20602061 """
20612062
2063+ if noneToNull and value is None :
2064+ return NULL
2065+
2066+ if isinstance (value , (list , tuple )):
2067+ value = list (getUnicode (_ , encoding , system , noneToNull ) for _ in value )
2068+ return value
2069+
20622070 if not system :
20632071 if isinstance (value , unicode ):
20642072 return value
@@ -2917,7 +2925,7 @@ def isNullValue(value):
29172925 Returns whether the value contains explicit 'NULL' value
29182926 """
29192927
2920- return isinstance (value , basestring ) and value .upper () == " NULL"
2928+ return isinstance (value , basestring ) and value .upper () == NULL
29212929
29222930def expandMnemonics (mnemonics , parser , args ):
29232931 """
0 commit comments