SetBulkOperation (Salesforce driver only)
- Last Updated: August 19, 2019
- 2 minute read
- DataDirect Connectors
- ODBC
- Aha! 8.0
- Amazon Redshift 8.0
- Apache Cassandra 8.0
- Apache Hive 8.0
- Apache Spark SQL 8.0
- Autonomous Rest Connector 8.0
- Cloudera Impala 7.1
- dBase 7.1
- + 24
Syntax
SQLReturn
SetBulkOperation (HDBC hdbc,
SQLULEN Operation)
The standard ODBC return codes are returned: SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_INVALID_HANDLE, SQL_NO_DATA, and SQL_ERROR.
Purpose
Specifies the bulk operation to be performed when either the LoadTableFromFile and LoadTableFromFileW method is called. The bulk operation remains set until SetBulkOperation is called again. When a connection is established, the initial bulk operation is BULK_OPERATION_INSERT.
Parameters
- hdbc
- is the driver’s connection handle, which is not the handle returned by SQLAllocHandle
or SQLAllocConnect. To obtain the driver's connection handle, the application must use
SQLGetInfo (
ODBC Conn Handle,SQL_DRIVER_HDBC). - Operation
- is an integer value that specifies the bulk operation to set on the connection. It
can have one of the following values:
- 1 - BULK_OPERATION_INSERT
- 2 - BULK_OPERATION_UPDATE
- 3- BULK_OPERATION_DELETE
- 4 - BULK_OPERATION_UPSERT
Example
HDBC hdbc;
HENV henv;
void *driverHandle;
HMODULE hmod;
PSetBulkOperation setBulkOperation;
/* Get the driver's connection handle from the DM. This handle must be used when calling directly into the driver. */
rc = SQLGetInfo (hdbc, SQL_DRIVER_HDBC, &driverHandle, 0, NULL);
if (rc != SQL_SUCCESS) {
ODBC_error (henv, hdbc, SQL_NULL_HSTMT);
EnvClose (henv, hdbc);
exit (255);
}
/* Get the DM's shared library or DLL handle to the driver. */
rc = SQLGetInfo (hdbc, SQL_DRIVER_HLIB, &hmod, 0, NULL);
if (rc != SQL_SUCCESS) {
ODBC_error (henv, hdbc, SQL_NULL_HSTMT);
EnvClose (henv, hdbc);
exit (255);
}
/* Set the Bulk Operation type to DELETE. Any subsequent call to LoadTableFromFile(W) will result in a bulk delete of the rows specified. */
setBulkOperation = (PSetBulkOperation)
resolveName (hmod, "SetBulkOperation");
if (! setBulkOperation) {
printf ("Cannot find SetBulkOperation!\n");
exit (255);
}
rc = (*setBulkOperation) (
driverHandle,
BULK_OPERATION_DELETE);
if (rc == SQL_SUCCESS) {
printf ("Set Bulk operation(DELETE) succeeded.\n");
}else {
driverError (driverHandle, hmod);
}
/* */