blk_rowxfer_mult

Description

Transfers one or more rows during a bulk-copy operation.

Syntax

CS_RETCODE blk_rowxfer_mult(blkdesc, row_count)
 
 CS_BLKDESC       *blkdesc;
 CS_INT                *row_count;

Parameters

blkdesc

A pointer to the CS_BLKDESC that is serving as a control block for the bulk-copy operation. blk_alloc allocates a CS_BLKDESC structure.

row_count

A pointer to a CS_INT variable or NULL.

For bulk-copy-out operations, blk_rowxfer_mult returns with *row_count set to the number of rows read by the call. If row_count is NULL, this information is not available to the application. (The application can call blk_done to determine how many rows have been transferred by the cumulative number of blk_rowxfer_mult calls since the last blk_done call—but it is simpler to use a row count variable.

For bulk-copy-in operations, blk_rowxfer_mult sends the number of rows specified by *row_count to the server. If row_count is NULL or *row_count is 0, then the number of rows specified by datafmt−>count in previous calls to blk_bind are sent to the server.

row_count is used by applications that perform array binding. For more information on this feature, see “Array binding”.

Returns

blk_rowxfer_mult returns:

Table 4-8: blk_rowxfer_mult return values

Returns

Indicates

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

CS_PENDING

Asynchronous network I/O is in effect. For more information, see the “Asynchronous Programming” topics page in the Open Client Client-Library/C Reference Manual.

CS_BLK_HAS_TEXT

The row contains one or more columns which have been marked for transfer using blk_textxfer.

The application must call blk_textxfer to transfer data for these columns row before calling blk_rowxfer_mult to transfer the next row.

CS_END_DATA

When copying data out from a database, blk_rowxfer_mult returns CS_END_DATA to indicate that all rows have been transferred.

When copying data into a database, blk_rowxfer_mult does not return CS_END_DATA.

CS_ROW_FAIL

A recoverable error occurred while fetching a row. Applies to bulk-copy-out operations only.

blk_rowxfer_mult sets *row_count to indicate the number of rows transferred (including the row containing the error) and transfers no rows after that row. The next call to blk_rowxfer_mult will read rows starting with the row after the one where the error occurred.

Recoverable errors include memory allocation failures and conversion errors (such as overflowing the destination buffer) that occur while copying row values to program variables. In the case of buffer-overflow errors, blk_rowxfer_mult sets the corresponding *indicator variable(s) to a value greater than 0. Indicator variables must have been specified in the application’s calls to blk_bind.

When blk_rowxfer_mult returns CS_ROW_FAIL, the application must continue calling blk_rowxfer_mult to keep retrieving rows, or it can call ct_cancel to cancel the remaining results.

A common reason for a blk_rowxfer_mult failure is conversion error.

Usage


blk_rowxfer_mult and bulk-copy-in operations


blk_rowxfer_mult and bulk-copy-out operations


Transferring large text or image values in chunks

See also

blk_bind, blk_textxfer