Hi! I have a problem with the following: Calling delete(record) seems to delete a record but does not update the record count. The db.db provided with my assingment contains 24 records. When I delete a record the record counter keeps the same (24) but only 23 records are available. Iterating over the 24 records throws a NullPointerException reading record(1) which I have deleted. In this case record number 1 does not exist any longer. What happens if I delete the first 12 records and append 12 records. Record number 1-12 does not exist but 13-36. The record count is 24 but I can't loop 1 to 24. Do we have to deal with this? This problem occurs to my client refreshing the table after deleting a record. Kind regards Jochen
Joined: Oct 08, 2001
Look into the usage of LIVE_RECORD and DELETED_RECORD in your Data class. Eugene.
Jochen van Waasen
Joined: Jan 19, 2002
Originally posted by Eugene Kononov: Look into the usage of LIVE_RECORD and DELETED_RECORD in your Data class. Eugene.
Can you give me a little bit more help? Do you suggest to write my own readRecord() method within criteriaFind()? Jochen
Joined: Oct 18, 2002
Check byte one of any record. C.
Joined: Jul 10, 2001
Jochen - I can't be 100% sure without looking at the code, but I think if you delete a record it is marked as inactive by setting the first byte to 1. readRecord returns null if you read that inactive (deleted) record. I don't think readRecord is throwing a NullPointerException, I think it may be your code that is. If a method can return null, then you need to handle that when calling that method. I never called delete in my application. Do your requirements specify that the user needs to delete records? -BJ