Page 1 of 1

Bug in PACK command

PostPosted: Sun May 20, 2007 11:51 am
by Enrico Maria Giordano
This is the sample:

Code: Select all  Expand view
#include "Fwce.ch"


FUNCTION MAIN()

    DBCREATE( CURDIR() + "\TMPTEST", { { "TEST", "C", 10, 0 } } )

    USE ( CURDIR() + "\TMPTEST" )

    APPEND BLANK

    REPLACE FIELD -> test WITH "Test 1"

    APPEND BLANK

    REPLACE FIELD -> test WITH "Test 2"

    DELETE

    PACK

    CLOSE

    MSGINFO( "Done!" )

    RETURN NIL


It seems that PACK recovers deleted flag instead of to remove the deleted record.

Probably it is a bug in Harbour_CE. It is working fine with current Harbour from CVS.

EMG

Re: Bug in PACK command

PostPosted: Sun May 20, 2007 3:42 pm
by Richard Chidiak
Enrico

Pack works OK you have to add

SET DELETE ON

Regards

Richard :)

Re: Bug in PACK command

PostPosted: Sun May 20, 2007 4:20 pm
by Enrico Maria Giordano
No, SET DELETED ON is not required for PACK to work. Anyway, I just tried with SET DELETED ON and found the same result.

I'm using FWPPC 7.02.

EMG

PostPosted: Sun May 20, 2007 5:09 pm
by Antonio Linares
Enrico,

Changing your code this way:

PACK

MsgInfo( RecCount() )

It shows 1, which it seems correct

PostPosted: Sun May 20, 2007 5:52 pm
by Enrico Maria Giordano
Yes, but now try to open TMPTEST.DBF and you will see that there are two records.

EMG

PostPosted: Sun May 20, 2007 6:33 pm
by Enrico Maria Giordano
This is the modified sample showing that the record is not removed:

Code: Select all  Expand view
#include "Fwce.ch"


FUNCTION MAIN()

    SET DELETED ON

    DBCREATE( CURDIR() + "\TMPTEST", { { "TEST", "C", 10, 0 } } )

    USE ( CURDIR() + "\TMPTEST" )

    APPEND BLANK

    REPLACE FIELD -> test WITH "Test 1"

    APPEND BLANK

    REPLACE FIELD -> test WITH "Test 2"

    DELETE

    PACK

    CLOSE

    USE ( CURDIR() + "\TMPTEST" )

    MSGINFO( RECCOUNT() )

    CLOSE

    MSGINFO( "Done!" )

    RETURN NIL


EMG

PostPosted: Sun May 20, 2007 6:50 pm
by Antonio Linares
Enrico,

It is related to the SD memory card. Copy the EXE to the Pocket PC root path and it works fine there

PostPosted: Sun May 20, 2007 6:56 pm
by Enrico Maria Giordano
Sorry, I haven't a pocket PC. How can I do the same using the emulator?

EMG

PostPosted: Sun May 20, 2007 7:15 pm
by Antonio Linares
Enrico,

Keep the mouse pressed on top of the EXE until a popup is shown, then select copy. Then select "My Device" from the top menu of the file explorer and right click and select paste. Then run it there.
Image
Image

PostPosted: Sun May 20, 2007 10:31 pm
by Enrico Maria Giordano
Yes, this way it works. Unfortunately, this makes the emulator much less useful. I wonder if there is a way to get the program to run correctly on the storage card...

EMG

PostPosted: Mon May 21, 2007 5:31 am
by Antonio Linares
Enrico,

Harbour uses the same functions to manage files when it runs on the memory card, so its a difference on the Windows Mobile OS