There are basically two sides to category management in the Palm OS.
One is the Data Manager side, the other the Category Manager side.
Data Manager:
Each Palm OS Database essentially consists of (besides some header
information) a flat vector of record entries. Each record entry is
an 8-byte structure with the following entries:
4 bytes: record handle (the thing returned by DmQueryRecord, etc.)
3 bytes: record unique id
1 byte: attributes, which consists of a category nibble (low) and
a flags (busy/dirty/deleted/secret) nibble (high).
There are 8 Data Manager functions that deal with category information.
DmRecordInfo and DmSetRecordInfo will get or set the category attribute
of a single record (don't forget to mask off the flags nibble).
DmNumRecordsInCategory, DmPositionInCategory, DmQueryNextInCategory,
and DmSeekRecordInCategory are useful for iterating through or finding
the records in a particular category.
DmDeleteCategory and DmMoveCategory are batch routine to change the
category attribute of all records in a database in a particular category.
For purposes of the Data Manager, a category is just a number from
0 (unfiled) to 15 inclusive. This number is often referred to as the
"category index".
You probably only need to use Data Manager routines for your problem.
Category Manager:
The Category Manager deals with categories for the GUI and user.
It basically consists of a single structure usually stored as the
App Info block of a database. This structure contains, for each
of the 16 possible categories, the following information:
16 bytes: category name (null terminated string, must be unique).
1 byte: category id (often used by desktop apps, NOT the category index).
1 bit: dirty flag.
It is organized as:
16 x 1 bit (2 bytes): dirty flags
16 x 16 bytes: names
16 x 1 byte: ids
The category index is determined by their location within these
areas.
Category Manager routines drive the little category pickers that
you see in some application -- such as address book, etc. When
the user selects a category to view, for example, then data manager
routines (such as DmSeekRecordInCategory) are used to find the
records to display in a list.
Category Manager routines often take a category's name as input,
hence the restriction on names being unique. What the routines do
in this case is walk through the name array until the find a match,
then use the index of that match.
Hope this helps
-bob mckenzie
-----Original Message-----
From: Jeremy Nuss [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 27, 2001 7:18 PM
To: Palm Developer Forum
Subject: RE: Database woes, need some advice
Ack, I can see how that would work, but I really don't have the time to have
to write custom interpretation routines to handle a structure like that.
Basically I'd really like to go ahead with the idea of putting records into
catagories per session, and requiring a sync after 15 sessions. It would be
ideal for my purposes, I just wanted to bounce the idea off everyone and see
what you all think. Is it impossible or a terrible way to do it... so far
I've had no luck actually implementing it, I really wish there was a book
that explores the relation between catagories, databases, and records really
well.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Yu, Ken
[IT]
Sent: Wednesday, June 27, 2001 6:11 PM
To: Palm Developer Forum
Subject: RE: Database woes, need some advice
If your database scheme is not complex and if you're up to it, you can treat
each record as a "database".
(ie divide up the Palm record into multiple custom DB's and records). Of
course, it's your responsibility to interpret the data. In the end you'll
just have one Palm database that will contain all your data.
Your record structure could look something like:
typedef struct {...} rectype1; // record structure for database 1 (Note:
ensure proper byte aligment)
typedef struct {...} rectype2; // record structure for database 2
typedef struct {...} rectype3; // record structure for database 3
typedef struct {...} rectype4; // record structure for database 4
typedef struct {
int num_recs1; // number of records in database 1
rectype *r1; // List of records in DB 1
int num_recs2; // number of records in database 2
rectype *r2; // List of records in DB 2
int num_recs3; // number of records in database 3
rectype *r3; // List of records in DB 3
int num_recs4; // number of records in database 4
rectype *r4; // List of records in DB 4
} customrec;
-Ken
> ----------
> From: Jeremy Nuss[SMTP:[EMAIL PROTECTED]]
> Reply To: Palm Developer Forum
> Sent: Wednesday, June 27, 2001 5:51 PM
> To: Palm Developer Forum
> Subject: RE: Database woes, need some advice
>
> >Why not just put each session in a separate record, avoiding the 15
> category limit?
>
>
> Each session will have a multitude of records associated with it across 4
> databases.
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/tech/support/forums/
>
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/