At 09:52 AM 8/20/2003 -0700, you wrote:
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of Bob Withers
> Sent: Wednesday, August 20, 2003 9:10 AM
> To: Palm Developer Forum
> Subject: RE: Faking relational databases with PDBs
>
>
> At 08:43 AM 8/20/2003 -0700, you wrote:
>
> >2) DataMgr automatically handles assigning the UIDs.  I first toyed
> >with the idea of manually assigning sequential primary keys
> to each new
> >record as follows:  Store the next-unassigned Primary Key
> value in the
> >DB's AppInfo block, use this as the primary key of the next-inserted
> >record and then increment.  This became problematic because a) the
> >numeric value would eventually experience a wrap-around when
> it reached
> >the maximum allowable value for its data type (UInt32), and
> b) after a
> >wrap-around, how do you prevent assigning the same ID to two
> records?
> >It seemed that Palm's UID system had already figured all of this out.
>
> I've encountered problems with this approach in that if a PDB
> is beamed to
> another device the unique IDs can, and probably will, change.
>  As a result
> all your references will be broken.

Bob, I didn't consider this, but this is surprising to me.  Great
lengths are used to preserve the existing DataMgr-assigned Unique IDs,
as explained in this article:
        http://tinyurl.com/kmbm

Just out of curiousity, do you beam a record at a time?  Or do you use
ExgDBWrite() to dump the whole PDB over?  It sounds like the receiving
Palm is getting a record, allocating a new one (and thus a new UID), and
then copying the contents.  I would have to crack open the OS source
code to tell for sure.  From my understanding of UIDs, though, I would
consider even this an OS bug.  Existing UIDs should always be
preserved...

Jeff,


Actually if my code was doing the beaming I could make sure the unique ID's didn't change. The problem occurred when the PDB's were beamed with utility programs like Filez, McFile, etc.

Bob


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

Reply via email to