Re: Nulls get converted to 0 problem
От | Jon Earle |
---|---|
Тема | Re: Nulls get converted to 0 problem |
Дата | |
Msg-id | Pine.LNX.4.55.0306061118420.19934@kronos.honk.org обсуждение исходный текст |
Ответ на | Re: Nulls get converted to 0 problem (<terry@ashtonwoodshomes.com>) |
Ответы |
Re: Nulls get converted to 0 problem
|
Список | pgsql-general |
On Fri, 6 Jun 2003, Mattias Kregert wrote: > 1. Imagine a table with dates and weather conditions. How would you > differ between "zero degrees" and "no data entered yet"? You would > have to add a column (degrees_valid boolean). Having the NULL value > makes things much easier. > > 2. In OO languages (c++, java, and so on), a null pointer is very > different from a pointer to an object - even if that object contains > the value 0 (zero) or an empty string (""). The "practices" you refer > to does not apply/is not inherent in all languages. NULL means that > the variable points to nothing at all. "" means that there is some > address/space allocated. > Example: > String mystring = NULL; // pointer mystring points to nothing (no > allocation) > String mystring = new String(""); // pointer mystring points to a > memory location, which currently holds the empty data "". <click!> Thank you Mattias, the differences (and similarities) are now clear. Cheers! Jon -- Jon Earle SAVE FARSCAPE http://www.savefarscape.com/
В списке pgsql-general по дате отправления: