Page 1 of 1

Major flaw in TDataBase CLASS

PostPosted: Wed Nov 08, 2006 8:13 pm
by Gilbert
Hi all,

I use a database that has 148 records in it. No indexes are used at all.

If I call oDbf:GoTop() and test the RecNo()
I get recno 14 instead of 1
If I call oDbf:GoBottom() and test the RecNo()
I get recno 142 instead of 148

Can anyone tell me why this weird result. :(

Regards

PostPosted: Thu Nov 09, 2006 8:21 am
by Biel EA6DD
Probably you are working with SET DELETE ON, and you have deleted records. So REcno 14 is the first non deleted record in your DBF.

PACK, or SET DELETE OFF.

PostPosted: Thu Nov 09, 2006 12:27 pm
by Gilbert
Hi Biel,


It`s true I always used set delete on. I don`t want to see deleted records anyway. But my database as no deleted records.

Made a second test: if i use Clipper dbGoTop() & dbGoBottom() everything works fine. Only if I use TDataBase problem returns.


Regard

PostPosted: Thu Nov 09, 2006 2:18 pm
by Biel EA6DD
Hi Gilbert,
Code: Select all  Expand view
METHOD GoTop()             INLINE ( ::nArea )->( DBGoTop() ),;
                                     If( ::lBuffer, ::Load(), )
METHOD GoBottom()          INLINE ( ::nArea )->( DBGoBottom() ),;
                                     If( ::lBuffer, ::Load(), )

Like can you see, the tDatabase is doing the same, (::nArea)->(dbGoTop()), (::Load() don't move the record pointer).

Try to execute
Code: Select all  Expand view
(oDbf:nArea)->(dbGoTop())


Check oDbf:nArea if is the correct data Area.

PostPosted: Mon Nov 13, 2006 7:55 pm
by Gilbert
Hi Biel,

I finally found what the problem was. The database I was testing with contains special ASCII code that are in the range of 0 to 31. That was causing the problem. I did some testing with another database and everything works well.

Regards,