RecordCount 0, IsEmpty false
D2007. NexusDB 3.09
I have a situation where i delete records in a table using a cursor and then check with another cursor on the same table but using a different index and a range if the table is empty. It seems that this way of deleting records makes IsEmpty not reliable since i have a recordcount of 0 and IsEmpty false.
TB1 has one record.
TB1.Delete; // index A
TB2.SetRange([Key],[Key]); // index B
Here TB2.RecordCount = 0 which is correct but TB2.IsEmpty is false.
If i move the cursor after TB2.SetRange by issuing a TB2.First then IsEmpty returns true. ( Somehow i thought that SetRange was doing an implicit First )
Is this wad or something wrong with my code?
If i move the cursor after TB2.SetRange by issuing a TB2.First then IsEmpty returns true.
I uploaded a little project in the binaries (CheckIsEmpty.zip) that reproduces this.
Re: RecordCount 0, IsEmpty false
I get the same results with FlashFiler 2.53.
To show this I create a table Test.nx1 with 2 fields: A shortstring 10,
Sequential access, NoIdx (Field: No), NameIdx ( Field Name)
2 records :
TB1 indexname ''
TB2 indexname NoIdx
if TB1.IsEmpty then // table still has 1 record left
if TB1.IsEmpty then // table has no record left (TB1.Recordcount = 0)
Exit; // never gets called because IsEmpty is false
In this case (TB1.Recordcount = 0) is more reliable then TB1.IsEmpty.
|Thread||Thread Starter||Forum||Replies||Last Post|
|RecordCount 0, IsEmpty false||denisprince||Binaries||0||25th January 2012 09:42 AM|
|IsEmpty vs RecordCount||jprenou||nexusdb.public.support||2||9th November 2010 09:22 AM|
|TR/ATRAPS.Gen false ?||Ad Franse||nexusdb.public.discussions||3||1st January 2010 02:15 AM|
|assign false as Defaultvalue||Jago Post||nexusdb.public.support||2||21st August 2006 10:09 PM|
|isempty set eof to true ?||Roberto Nicchi||nexusdb.public.support||2||6th November 2003 06:30 AM|