>/ Write the new appointment to the date book, save the record index so that
>// we can pass it to the Date Book for subsequent viewing, and free 
>the buffer pointer.
>// UTAddRecord creates a new record of size MemPtrSize ( recP ), 
>copies what's in recP
>// into that record, and returns the new record's index in &index.
>
>       index   = dmMaxRecordIndex;
>       error   = UTAddRecord ( dbRef, &index, recP, ( UInt16 ) 
>MemPtrSize ( recP ), category );
>       MemPtrFree ( recP );
>       DmCloseDatabase ( dbRef );
>       return error;
>}

This is fine, but this adds the appointment AT THE END of the database 
(dmMaxRecordIndex). However entries in the DateBook are stored in order 
(at least for non-repeating events; repeating events are different), so 
this means that the event will not be in order. In turn this probably 
means that the DateBook application will not display it or will develop 
some other problem, and/or that some other application (of which there 
are many) that accesses the DateBook database will not behave properly. 
And it's certain, even without looking at the code, that the DateBook 
does not automatically sort data when it is run (or under any 
circumstances as far as I know), because that would mean a tremendous 
time penalty on startup. So unless I'm missing something, adding 
something to the DateBook in this manner (that is, without determining 
where in the database it should be inserted) is very dangerous.

Steve Patt
President, Stevens Creek Software
  http://www.stevenscreek.com/palm
  Best PQA ("ePQA"), PalmSource 99
  Best Application ("PizzaScan"), Palm Developer's Conference 1998
  First printing software for the Palm - September, 1997


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

Reply via email to