Deallocates a CS_BLKDESC structure.
CS_RETCODE blk_drop(blkdesc) CS_BLKDESC *blkdesc;
A pointer to a CS_BLKDESC previously allocated through blk_alloc.
blk_drop returns:
Returns |
Indicates |
---|---|
CS_SUCCEED |
The routine completed successfully. |
CS_FAIL |
The routine failed. |
/*
** 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;
}
A CS_BLKDESC structure, also called a bulk-descriptor structure, contains information about a particular bulk-copy operation.
Once a bulk-descriptor structure has been deallocated, it cannot be used again. To allocate a new CS_BLKDESC, an application can call blk_alloc.
blk_drop is typically called after blk_done. It must be the last routine called in a bulk-copy operation.