Save any preceding rows in Adaptive Server Enterprise.
DBINT bcp_batch(dbproc) DBPROCESS *dbproc;
A pointer to the DBPROCESS structure that provides the connection for a particular front-end/Adaptive Server Enterprise process. It contains all the information that DB-Library uses to manage communications and data between the front end and Adaptive Server Enterprise.
The number of rows saved since the last call to bcp_batch, or -1 in case of error.
When an application uses bcp_bind and bcp_sendrow to bulk-copy rows from program variables to Adaptive Server Enterprise tables, the rows are permanently saved in Adaptive Server Enterprise only when the program calls bcp_batch or bcp_done.
You may call bcp_batch once every n rows or when there is a lull between periods of incoming data (as in a telemetry application). Of course, you may choose some other criteria, or may decide not to call bcp_batch at all. If bcp_batch is not called, the rows are permanently saved in Adaptive Server Enterprise when bcp_done is called.
By default, Adaptive Server Enterprise copies all the rows specified in one batch. Adaptive Server Enterprise considers each batch to be a separate bcp operation. Each batch is copied in a single insert transaction, and if any row in the batch is rejected, the entire insert is rolled back. bcp then continues to the next batch. You can use bcp_batch to break large input files into smaller units of recoverability. For example, if 300,000 rows are bulk copied and bcp_batch is called every 100,000 rows, if there is a fatal error after row 200,000, the first two batches—200,000 rows—will have been successfully copied into Adaptive Server Enterprise.
bcp_batch actually sends two commands to the server. The first command tells the server to permanently save the rows. The second tells the server to begin a new transaction. It is possible that the command to save the rows completes successfully but the command to start a new transaction does not. In this case, bcp_batch’s error return of -1 does not indicate that the rows have not been successfully saved. To find out whether this has happened, an application can refer to the messages generated by Adaptive Server Enterprise or DB-Library/C.