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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,28a24746aa07c732 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.germany.com!news.teledata-fn.de!noris.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Design help Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Tue, 13 Mar 2007 10:40:33 +0100 Message-ID: <1v79s2t3fjrxu.14pyinp46ngmp.dlg@40tude.net> NNTP-Posting-Date: 13 Mar 2007 10:40:33 CET NNTP-Posting-Host: 5ca98024.newsspool3.arcor-online.net X-Trace: DXC=:3]W\45hRQI78PK[oJ2ng@McF=Q^Z^V3H4Fo<]lROoRAFl8W>\BH3YBYd@RkgBEXD`c:G@K3@ X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:14507 Date: 2007-03-13T10:40:33+01:00 List-Id: On Mon, 12 Mar 2007 19:50:11 -0500, Carroll, Andrew wrote: > I hope to have the database records be variable length however it may > make my life easier if they are fixed length due to the fact that some > of the record structures contain pointers. I guess that would be access > type instead of pointer, anyway... > Here are the record structures I have defined: > > type attribute is tagged > record [...] Because attribute is not limited the compiler would generate assignment as a shallow copy. That might get quite dangerous with pointers. Either it has to be limited or strings need to be by-value (or by-reference counted smart pointers). > Obviously a database tuple could have any combination of these in it but > luckily I only have to worry about 5 attributes in a database table > schema. Why don't you compose tuple types from attributes? type Row is record Name : StringAttribute; Birth : DateAttribute; ... end record; Row could be read from stream. However there is a problem of cross-platform portability. The blob you read/write using stream attributes would be platform-dependent. If that's the problem you'd need to override stream attributes or else derive all types from some base type with Serialize/Construct abstract methods (loosing automatic aggregation of rows as above). (I used the latter approach in my persistence layer, that was in Ada 95 times. With Ada 2005 limited types, a platform-independent stream solution could turn possible. It would be interesting to investigate when a stable 2005 compiler appear.) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de