[futurebasic] [FB^3] Database

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 2001 : Group Archive : Group : All Groups

From: Ian Mann <i.mann@...>
Date: Fri, 28 Sep 2001 07:37:49 +0000
       >Hello everyone,
       >
       >       I am new to this list ( but not that much to fb ), and I
am
       >sure questions of this type have been answered hundreds of
       >times before,(I apologize for this) but anyway, here it is :
       >
       >I would like to create a database of 500 to 1000 entries each
       >consisting of a few strings, and, if possible, a
       >variable-sized text.
       >What would be the best way to do that ?(in what format should
       >I store the database and what would be the fastest way to use
       >it in a programm?)
       >
       >Thanks in advance,
       >
       >Pierre SIMON

Another Way of dealing with the text might be ..

Begin Record FB3DB
dim FirstString as str255
dim SecondString as str255
dim TextStart as Long
dim TextLength as short
end record

dynamic MyDB (_maxLong) as FB3DB

Then you can use Get Field to get a ztxt handle to the entered text,
(see pg 229 ref man), and write field to append it to a separate text
file. (You could set a point in your one file and write after that)

Periodically (perhaps when LOF > 2* sum(TextLength)) you can copy the
text into a new file, delete the old file and rename the new file as the
old file. If you are using one file you could use this time to reset the
point at which the text is written so that the file does not have to
start out humongous.

There are lots of sort routines in the examples. My approach is to pick
the fastest on I can understand - my brain is not big enough for some of
them.

you might also want two further arrays

dynamic Sort (_MaxLong) as unsigned short (assuming you are going to
have less than 65536 records in your database)
dynamic Find (_MaxLong) as unsigned short

Sort holds the sort order of the file ie if  2 recs  rec 1 beatrice rec
2 albert - alpha sort Sort(1) = 2 Sort(2) = 1
Find holds a list of the records found by the recent search operations.

RecNum = Sort(Find(element)) where element is the item selected from a
sorted searched list.

Hope this helps.

thanks for the opportunity to contribute after all the sponging I have
done recently.

Regards

Ian

Let me know if you want functions