Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 22x 22x 22x 22x 22x | import fallback from './fallback.js' import id from './identifier.js' import template from './template.js' import type S from './sanitised.js' /** * @returns emulated NULL aware comparision. * * MSSQL doesn't support IS DISTINCT FROM comparision directly. * * Single invocation of RHS is not guaranteed. */ export const distinct = (lhs: S | string, rhs: unknown): undefined | S => { Iif (typeof lhs === 'undefined' || typeof rhs === 'undefined') { return undefined } const lhs_ = fallback(lhs, id) return template`((${lhs_} <> ${rhs} or ${lhs_} is null or ${rhs} is null) and not (${lhs_} is null and ${rhs} is null))` } export default distinct |