Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== Outdated egg! This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for [[/eggref/5/sql-null|the CHICKEN 5 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 [[https://wiki.call-cc.org/chicken-projects/egg-index-5.html|egg index]]. Otherwise, please consider porting this egg to the current version of CHICKEN. [[tags: egg]] == 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)</procedure> 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: <enscript highlight=scheme> (eq? (sql-null) (sql-null)) => ; unspecified. </enscript> <procedure>(sql-null? OBJECT)</procedure> Return #t if OBJECT is a SQL NULL object. Return #f otherwise. <macro>(sql-not OBJECT)</macro> Return {{OBJECT}} if {{OBJECT}} is a SQL NULL object. Return the value of {{(not OBJECT)}} otherwise. <enscript highlight=scheme> (sql-not (sql-null)) => SQL-NULL (sql-not 'a) => #f (sql-not #f) => #t (let ((null (sql-null))) (eq? null (sql-not null))) => #t </enscript> <macro>(sql-and TEST-1 ...)</macro> 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 {{TEST}}s 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. <enscript highlight=scheme> (sql-and 1) => 1 (sql-and 1 (sql-null) 2) => SQL-NULL (sql-and #f (sql-null)) => #f </enscript> 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). <macro>(sql-or test-1 ...)</macro> 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. <enscript highlight=scheme> (sql-or 1) => 1 (sql-or #t (sql-null) 2) => #t (sql-or #f (sql-null)) => SQL-NULL (sql-or #f (sql-null) 1) => 1 </enscript> In the absence of the expressions that evaluate to SQL NULL values, the semantics is the same as for {{(or test-1 ...)}}. <macro>(sql-coalesce test-1 ...)</macro> The TEST expressions are evaluated from left to right, and the value of the first expression that is not SQL NULL is returned, and any remaining TESTs are not evaluated. If no such value is found, SQL NULL is returned, similar to the SQL `{{COALESCE}}' function. <enscript highlight=scheme> (sql-coalesce 1) => 1 (sql-coalesce (sql-null)) => SQL NULL (sql-coalesce (sql-null) 2) => 2 (sql-coalesce #f (sql-null) 1) => #f </enscript> This is like Scheme's {{or}} macro, instead of treating {{#f}} as the only false value, it treats SQL NULL as false and everything else as true. === License Public Domain
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you multiply 0 by 7?