Discussion:
confusion wil nulls
(too old to reply)
Glenn Johansen
2008-10-22 18:10:40 UTC
Permalink
1. create a table with a date field.
2. append a blank record
3. replace the date field with an empty date ctod(' / / ')

now test the field for a null value.

? testdate=null

plus returns .t. -------- should this not be false????? the field is not
null, is holds a blank date

- glenn
Robert Bravery
2008-10-22 19:46:06 UTC
Permalink
HI Glenn,

I don't think you can have a blank date. I stand corrected tho. Dates are
stored as a interger value in the table, not as the users sees the end
result. So createing a blan date stores nothing, as a blank date does not
evaluate to a relavant integer.

Robert
Post by Glenn Johansen
1. create a table with a date field.
2. append a blank record
3. replace the date field with an empty date ctod(' / / ')
now test the field for a null value.
? testdate=null
plus returns .t. -------- should this not be false????? the field is not
null, is holds a blank date
- glenn
---
avast! Antivirus: Inbound message clean.
Virus Database (VPS): 081022-1, 22/10/2008
Tested on: 22/10/2008 09:42:38 PM
avast! - copyright (c) 1988-2008 ALWIL Software.
http://www.avast.com
--
Web Development, Hosting, Design and Content Management Systems
http://www.integralwebsolutions.co.za



---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 081022-1, 22/10/2008
Tested on: 22/10/2008 09:46:08 PM
avast! - copyright (c) 1988-2008 ALWIL Software.
http://www.avast.com
Ken Mayer [dBVIPS]
2008-10-22 22:21:45 UTC
Permalink
Post by Glenn Johansen
1. create a table with a date field.
2. append a blank record
3. replace the date field with an empty date ctod(' / / ')
now test the field for a null value.
? testdate=null
plus returns .t. -------- should this not be false????? the field is not
null, is holds a blank date
I think it's correct. I could be wrong of course ...

Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
http://www.goldenstag.net/dbase
Mervyn Bick
2008-10-23 09:26:35 UTC
Permalink
Post by Glenn Johansen
plus returns .t. -------- should this not be false????? the field is
not null, is holds a blank date
What _IS_ an empty date?
I can understand what a NULL date is, because NULL usually means
unknown. But what is an EMPTY date, especially when it comes to the
difference to NULL date?
If you have problems answering this question quick and determined, the
designer of the dBase table rules probably had the same problems.
I have't spent any time looking at what the date class does in memory
before dates get written to disk but a date field in a table either has a
value in it or it is null. There is no third option.

Mervyn.
Bruce Beacham
2008-10-24 07:55:49 UTC
Permalink
Post by Mervyn Bick
There is no third option.
TINTO. I like that!


Bruce Beacham
Lysander
2008-10-23 08:47:46 UTC
Permalink
Post by Glenn Johansen
plus returns .t. -------- should this not be false????? the field is not
null, is holds a blank date
What _IS_ an empty date?
I can understand what a NULL date is, because NULL usually means
unknown. But what is an EMPTY date, especially when it comes to the
difference to NULL date?

If you have problems answering this question quick and determined, the
designer of the dBase table rules probably had the same problems.

ciao,
André
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are 10 types of programmers:
those who understand binary arithmetics and those who don't.
unknown
2008-10-24 10:13:25 UTC
Permalink
On Thu, 23 Oct 2008 10:47:46 +0200 Lysander
Sender: Lysander <***@nowhere.de>
wrote the following in:
Newsgroup: dbase.programming
Post by Glenn Johansen
plus returns .t. -------- should this not be false????? the field is not
null, is holds a blank date
What _IS_ an empty date?
I can understand what a NULL date is, because NULL usually means
unknown. But what is an EMPTY date, especially when it comes to the
difference to NULL date?
If you have problems answering this question quick and determined, the
designer of the dBase table rules probably had the same problems.
According to the OLh on "Date amnd time":
An empty date is valid and is represented by empty braces: { }. ( Whatever empty braces are )

According to the OLH on EMPTY():
Use EMPTY( ) to determine if an expression is empty. The definition of empty depends on the type of
the expression:
Expression type: Date Empty if value is: blank date ({ / / })

Conclusion. A blank date is the same as an empty date. When tested with Empty() which does not make
a difference between empty and null the date value may be said to be null.

When using local sql, a blank date may be found with the statement,

select * where <myDateField> is null.


It looks like the designer of the dBase table rules did not have a problem in answering you
question!


Ivar B. Jessen
Lysander
2008-10-24 10:45:09 UTC
Permalink
Post by unknown
It looks like the designer of the dBase table rules did not have a problem in answering you
question!
Exactly. Taking for granted that NULL always is the same as EMPTY. If
you want to determine between NULL and EMPTY, the concept will not work
from a logical point of view.

What could probably be the difference between an empty date and an
unknown date?
Robert Bravery
2008-10-24 14:30:55 UTC
Permalink
Yeah, exactly my point. Something, date or other data type can be empty
(filled with spaces or some other non printable character) but yet not null.
But null could evalueate to empty.

Robert
Post by unknown
It looks like the designer of the dBase table rules did not have a
problem in answering you
question!
Exactly. Taking for granted that NULL always is the same as EMPTY. If you
want to determine between NULL and EMPTY, the concept will not work from a
logical point of view.
What could probably be the difference between an empty date and an unknown
date?
---
avast! Antivirus: Inbound message clean.
Virus Database (VPS): 081024-0, 24/10/2008
Tested on: 24/10/2008 04:29:19 PM
avast! - copyright (c) 1988-2008 ALWIL Software.
http://www.avast.com
--
Web Development, Hosting, Design and Content Management Systems
http://www.integralwebsolutions.co.za



---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 081024-0, 24/10/2008
Tested on: 24/10/2008 04:30:57 PM
avast! - copyright (c) 1988-2008 ALWIL Software.
http://www.avast.com
Loading...