Peter Solderitsch wrote:
> when I've created more than 1 record, and then delete
> one of them, I can't retrieve any other data!

First a newbie tip: try to describe your problems with more detail, such
as which API's you are calling and the exact error resulting.  (The
above description would be considered vague.  However...)

> I thought that this was a case where [...] upon deletion
> the indices below it all shifted back by a value of 1 [...]

Are you confusing "delete" via DmDeleteRecord and "remove" via
DmRemoveRecord?  DmDeleteRecord blows away a record's body but leaves
its header in the database header, so no other records' headers get
shifted anywhere.  DmRemoveRecord blows away a record's body _and_ its
header, causing records at higher indexes to shift down by one (if you
think of the database header like an array).

And if you call DmQueryRecord or DmGetRecord with an index that refers
to a "delete"d record, it will assert and/or crash, I think.

> Is there a way to reliably keep track of which record is which
> inside a database?  (there must be...)

Yes, you can maintain external arrays like you described above, as long
as you handle all situations where record indexes can change.

-slj-

Reply via email to