John Porter wrote:

> > >    $a = null;
> > >    $b = ($a == 42);
> > >    print defined($b)? "defined" : "not defined";
> >
> > >would print "not defined", maybe?
>
> defined() is the wrong operator to be using there. Rather,

The tri-state logic deals with "true", "false", and "unknown" (not
NULL).  To quote from Jim Melton's Understanding SQL:

"Remember, that null is a characteristic of an SQL data item.  Unknown,
in contrast, is a characteristic of a predicate.  The differences may
appear to be subtle between the two concepts and the corresponding
syntactical expressions, but they must be used correctly in order to
develop SQL applications."

If we pick up the SQL data value NULL, as suggested by this RFC, we
should pick up its semantics... not from the RFC, not from Melton's
book, but from the (latest) SQL 99 standard.  It would appear from
Melton's book that there needs to be at least two distinguished values
to do so: NULL and UNKNOWN, both of which have different semantics than
undef.  However, I think that although Melton makes this distinction,
and so does the SQL syntax, that the same effect can be achieved by
using the same distinguished value to represent both concepts, because
their usages never overlap.  Having not read the SQL 99 standard
thoroughly regarding this concept, I hesitate to say if that is still
true for SQL 99, which I believe allows multiple flavors of NULL data
values.

> In general, what would these result to:
>
>         defined(null)

true.

>         is_null(undef)

false.

--
Glenn
=====
Even if you're on the right track,
you'll get run over if you just sit there.
                       -- Will Rogers




_______________________________________________
Why pay for something you could get for free?
NetZero provides FREE Internet Access and Email
http://www.netzero.net/download/index.html

Reply via email to