Outdated egg!

This is an egg for CHICKEN 3, the unsupported old release. You're almost certainly looking for the CHICKEN 4 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

sql-null

Description

An extension for providing a portable SQL NULL object.

Author

Ivan Shmakov

Documentation

The sql-null extension implements the following interface.

[procedure] (sql-null)

Return an object, corresponding to a SQL NULL value. The object is guaranteed to be of a type disjoint from all of the R5RS' standard types. It's unspecified whether the values returned by this function will be eq? to each other:

(eq? (sql-null) (sql-null)) => ; unspecified.
[procedure] (sql-null? OBJECT)

Return #t if OBJECT is a SQL NULL object. Return #f otherwise.

[syntax] (sql-not OBJECT)

Return OBJECT if OBJECT is a SQL NULL object. Return the value of (not OBJECT) otherwise.

(sql-not (sql-null)) => SQL-NULL
(sql-not 'a) => #f
(sql-not #f) => #t

(let ((null (sql-null)))
  (eq? null (sql-not null))) => #t
[syntax] (sql-and TEST-1 ...)

The TEST expressions are evaluated from left to right, and the value of the first expression that evaluates to a false value is returned, and any remaining TESTs are not evaluated. If there were no expressions to evaluate to a false value, the value of any of the expressions to evaluate to a SQL NULL is returned. If there were no such expressions as well, #t is returned.

(sql-and 1) => 1
(sql-and 1 (sql-null) 2) => SQL-NULL
(sql-and #f (sql-null)) => #f

In the absence of the expressions that evaluate to SQL NULL values, the semantics is the same as for (and test-1 ...). One could think of the SQL NULL as "sticky"; as soon as it is encountered, it will be the result of the entire expression (unless #f is also encountered).

[syntax] (sql-or test-1 ...)

The TEST expressions are evaluated from left to right, and the value of the first expression that evaluates to a value, other than SQL NULL and a false value (a ``SQL true'' value), is returned, and any remaining TESTs are not evaluated. If there were no expressions to evaluate to a SQL true value, the value of any of the expressions to evaluate to a SQL NULL is returned. If there were no such expressions as well, #f is returned. In the absence of the expressions that evaluate to SQL NULL values, the semantics is the same as for (or test-1 ...).

(sql-or 1) => 1
(sql-or #t (sql-null) 2) => #t
(sql-or #f (sql-null) 1) => SQL-NULL

License

Public Domain