common-lisp - 如何在 cl-dbi 中插入 NULL 值
问题描述
我有下表允许 NULL 值
CREATE TABLE test (
test int,
test2 int);
常规查询允许插入 NULL 值:
INSERT INTO TABLE test (test, test2) VALUES (NULL, NULL)
但是,使用 cl-dbi 它不起作用
(cl-dbi:execute
(cl-dbi:prepare connection
"INSERT INTO test (test, test2)
VALUES (?,?)")
nil
nil)
结果是
DB Error: invalid input syntax for type timestamp: "false" (Code: 22007)
解决方案
您必须使用此处:null
指示的值。
(cl-dbi:execute
(cl-dbi:prepare connection
"INSERT INTO test (test, test2)
VALUES (?,?)")
:null
:null)