SQL_GET_COLUMN_DATA_SIZE¶
Applies to: SQLFlex
This command is used to get the size of the data in a column retrieved through an embedded SQL statement. By passing the column number the size of the data in the column will be put into the specified variable. The size returned will be the smaller of the actual size of the data or the SQL_SET_MAX_DATA_SIZE setting. So for instance, if the data stored in a column is 64MB, but the SQL_SET_MAX_DATA_SIZE is set to 16MB, then this command will return 16MB. Note that you may need to use Set_Argument_Size to allow for a large chunk size because the default maximum string size in most modern dataflex versions is only 64KB.
Syntax
SQL_GET_COLUMN_DATA_SIZE COLUMN {column} to {variable}
Parameter |
Description |
---|---|
column |
Column number to get chunk from |
variable |
Variable to hold the returned data size |
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