Dr.Slump wrote:

working on some user-defined variable types for a media database project
i'm working on (slowly, oh so slowly). i've defined types for artist and
album and track (individual). naturally, there's going to be multiple
tracks per album, so i'm assuming that an array would be best to store
the track information. so far i have the following to "declare" the
record things

   TArtist = record
       arName: ansistring;
       arID: longint;
   end;

   TAlbum = record
       alName: ansistring;
       alID: longint;
       alLabel: ansistring;
       alNumTracks: longint;
       alYear: longint;
       alFormat: ansistring;
   end;

   TTrack = record
       trNum: longint;
       trName: ansistring;
       trID: longint;
   end;




Hi,


You can declare the traces statically on an album:
alTracks: array[1..20] of TTrack;
but this way you might get short of available tracks for certain albums and
in most cases you'll be wasting memory with unused tracks.

Another option is to dynamically allocate the tracks array:
alTracks: pTrack;
pTrack = ^TTrack;

However, I'd do it in a different way, using a TList descendant (classes
unit) to keep all the tracks known to the db. Then you set an album and
artist id on each track, the albums and artists could be a TList too.

Hope it makes sense, I haven't programmed in a long time so all this could
sound a bit old :)

Ciao, Ivan


_______________________________________________ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal



i had forgot to set the size of the array, which was causing the problem ... some ppl on #fpc pointed that out to me ... :)

hehe, thanks everyone for the assistance once again

_______________________________________________
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to