SQL_GET_DATA_CHUNK_EX¶

Applies to: SQLFlex

This command is used to get a chunk of data from a column retrieved through an embedded SQL statement. By passing the column number and the offset number, the chunk will be put into the specified variable. To specify how big of a chunk to get, use the SQL_SET_CHUNK_SIZE command. Otherwise the maximum length will be retrieved. An optional variable can also be passed which will store the length of the chunk. Note that unlike LOB_READ, this command works for any column type, not just LOB columns.

Syntax

SQL_GET_DATA_CHUNK COLUMN {column} OFFSET {offset} to {variable} {length}

Parameter

Description

column

Column number to get chunk from

offset

Offset to start at for the chunk

variable

Variable to hold the returned chunk

length

Variable to hold the size of the returned chunk

Example

SQL_SET_MAX_DATA_SIZE to |CI$4000000 //(64MB)
move |CI$80000 to iChunkSize // 512KB
SQL_SET_CHUNK_SIZE to iChunkSize

SQL_SET_STMT to "SELECT * FROM CUSTOMER WHERE STATUS = 'Active' "
SQL_PREPARE_STMT
SQL_EXECUTE_STMT
SQL_FETCH_NEXT_ROW into sID sBio
If (Found) Begin
    SQL_GET_COLUMN_DATA_SIZE COLUMN 6 to iDataSize

    Repeat
        SQL_GET_DATA_CHUNK COLUMN 6 OFFSET iProgress to sChunk
        ADD iChunkSize to iProgress
        write sChunk
    until (iProgress >= iDataSize)

End