Improve null handling

This commit is contained in:
Christopher Baines 2024-12-01 19:48:44 +00:00
parent bb84e45c42
commit b128e9bd7a
4 changed files with 17 additions and 14 deletions

View file

@ -41,6 +41,8 @@
with-advisory-session-lock/log-time
obtain-advisory-transaction-lock
NULL
NULL?
exec-query-with-null-handling))
;; TODO This isn't exported for some reason
@ -279,6 +281,10 @@
"SELECT pg_advisory_xact_lock($1)"
(list lock-number))))
(define NULL (make-symbol "null"))
(define NULL? (lambda (s) (eq? s NULL)))
(define squee/libpq
(@@ (squee) libpq))
@ -304,7 +310,7 @@
((string-null? val)
(if (eq? 1 (%PQgetisnull
(squee/unwrap-result-ptr result-ptr) row-i col-i))
'()
NULL
val))
(else val))))
cols-range))