Now we are going to talk about how data is organized. In Chapter 6, we told you that data, rather unusually, resides in RAM memory in the Palm OS. This memory is in turn divided into two sections: the dynamic and storage heaps. Permanent data resides in the storage heap and is accessed via the Data Manager (the dynamic heap that we talked about in Chapter 6 is managed strictly by the Memory Manager).
We will give you an overview of how data and databases are organized in the Palm OS. We will cover everything you need to know, from types of databases to creating databases, modifying them, creating individual data records; adding, modifying, and deleting them from a database; and different ways of handling sorting. We will also cover other essential topics such as how to deal with secret records and working around the 64K size limitation. Finally, we will take all this information and apply it to the creation of the databases and records in our Sales sample application. We will show you the source code for the routines that handle all of these database and record tasks.