Palm OS Databases (Cont.)
Using the Data Manager (Cont.)
- To resize a record to grow or shrink its contents, call DmResizeRecord.
This routine automatically reallocates the record in another heap of the same card if the current heap does not have enough space for it.
- To add a new record to a database, call DmNewRecord.
This routine can insert the new record at any index position, append it to the end, or replace an existing record by index. It returns a handle to the new record.
- There are three methods for removing a record:
- DmRemoveRecord removes the record's entry from the database header and disposes of the record data.
- DmDeleteRecord also disposes of the record data.
It sets the deleted bit in the record entry attributes field and clears the local chunk ID.
- DmArchiveRecord does not dispose of the record's data; it just sets the deleted bit in the record entry.
- Call DmRecordInfo and DmSetRecordInfo to retrieve or set the record information stored in the database header, such as the attributes, unique ID, and local ID of the record.
- To move records from one index to another or from one database to another, call the following three functions:
- DmMoveRecord removes a record entry from the database header and returns the record handle.
- DmAttachRecord: Given the handle of a new record, it inserts or appends that new record to a database or replaces an existing record with the new record.
- DmDetachRecord removes a record entry from the database header and returns the record handle.