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 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 12:53:44 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!opentransit.net!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nf3.bellglobal.com!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail From: "Warren W. Gay VE3WWG" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) 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> <3F900527.3080103@comcast.net> In-Reply-To: <3F900527.3080103@comcast.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Fri, 17 Oct 2003 15:38:56 -0400 NNTP-Posting-Host: 198.96.223.163 X-Complaints-To: abuse@sympatico.ca X-Trace: news20.bellglobal.com 1066419510 198.96.223.163 (Fri, 17 Oct 2003 15:38:30 EDT) NNTP-Posting-Date: Fri, 17 Oct 2003 15:38:30 EDT Organization: Bell Sympatico Xref: archiver1.google.com comp.lang.ada:1095 Date: 2003-10-17T15:38:56-04:00 List-Id: Robert I. Eachus wrote: > 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. But you don't need an array to do this. ... >> 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 Major yuk.. bending all the rules to push an implementation. > 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). And now, how do you code this in SQL, when you want to to do an ad-hoc query for those cases? Man that is ugly! > I figure using the type cuts my effort in writing programs OK, it is the "write the program efficiently" argument. You're in league with Perl! ;-) > 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, The lowest price is not always the law ;-) > but right now coding and debugging the queries is a > small part of the effort. Right, so why not stick to more ideal abstractions, then looking for ways to bend the rules? > 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.) Well, the null handling definitely is lacking. No type strength, and all numerics must be marshalled into and out of strings, with of course, no type checking either. Ad-hoc queries must adopt the strangest of null conventions; certainly non-standard ones! Sorry, but I cannot agree that this is good or "better". But then, its your code, and you're free to express yourself in that code, as you please... just as the Perl programmers are ;-) -- Warren W. Gay VE3WWG http://home.cogeco.ca/~ve3wwg