Fixing MsSQL FOR JSON handling of NULL values

This commit is contained in:
Miroslav Štampar
2026-07-28 11:57:14 +02:00
parent 0ab84074f7
commit 18e06c6381
3 changed files with 73 additions and 2 deletions
+2 -1
View File
@@ -125,7 +125,8 @@ def _oneShotUnionUse(expression, unpack=True, limited=False):
if fields:
parts = []
for row in json_data:
parts.append("%s%s%s" % (kb.chars.start, kb.chars.delimiter.join(getUnicode(row.get(field) or NULL) for field in fields), kb.chars.stop))
# is-None (not falsy) check: a real 0 / '' / False are values, only JSON null is NULL
parts.append("%s%s%s" % (kb.chars.start, kb.chars.delimiter.join(NULL if row.get(field) is None else getUnicode(row.get(field)) for field in fields), kb.chars.stop))
retVal = "".join(parts)
except:
retVal = None