Re: A nongeneric bounded string array type (in database code)
From: Robert I. Eachus (rieachus_at_comcast.net)
Date: 10/17/03
- Next message: Hyman Rosen: "Re: += in ada"
- Previous message: Adrian Hoe: "Re: Ada Compiler"
- In reply to: Warren W. Gay VE3WWG: "Re: A nongeneric bounded string array type (in database code)"
- Next in thread: Warren W. Gay VE3WWG: "Re: A nongeneric bounded string array type (in database code)"
- Reply: Warren W. Gay VE3WWG: "Re: A nongeneric bounded string array type (in database code)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 17 Oct 2003 15:05:28 GMT
Warren W. Gay VE3WWG wrote:
> I mean, is the program going to say "select the oldest person,
> because the younger person is less likely to need drugs?"
> I doubt it ;-) Even if you have such a process, then you
> would use a ORDER BY clause, and accept the first row.
The (personal) phone book example is a good one to explain this. If I
really want to display all matches as long as all is less than say 20,
the code for doing so is much simpler. I ask for the first 20 matches,
and if I get less than 20 I display them and I am done. If I get twenty
matches returned now I get the total count and do all the paging cruft.
It keeps the normal case fast, simple and easy for the user to use,
while allowing for extreme cases.
> I am not confused at all. What you have just admitted is that
> you equate an empty string to a NULL column value, which is
> not quite the same thing!
>
> Why are they different?
>
> Well, for some applications an empty string "" says, that
> I have explicitly stated that I have defined its contents
> as empty (ie. there is "no comment" for example, when the
> column might represent a description/comment).
>
> NULL OTOH, indicates that the value is not defined ("a
> comment is not yet defined", for example), or that there
> is no value for it ("no comment is possible/applicable",
> for example).
>
> Your package doesn't allow the programmer to make that
> distinction, which, for me is a show stopper.
Actually, I have a trick I use for that. There are four values in the
Ada definition of Latin-1 that are not only control characters, but have
no defined meaning in ISO 6429. (Reserved_128, Reserved_129,
Reserved_132, and Reserved_153.) I often use these in database text
fields as markers for special types of data. For example, I'll use a
null middle name string to indicate a value not supplied, but
Reserved_128 as "NMN" (No middle name), and Reserved_129 followed by a
letter as "MIO" (Middle initial only).
> But you have not sold the idea why an array for the first
> example is any better. All you have demonstrated is that
> "it works".
I figure using the type cuts my effort in writing programs that access a
database and display the results as HTML by about 25%. I'll be the
first to say that it is possible that I could use some other method and
do it even faster, but right now coding and debugging the queries is a
small part of the effort. In fact the big improvement from using the
new type is that the code is all independent of field sizes, including
the Ada declarations. (Of course I still have to set some sizes in the
data dictionary.)
--
Robert I. Eachus
"Quality is the Buddha. Quality is scientific reality. Quality is the
goal of Art. It remains to work these concepts into a practical,
down-to-earth context, and for this there is nothing more practical or
down-to-earth than what I have been talking about all along...the repair
of an old motorcycle." -- from Zen and the Art of Motorcycle
Maintenance by Robert Pirsig
- Next message: Hyman Rosen: "Re: += in ada"
- Previous message: Adrian Hoe: "Re: Ada Compiler"
- In reply to: Warren W. Gay VE3WWG: "Re: A nongeneric bounded string array type (in database code)"
- Next in thread: Warren W. Gay VE3WWG: "Re: A nongeneric bounded string array type (in database code)"
- Reply: Warren W. Gay VE3WWG: "Re: A nongeneric bounded string array type (in database code)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|