From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1116ece181be1aea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-17 08:06:51 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.mathworks.com!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!rwcrnsc54.POSTED!not-for-mail Message-ID: <3F900527.3080103@comcast.net> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: A nongeneric bounded string array type (in database code) References: <3F7AC5B0.9080108@noplace.com> <3F7B7641.9030908@noplace.com> <3F7C8482.20102@comcast.net> <3F7D69EA.5030707@noplace.com> <3F7E2740.1050703@comcast.net> <3F7EBD85.8080205@noplace.com> <3F819C99.6080904@cogeco.ca> <3F844FE9.7030500@comcast.net> <3F86EEE3.4030600@comcast.net> <3F8EAF65.2030305@comcast.net> <3F8F2D7B.6060307@comcast.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.34.139.183 X-Complaints-To: abuse@comcast.net X-Trace: rwcrnsc54 1066403128 24.34.139.183 (Fri, 17 Oct 2003 15:05:28 GMT) NNTP-Posting-Date: Fri, 17 Oct 2003 15:05:28 GMT Organization: Comcast Online Date: Fri, 17 Oct 2003 15:05:28 GMT Xref: archiver1.google.com comp.lang.ada:1083 Date: 2003-10-17T15:05:28+00:00 List-Id: 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