[Stackoverflow] [Progress OpenEdge ABL] BUFFER-VALUE - Set data to different types of fields

Status
Not open for further replies.
R

Raphael Frei

Guest
I'm creating a procedure that allow us to make mass-updates on our database.
We need this because we are starting to implement a new field from a table that has registers since 2002.

The idea behind this procedure is to keep it around, because we are going to use this in several differents bases.

Code:
DEFINE INPUT PARAMETER cValueToModify AS CHARACTER NO-UNDO.

CREATE QUERY hSourcedbTableQuery.
hSourcedbTableQuery:SET-BUFFERS(hSourcedbTableBuffer).
hSourcedbTableQuery:QUERY-PREPARE(cSearchMode + cDatabaseTableName + cWhereConditions + "EXCLUSIVE-LOCK").
hSourcedbTableQuery:QUERY-OPEN().


txnBlk:
REPEAT TRANSACTION:

    DO WHILE hSourcedbTableQuery:GET-NEXT():

        iRecordsProcessed = iRecordsProcessed + 1.
                                                                      
        hSourcedbTableBuffer:BUFFER-FIELD(cFieldToModify):BUFFER-VALUE = cValueToModify.

        IF iRecordsProcessed GT 5000 THEN DO:

            iRecordsProcessed = 0.
            hSourcedbTableBuffer:BUFFER-RELEASE().

            NEXT txnBlk.

        END.

    END.

    hSourcedbTableBuffer:BUFFER-RELEASE().
    LEAVE txnBlk.

END.

My question is: When using BUFFER-FIELD and BUFFER-VALUE, do I need to pass a value that matches the type of the field? Or I can pass a CHARACTER with the value "03/23/2023" to a field of DATE type?

If not possible, what would be the best way to make this transparent for other codes? Leaving the process entire into the .P.

Continue reading...
 
Status
Not open for further replies.
Back
Top