chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: argument against using '() for null values? ([Chicken-users] DBI)


From: Graham Fawcett
Subject: Re: argument against using '() for null values? ([Chicken-users] DBI)
Date: Wed, 27 Feb 2008 20:04:07 -0500

On Wed, Feb 27, 2008 at 6:29 PM, Ozzi <address@hidden> wrote:
> > I suggest that a row be an a-list, and that null columns be represented
>  > by being non-existent in the a-list.  If you end up preferring a plain
>  > list or a vector, then use (void) instead -- I am trying to get this
>  > standardized as the Chicken representation of SQL's NULL.
>
>  Is there an argument against using '() instead of (void) SQL NULL values?

Three that I can think of:

1) It would make alist representations ugly:
(query "select foo, NULL as bar, baz from stuff") =>
((foo . 1) (bar) (baz . "a string"))

2) It is not a disjoint type. (list? '()) => #t. That's bad.

3) As a special case of (2), some databases have array-type columns.
An empty list may be a valid column value.

Personally, I'm okay with (void), though Vincent's comment about
displaying results is a good one. I think the only logical alternative
to (void) is a #<sql-null> value, similar in implementation to
#<undefined>: a disjoint type plus a predicate. (Currently that's how
the postgresql egg handles it.)

Graham




reply via email to

[Prev in Thread] Current Thread [Next in Thread]