Hi all,

        I've read in prior posting here and in other articles that there is
a general rule of thumb that DB records should not vary in structure or
length from record to record in any given DB.  Now maintaining this rule
would not be much of a problem if Palm DBs had such a thing as tables in
their DB concept.  You could use individual DBs as though they were tables.
But you would end up with potentially many little tables wasting or using
just as many resources for DB and record attributes as the actual data being
stored.  Also there would be the nightmare during beaming of getting bits of
information out of each of these many DBs.

        In the book "Palm Programming: The Developer's Guide" Rhodes &
McKeehan use in there Sale sample code a method of using varying length
records.  This is done by 1st storing in a know location of a record how
many of (varying number of something) items will be stored with the varying
number of items stored there after.  In their Sales sample it was the Order
DB containing a varying number of items.   A Word variable numItems in a
know location in the record contain how many.  And the actual items which
were composed of a DWord variable productID and a DWord variable quantity
followed the numItems variable in the record.  You would know were the end
of the list is by knowing how many items are to be stored and the length of
each item.

        For a slightly more complex example lets assume that a factory is
processing a batch of material.  And during the processing of this material
random number of temperature readings are taken randomly during the process.
Here is how data would be laid out;

Record#, Batch#, Product,         Date, StartTime, #ReadingsTaken,
{Temperature, TimeStamp, ...n,)                  EndTime
          0,      243,       X23, 04/05/2001,      23:45,
3, +90, 23:50, +93, 01:00, +92, 01:10,                  01:30
          1,      245,       X25, 04/06/2001,      01:50,
2, +91, 01:55, +92, 02:05,                                    02:25
          2,      244,       X23, 04/06/2001,      03:25,
4, +90, 03:30, +93, 03:40, +92, 03:50, +92, 04:00, 04:20

        Using varying length DB records is better from a resource issue but
is slower and breaks the rule of thumb for uniformity of records.  What are
some of the other pros and cons for using varying length records from a Palm
stand point.

Sorry for the length of this message,
Just wanted to be clear,
Steve



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to