For performing bulk insert, the OAIP_execute function gets called with the statement type DAM_INSERT_BULK.
To process the bulk insert statement:
1. Use dam_getFirstInsertRow to obtain the row that has the bulk information.
2. Navigate through the columns of the row using dam_getFirstValueSet and dam_getNextValueSet.
Use dam_getColToSet to obtain details about the column.
3. Call dam_getBulkValueToSet to obtain value buffer, buffer length, buffer size, and the number of values in the buffer.
You must save the bulk information obtained from dam_getBulkValueToSet for all the columns.
4. For each row, use the saved bulk information to retrieve the column values from the data buffer and to build the rows.
a. Retrieve the column values from the buffer by incrementing the pointer to the data buffer by the size of the value (*piValSize).
This provides you the next value in the buffer.
b. Obtain the lengths of the values by incrementing the pointer to the length buffer by 1 (p++).
This provides you the length of the next value in the buffer.
5. Insert rows to the data source and mark the row insert status using the array returned by dam_getBulkRowStatusArray.
If a row is inserted successfully, its status is marked as DAM_ROW_SUCCESS. If the row is not inserted successfully, the status is marked as DAM_ROW_ERROR.
See DataDirect OpenAccess SDK™ SQL Engine Programmer’s Reference for C/C++ for more information on methods.