XSharpPublic icon indicating copy to clipboard operation
XSharpPublic copied to clipboard

[VFP] Cursor Operation REPLACE with ALL

Open MarioV-GH opened this issue 1 year ago • 3 comments

Describe the bug Keyword ALL seems to be not supported (Parser-Error)

To Reproduce Code to reproduce the behavior:

USING System
USING System.Collections.Generic
USING System.Text
FUNCTION check_cursor AS VOID
        create cursor abc (mkey i, mident c(10))
        insert into abc (mkey,mident) values (1,"a")
        insert into abc (mkey,mident) values (2,"b")
        insert into abc (mkey,mident) values (3,"c")

        create cursor def (mkey_fk i,mtext c(10))
        insert into def (mkey_fk,mtext) values  (1,"inf1")
        insert into def  (mkey_fk,mtext)  values (1,"inf2")
        insert into def  (mkey_fk,mtext)  values (2,"infA")

        insert into def  (mkey_fk,mtext)  values (3,"to_del")
        insert into def  (mkey_fk,mtext)  values (4,"to_del")


        select def
        REPLACE ALL mtext WITH "newtext" + transform(recno())
RETURN

Expected behavior All Records should be updated (instead of just the single record with the record pointer)

MarioV-GH avatar Oct 02 '24 10:10 MarioV-GH

The ALL clause is supported, but just not at that location in the command. Either move ALL to the end of the command, or add the following to the start of your code or to a header file that you're including in your code.

#command REPLACE <*clauses*> ALL <*moreclauses*> => REPLACE <clauses> <moreclauses> ALL

RobertvanderHulst avatar Oct 02 '24 13:10 RobertvanderHulst

that works, thanks

MarioV-GH avatar Oct 02 '24 14:10 MarioV-GH

Added to the standard Header file for 2.21

RobertvanderHulst avatar Oct 03 '24 10:10 RobertvanderHulst

Confirmed fixed

cpyrgas avatar Nov 04 '24 23:11 cpyrgas