|
From: Donal K. F. <don...@ma...> - 2008-06-17 09:34:18
|
Robert Seeger wrote: > The AOLServer db API uses ns_sets [1] to return it's results. You can > ask for the value for every element in the set, and you'll get empty > strings back for nulls. However, if you're really interested in what is > a null and what isn't, you can use "ns_set isnull" to check if a > specific field is null or not. > > Donal's comment seems to point to this type of behavior, as does option > b from Alexandre's post. I thought it might be useful to show a specific > implementation of it. Yes, that's pretty much exactly what I was thinking. When dealing with the result of an SQL database query, you've got a result set (in effect a row of a view). The values in the row are only part of the information available (there's also the name of each column, the type of the columns, etc.) and so adding the ability to ask whether a column was NULL is no big deal. The information might not be exposed in some of the short-cut interfaces, but they're just syntactic sugar; people who really need to know about nullity should use the more detailed API. (I suppose you could even have a method on the result set to set the string representation of NULL...) Given this, do we need NULL anywhere else in Tcl? (Note that the Maybe stuff works just fine without any magic at all.) If we don't, can we put this whole discussion to bed? Donal. |