$null Behavior

Note that in version 7 and earlier, the variable $null was used as the default for the <SQL> NULL option (as $null predated the NULL option itself). However, this left an important part of the behavior of a <SQL> statement unspecified by the statement itself, and potentially dependent upon a variable assignment (<$null = ...>) forgotten elsewhere - such ambiguity could cause problems.

Thus, in version 8 and later, the $null variable has no effect on <SQL> statements, and is repurposed as a constant with no values, for situations where that is useful (e.g. passing a no-values - as opposed to single-value empty-string - argument to a parameter). Modifications to it are not permitted, and result in the runtime error "$null is a constant and may not be modified".

For legacy code, this behavior change can be reverted by setting compatibilityversion (here) to 7 or less to make the NULL option default to $null (and the latter be modifiable).

Note that as this is a dynamic behavior change and not a syntax change, it is controlled at runtime by compatibilityversion (via <vxcp> or the like), not at compile time by syntaxversion (via pragma or the like). The --translate-from-version option (here) will warn when it detects $null assignments.


Copyright © Thunderstone Software     Last updated: Jul 17 2021
Copyright © 2021 Thunderstone Software LLC. All rights reserved.