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: Ozzi
Subject: Re: argument against using '() for null values? ([Chicken-users] DBI)
Date: Wed, 27 Feb 2008 19:29:18 -0600
User-agent: Thunderbird 2.0.0.9 (Macintosh/20071031)

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?

Since SQL NULL values are common, I really like the simple null? test. It's 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.

Thoughts?

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]