> From: Of Kelly J Perkins
>
> I am using the Address book code as a reference for another
> project and have
> set up my fields as they did using the bit structure just as they did.
> Using Code Warrior 7, Win2000, C, etc.
>
> This is probably an easy question, but is there a way to get more than 32
> fields? I am not familiar with the Union code they are using
> (except in SQL)
> and was wondering if that is what I am missing. I saw the long long data
> type question go by for Int 64 and thought maybe that would be the way to
> go?
>
You can have as many fields as you want in a Palm database. Records in a
Palm OS database can contains any bytes you want to put there, and each
record does not have to be the same size. The address book code uses
datatypes like the following because it makes it easy to determine what data
a record actually contains. You definitely do not have to do the same thing
in your program. However, if you don't understand structs and unions, you
should get a good book on the C programming language and study it. A good
understanding of C is definitely necessary to program Palm apps with
CodeWarrior.
typedef union {
struct {
unsigned reserved :8;
// Typically only one of these are set
unsigned email :1; // set if data is an email address
unsigned fax :1; // set if data is a fax
// etc. (32 bits total)
} bits;
UInt32 allBits;
} AddrDBPhoneFlags;
The AddrDBPhoneFlags data type is a union between an unsigned, 32 bit,
integer bitfield (the bits struct) and a single UInt32. This makes it easy
to work with all the bits as one unit, referred to as allBits, or to refer
to a single bit, for example, to test if the record contains an email
address.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/