f2s_begin_buffered_save¶

Applies to: Oracle, MS SQL

Syntax

f2s_begin_buffered_save {FileName} MAX_ROWS {NumberOfRows}

Parameter

Description

FileName

Name of the file.

NumberOfRows

Maximum number of Records in the batch.

Description

This command is used to initialize a buffer for bulk input of records. Doing this will allow a specified set of records to be stored in the buffer before a save takes place. Once the buffer is filled, it will be saved automatically. This set of commands can be used to efficiently save a large number of records. Once the buffer is full, the save occurs automatically and the buffer will be emptied out. It is good practice to use this method inside of a transaction to maintain atomicity. Note that these commands should not be used with finds.

Example

SQL Server Code to create a buffer of 100 records each to save into a Table.
Integer iCount
Open "SALESPERSON.int" as SALESPERSON
BEGIN_TRANSACTION
    //Set the MAX_ROWS to 100
    f2s_begin_buffered_save SALESPERSON.File_Number MAX_ROWS 100

    //The 1,000 records will be recorded in blocks of 100 records each (10% of the total).
    For iCount from 1 to 1000
        Move iCount to SALESPERSON.ID
        Move ("Name" + Trim(iCount)) to SALESPERSON.NAME
        f2s_buffered_save SALESPERSON.File_Number
        Showln 'Saving Record: ' iCount
    Loop
    f2s_end_buffered_save SALESPERSON.File_Number
END_TRANSACTION
Showln 'Finished ...'
Inkey PageEnd

Related Commands

  • f2s_buffered_save

  • f2s_end_buffered_save

Replaces: Command SQL_SAVE_BUFFER_BEGIN