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-Thread: 103376,ccec7cf654f5e8c3 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!uio.no!news.banetele.no!news.hacking.dk!pnx.dk!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Re: creating database Date: 08 May 2005 20:24:56 +0200 Organization: hacking.dk - Doing fun stuff with open source Sender: sparre@hugin.crs4.it Message-ID: References: <1115570998.707181.84650@o13g2000cwo.googlegroups.com> NNTP-Posting-Host: 80.241.165.50 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: xyzzy.adsl.dk 1115577143 17090 80.241.165.50 (8 May 2005 18:32:23 GMT) X-Complaints-To: usenet@news.hacking.dk NNTP-Posting-Date: Sun, 8 May 2005 18:32:23 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Xref: g2news1.google.com comp.lang.ada:10956 Date: 2005-05-08T20:24:56+02:00 List-Id: caellumx@yahoo.com writes: > I was thinking of creating the ADT as a record with various fields, > and then an array with each element containing a record. However, I > don't know how many records there'll be so it seems inefficient to > declare an array of a particular size. Sensible thinking. > Any advice one how to implement the database would be very much > appreciated. As an ada novice, I'm struggling. As you have already been told, this is not really an Ada specific question. Instead of allocating a fixed size array - which on unix systems isn't quite as bad an idea as it sounds - you can allocate and reallocate chunks of varying or fixed size (down to a single record element) with pointers pointing to various other chunks. Exactly how you do it depends on your problem; the frequency of insertions, the frequency of deletions, the frequency of searches and knowledge about the searches which you can use to prearrange the elements for faster searching. If you tell us what your problem is (and preferably also that it isn't a homework problem), it is easier to give you specific advice. And even if it is a homework problem, there's probably somebody who can point you to a good textbook or ask some leading questions. Greetings, Jacob -- "War does not determine who is right - only who is left." -- Bertrand Russell