Palm OS Databases
In Palm OS, any file is a database, which is similar to the persistent storage of J2ME.
A Palm database does NOT mean “relational database”.
It is actually closer to a structured, flexible, and mobile binary data file:
- It is structured because it has a header that contains information on the database itself, pompously called “metadata” (type, creator, version, backup flag, copy protection flag, read-only flag, etc. )
- It is flexible because Palm OS deals with the physical organization of data and provides you with a set of API's for sorting records, changing various record-level attributes (
Secret
, Busy
, etc.), resizing a record, etc.
The Data Manager
The Data Manager
manages user data, which is stored in databases for convenient access.
Data in the Palm Powered handheld is broken down into multiple, finite-size records that can be left scattered throughout the memory space; thus, adding, deleting, or resizing a record does not require moving other records around in memory.
Each record in a database is in fact a Memory Manager
chunk.
The Data Manager
uses Memory Manager
functions to allocate, delete, and resize database records.
Records and Databases
Databases organize related records; every record belongs to one and only one database.
A database maintains a list of all records that belong to it by storing the local ID of each record in the database header.
Because local IDs are used, the memory card can be placed into any memory slot of a Palm Powered handheld.
When an application requests a particular record,
- the
Data Manager
fetches the local ID of the record from the database header by index,
- converts the local ID to a handle using the card number that contains the database header, and
- returns the handle to the record.