I've been working on a small palm app (my first) that allows me to read and write datebook records. That's all been going well until the other day when I had an obvious realization that I was being a bad palm citizen. I was opening the datebook database when my program started and closing it on shutdown.
This meant that alarms couldn't write back to the database while I was using my program. So, is there some common wisdom (that I haven't found yet) for dealing with public databases? What I've thought of on my own is: 1) Verify that the database exists on startup, by attempting to open it. Fail to run if the database doesn't exist (I haven't studied *all* of the datebook sample source to see how it initializes a new database so for the moment my program won't do that). 2) Open the database and scan for the records I'm interested in. Save off the Unique ID of each record and stats on the database like the number of records and last modified date. Close the database. 3) If the user modifies a record in my app, re-open the database. Verify that the record and unique ID still match, do some checks on the number of records and last modified time to make sure that the record in question hasn't been modified by another process. Possibly fail the update if the record has changed? Otherwise save the record and close the database. Michael S. Harrison michaelh.dragonseye@com (reverse the dot and at to send email) * The opinions expressed here are those of my iguana * and I never know what he's going to say next. -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
