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-04 05:31:17 PST Path: archiver1.google.com!news2.google.com!newsfeed.stanford.edu!cyclone.bc.net!sjc70.webusenet.com!news.webusenet.com!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread1.news.atl.earthlink.net.POSTED!not-for-mail Message-ID: <3F7EBD85.8080205@noplace.com> From: Marin David Condic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 (OEM-HPQ-PRS1C03) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Is the Writing on the Wall for Ada? References: <3F7AC5B0.9080108@noplace.com> <3F7B7641.9030908@noplace.com> <3F7C8482.20102@comcast.net> <3F7D69EA.5030707@noplace.com> <3F7E2740.1050703@comcast.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 04 Oct 2003 12:31:16 GMT NNTP-Posting-Host: 165.247.65.101 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.atl.earthlink.net 1065270676 165.247.65.101 (Sat, 04 Oct 2003 05:31:16 PDT) NNTP-Posting-Date: Sat, 04 Oct 2003 05:31:16 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:215 Date: 2003-10-04T12:31:16+00:00 List-Id: Right. O.K. Fine. How many databases out there support Ada's Bounded_String? I don't do much database programming anymore but back when I did, I didn't notice much support for Ada - beyond maybe a vendor gave you an Ada pre-processor so you could put SQL into your code. The data types *maybe* aligned with the more primitive Ada types, but typically, if the database had some variety of string/text data, you had to provide a buffer of type String. Maybe its different now - does MySQL provide something compatible with Bounded_String? So I'm back to where I started: The database has a field that is an array of 80 characters. I declare something like Person_Address: String (1..80) ; I read it in. I scan it to determine where it stops and keep a Person_Address_Last count lying around somewhere. I can now use that with Text_IO to display to a file or use the 'Image on some numeric value to add some info to it, or use all the usual attributes of 'First, 'Last 'Range, etc. It was automatically limited by the language to no more than 80 characters. It couldn't have buffer-overflowed and provided a security leak. I've got Ada.Strings.Fixed to do a variety of parsing things for me that are basically the same as those in Ada.Strings.Bounded. How is it I get more value out of Bounded_String? Granted, I've got to do a bit more work by keeping some kind of Last counter around and Bounded_String would have done that for me - once I went to some effort to figure out where the actual string stopped when I read it into my String (1..80). But for that little bit of extra work, I've got visibility to the field as a String - compatible with all the other language features. Bounded_String means extra with's, instantiation, conversions, etc. What do I get in exchange that isn't already there for type String? MDC Robert I. Eachus wrote: > > I totally agree! ;-) But if you use a database interface that uses > Bounded_Strings for such datatypes then youy wrap it all up in one > package and instantiate that to get everything. The advantaga, again is > when you have queries that return an array of whatever. An array of > some instance of Bounded_String is much easier to work with than an > array of records, containing both name length and a String. > -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jsf.mil/NSFrames.htm Send Replies To: m c o n d i c @ a c m . o r g "All reformers, however strict their social conscience, live in houses just as big as they can pay for." --Logan Pearsall Smith ======================================================================