blk_done

Description

Marks a complete bulk-copy operation or a complete bulk-copy batch.

Syntax

CS_RETCODE blk_done(blkdesc, type, outrow)
 
 CS_BLKDESC      *blkdesc;
 CS_INT                 type;
 CS_INT               *outrow;

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.

type

One of the following symbolic values:

Value of type

blk_done

CS_BLK_ALL

Marks a complete bulk-copy-in or bulk-copy-out operation.

CS_BLK_BATCH

Marks the end of a batch of rows in a batched bulk-copy-in operation.

CS_BLK_CANCEL

Cancels a bulk-copy batch or bulk-copy operation.

outrow

A pointer to an integer variable. If type is CS_BLK_BATCH or CS_BLK_ALL, blk_done sets *outrow to the number of rows bulk copied to Adaptive Server since the application’s last blk_done call. When type is CS_BLK_CANCEL, *outrow is set to 0.

Returns

blk_done returns:

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.

Common reasons for blk_done failure include:

Examples

Example 1

/*
 ** BulkCopyIn()
 */
CS_STATIC CS_RETCODE 
 BulkCopyIn(connection)
 CS_CONNECTION   *connection;
 {
      CS_BLKDESC   *blkdesc;
      CS_DATAFMT   datafmt;     /* variable descriptions */
      Blk_Data     *dptr;       /* data for transfer */
      CS_INT       datalen[5];  /* variable data length */
      CS_INT       len;
      CS_INT       numrows;
 
      /*
      ** Ready to start the bulk copy in now that all the
      ** connections have been made and have a table name.
      ** Start by getting the bulk descriptor initializing.
      */
      ...CODE DELETED.....
 
      /*

      ** Now to bind the variables to the columns and

      ** transfer the data
      */
      ...CODE DELETED.....
 
      /* ALL the rows sent so clear up */
      if (blk_done(blkdesc, CS_BLK_ALL, &numrows) == CS_FAIL)
      {
         ex_error("BulkCopyIn: blk_done() failed");
         return CS_FAIL;
      }
      if (blk_drop(blkdesc) == CS_FAIL)
      {
         ex_error("BulkCopyIn: blk_drop() failed");
         return CS_FAIL;
      }
       return CS_SUCCEED;
 }

Usage


Calling blk_done during Bulk-Copy-In operations


Calling blk_done during bulk-copy-out operations

See also

blk_init, blk_rowxfer, blk_rowxfer_mult