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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5062c61046d35039,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!feeder.news-service.com!proxad.net!cleanfeed1-b.proxad.net!nnrp9-2.free.fr!not-for-mail Return-Path: X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Design help Date: Mon, 26 Mar 2007 09:56:03 -0500 X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Design help Thread-Index: Acdvtt/+zIuYVCv3TS+iD7sFhgwvwQ== From: "Carroll, Andrew" To: X-Virus-Scanned: amavisd-new at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.9rc1 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.ada Message-ID: X-Leafnode-NNTP-Posting-Host: 88.191.17.134 Organization: Guest of ProXad - France NNTP-Posting-Date: 26 Mar 2007 17:00:02 MEST NNTP-Posting-Host: 88.191.14.223 X-Trace: 1174921202 news-2.free.fr 12363 88.191.14.223:38420 X-Complaints-To: abuse@proxad.net Xref: g2news1.google.com comp.lang.ada:14644 Date: 2007-03-26T17:00:02+02:00 Alright, here is my status. I decided to use the fixed record length and I have the program limping successfully. I kept getting segmentation faults in GNAT and I tracked it down to missing "all" operator on pointers. I'll come back to the segmentation fault issue in a moment. I have some further questions about the record structures I used and their size with respect to calculating a positive_count within a file to use the stream_io set_index procedure. =20 The base types are (not in this order): type schema (number_of_attributes : Integer) is tagged record tablename : String (1 .. max_tablename_length) :=3D (1 .. max_tablename_length =3D> ' '); attributes : attribute_array (1 .. number_of_attributes); record_length : Integer :=3D 0; byte_start : Integer :=3D 0; byte_end : Integer :=3D 0; end record; type attribute is tagged record name : String (1 .. max_attributename_length) :=3D (1 .. max_attributename_length =3D> ' '); domain : String (1 .. max_typename_length) :=3D (1 .. max_typename_length =3D> ' '); isprimarykey : Boolean :=3D False; byte_start : Integer :=3D 0; byte_end : Integer :=3D 0; end record; Extended types are: type booleanattribute is new attribute with record value : Boolean :=3D False; end record; type integerattribute is new attribute with record value : Integer :=3D 0; end record; type stringattribute is new attribute with record value : String (1 .. max_stringlength) :=3D (1 .. = max_stringlength =3D> ' '); end record; type dateattribute is new attribute with record year : Year_Number :=3D 1901; month : Month_Number :=3D 1; day : Day_Number :=3D 1; value : Time :=3D Time_Of (1901, 1, 1); end record; My database file looks something like: -------------------------------- <><> <><>...<> <><>...<> . Each of these rows are tuples . . <><>...<> -------------------------------- Where attribute(1) - attribute(n) are the streamed values of the attributes. The schema.attributes'output is only for descriptive/comparative purposes so that when I open the file I can load the schema information as a guide and a reference as to the format, count, properties of each tuple that follows it in the file. Tuples are not ended with an end_of_line character in my database file. When inserting tuples I calculate the byte_start and byte_end values for each attribute. When doing this I found that I must adjust them as follows: if Trim (schemainfo.attributes (x).domain, Ada.Strings.Both) =3D "BOOLEAN" then values (x).byte_end :=3D values (x).byte_start + (booleanattribute'size / 8) - 1; booleanattribute'output (Stream (fout), booleanattribute (values (x).all)); elsif Trim (schemainfo.attributes (x).domain, Ada.Strings.Both) =3D "STRING" then values (x).byte_end :=3D values (x).byte_start + (stringattribute'size / 8) - 8; stringattribute'output (Stream (fout), stringattribute (values (x).all)); elsif Trim (schemainfo.attributes (x).domain, Ada.Strings.Both) =3D "INTEGER" then values (x).byte_end :=3D values (x).byte_start + (integerattribute'size / 8) - 7; integerattribute'output (Stream (fout), integerattribute (values (x).all)); else -- "DATE" values (x).byte_end :=3D values (x).byte_start + (dateattribute'size / 8) - 11; dateattribute'output (Stream (fout), dateattribute (values (x).all)); end if; I had to debug the program to get the -1, -8, -7, and -11 values. The adjustments were made so that the byte_start and byte_end values match the values returned by the stream_io.index function before and after calling 'output on each attribute. I'm sure that I don't need to go into detail as to why the positive_index value is imporant to record on a database file so I won't spend time explaining that. I don't understand why I needed the -1, -8, -7, and -11 adjustments. I know it relates to the size of the object but why isn't it on a byte boundary? Thanks for any information you can provide. Andrew Carroll Software Services 405-744-4943 andrew.carroll@okstate.edu