[Top][All Lists]
[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 21:58:42 -0500 |
On Wed, Feb 27, 2008 at 8:29 PM, Ozzi <address@hidden> wrote:
> > 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"))
>
> This doesn't bother me.
>
> > 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.
>
> All right, there's the big problem.
>
> How about keeping '() for sql NULL, and using vectors to represent array-type
> columns?
Vectors are currently used in the Postgres egg to represent date-time
values. Not saying it's good, but there it is. (BTW, a dbapi needs
consistent date/time support too...)
In Common Lisp, NIL is the same as '(), and both mean "false". In
Scheme we have an explicit #f. For the same reasons we should have an
explicit #<sql-null>. It is important that (sql-null? (sql-null)) is
#t, and (sql-null? anything-else) is #f.
> Since SQL NULL values are common, I really like the simple null? test. It's
> intuitive.
How is (sql-null?) harder or less intuitive?
> On the other hand, I didn't even know array-type columns existed until
> tonight.
> I'd prefer to go with something slightly less intuitive for representing
> them if
> it will let us use '() for NULL.
...and perhaps we should use '() for #f as well? ;-)
Graham
- Re: [Chicken-users] DBI, (continued)
- Re: argument against using '() for null values? ([Chicken-users] DBI), Graham Fawcett, 2008/02/27
- Re: argument against using '() for null values? ([Chicken-users] DBI), Ozzi, 2008/02/27
- Re: argument against using '() for null values? ([Chicken-users] DBI),
Graham Fawcett <=
- Re: argument against using '() for null values? ([Chicken-users] DBI), Ozzi, 2008/02/27
- Re: argument against using '() for null values? ([Chicken-users] DBI), Graham Fawcett, 2008/02/28
Re: [Chicken-users] DBI, Alex Shinn, 2008/02/28
Re: [Chicken-users] DBI, Alaric Snell-Pym, 2008/02/28