iajfoj jgoiejoisjo wrote:
> What I get at this stage is a seemingly valid dbID of like 8552589 or
> something, a dbP that has the same value as my eventP and formP (I'm not
> sure if that means I am not connecting right) a recordNumber (or Index) of
> 1(not desired), and a bunch of completely insane values in my pointer
> record and basic record.

This sounds like some part of your program is stepping on your other
variables.  dbP,  eventP, and formP should have the same value at the same
time.

> //My Record Structure
> typedef struct
> {
> char prodno[21];
> char upc[21];
> char retail[11];
> etc. (all char values of correct size)
> }UPCD;
> 
> 
> //My Database Access (I am positive I have the correct db name)
> LocalID dbID = DmFindDatabase(0, "Detail-PMOO");
> DmOpenRef dbP = DmOpenDatabase(0, dbID, dmModeReadOnly);

Could you be writing more chars to a member of UPCD than exist in the
structure?  If so, it would explain how dbP and dbID could be corrupted.

> I think the possible problem areas are in the comparison function, making
> Record = the memhandle, opening the database(somehow, it doesn't error and 
> dbID seems valid.

You're using MemHandleLock which returns a locked pointer (not a handle)
which is what you want.  So you are doing this correctly.

> Another issue is packing, I don't understand what packing and unpacking
> databases means. Do you have to unpack a database to read records from it?

Only if they were packed to begin with.  It's a design decision, not
something PalmOS inherently does.  That is, if you want packing, you need
to implement it yourself.  For example, if you want to store two ints (foo
and bar) in a record:

struct
{
        int foo;
        int bar;
} unpackedRecord;

You might be able to pack them to save space.  Say foo has a max value of 15
and bar a max of 7.  You could pack them like so:

struct
{
        int foo : 4;
        int bar : 3;
        int unused : 1;
} packedRecord;

So, what used to require 4 bytes, now fits in 1.



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

Reply via email to