The way I am currently using the palm database does not seem correct.
Yes I have gotten it to work, and it is doing what I ask it to do, however,
It seems WAY too complex and there has to be a better way.

Currently I keep my information in a struct Rec

For example:

Struct Rec {
    char* data;

    int foo;
    char* bar;
... constructor destructor etc...
};

When I write to the record I am writing Rec.data, which is a char star with
each field seperated by "~"'s.
For example if foo is 5 and bar is "asdf" then data would be "5~asdf"

When I pull the data out of the DB I put it into a new rec's data field.

I then have two functions, CombineDataIntoFields and ExpandData.  This fills
the appropriate fields, foo and bar, with the data out of data, or vice
versa, creates data by concating all the fields with the "~" spacer.

Like I said, WAY too complex.

I have tried just writing a pointer to a record this way:
Struct Rec {
    int foo;
    char* bar;
};
// rec is a *Rec
newRec = DmResizeRecord(db, index, sizeof(rec));
errDb = DmWrite(MemHandleLock(newRec), index, rec, sizeof(rec));

I know there has to be a way to do something like this but it isn't quite
working yet.

Any suggestions?

tia,

Steve K



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to