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

[VFP] Problem with COPY TO ARRAY / DbCopyToArray() with fields of type "G" #1530

Open cpyrgas opened 2 months ago

cpyrgas commented 2 months ago

Following results to an array bound error at runtime, because of the existence of the field of type "G". Without it, it works as expected.

Problem is caused because DbCopyToArray() calls __BuildFieldList(), which ignores "G" type fields in the array it returns .

FUNCTION Start( ) AS VOID
    LOCAL cDbf AS STRING
    cDbf := "test"
    ? DbCreate(cDbf,{{"FLD","C",30,0},{"FLD2","N",10,0},{"FLD3","G",10,0}},"DBFVFP")
    DbUseArea(TRUE,,cDbf)
    DbAppend()
    DbGoTop()

    DIMENSION arr(5, 5) AS ARRAY
    COPY TO ARRAY arr

    ShowArray(arr)