Guillaume Saumure wrote:

I have to create a small program to track changes done on multiple
machines. The data structure look like :

Structure Notice
     PrimaryKeyID.l
     Type.l
     Date.l
     ExecutedBy.s
     RequestedBy.s
     Description.s
EndStructure

Structure Machine
     PrimaryKeyID.l
     Name.s
     Location.s
     List Notices.Notice()
EndStructure

To make a long story short, I have a Linked list nested inside Linked
list but I really don't know how to manage a scenarios like this using
Database recording system. Any suggestions ?

If I understand your "Linked list" and "nested" terminology as you intend, it could be recast in data modeling terms this way:
1. There is a set of Machine objects.
2. With each Machine object there is an associated set, possibly empty, of Notice objects.

The way to represent this in a database is to have a foreign key in the table representing Notice objects, where its value for each row refers to the Machine object, by its ID, with which it is associated. So, your
Notice table definition would have a column definition such as:
  MachineID as integer references Machines(ID)

Your List structure has ordering in addition to defining sets. If you wish to retain the order of the Notice object in the database, there will need to be a column in the Notices table giving its sequence number within the set which can be used to recreate the ordering in a query.

Regards,
--
Larry Brasfield

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to