X-Sharp / XSharpPublic

Public repository for the source code for the XSharp Compiler, Runtime, Project System and Tools.
Apache License 2.0
112 stars 38 forks source link

DataListView incorrectly shows (empty) deleted records with SetDeleted(TRUE) #1009

Closed cpyrgas closed 2 years ago

cpyrgas commented 2 years ago

Following code creates an indexed dbf with 5 records, 2 of them deleted and shows it in a DataListView. When SetDeleted() == FALSE, then all 5 records are shown as expected. But when SetDeleted() == TRUE, then it shows the 3 non-deleted records correctly, but also the other 2 records, with empty data:

DataListView_deleted

In VO, only the 3 non-deleted records are shown, as expected. Most probably there's an incompatibility with VO regarding querying the amount of records available with dborderinfo() or similar, will further investigate.

FUNCTION Start() AS VOID
    LOCAL oDataWindow AS DataDialog
    LOCAL oApp AS App

    RddSetDefault( "DBFCDX" )

    LOCAL cDbf AS STRING
    cDbf := "C:\test\TestDLV"
    FErase(cDbf + ".cdx")
    DbCreate(cDbf, {{"ID","N",10,0}})
    DbUseArea(,,cDbf)
    DbAppend()
    FieldPut(1,1)
    DbAppend()
    FieldPut(1,2)
    DbDelete()
    DbAppend()
    FieldPut(1,3)
    DbAppend()
    FieldPut(1,4)
    DbDelete()
    DbAppend()
    FieldPut(1,5)
    DbCreateIndex(cDbf,"ID")
    DbCloseArea()

    SetDeleted(TRUE)

    oApp := App{}

    oDataWindow := DataDialog{oApp}
    oDataWindow:Size := Dimension{500,500}
    oDataWindow:Origin := Point{100,100}

    LOCAL oListView AS DataListView
    oListView := DataListView{oDataWindow}
    oListView:Size := Dimension{200,200}
    oListView:Origin := Point{200,200}
    oListView:Show()
    oListView:Server := DBServer{cDbf}

    oDataWindow:Show()

RETURN

VOGUI_test.zip

RobertvanderHulst commented 2 years ago

Fixed when the order is set. Without active order the DataListView asks for the recordcount and that produces wacky results. Also in VO. Please note that querying OrderKeyCount like the DataListView does with SetDeleted(TRUE) forces the RDD to fysically read all records. It can't simply count the # of keys in the index, because it does not know if the key is from a deleted record or not.

cpyrgas commented 2 years ago

Confirmed fixed