version 2004
ODBC_SQLBulkOperations (stmtID; operation) Longint
| Parameter | Type | Description | |
| stmtID | Longint | Statement ID | |
| operation | Longint | Operation to perform | |
| Function result | Longint | Returns the result of the MS ODBC API function | |
| SQLBulkOperations |
Description
The ODBC_SQLBulkOperations command performs bulk insertions and bulk bookmark operations, including update, delete, and fetch by bookmark.
stmtID is a valid statement ID returned by ODBC_SQLAllocStmt.
The operation to perform are the following:
| Constant | Value |
| SQL_ADD | 4 |
| SQL_UPDATE_BY_BOOKMARK | 5 |
| SQL_DELETE_BY_BOOKMARK | 6 |
| SQL_FETCH_BY_BOOKMARK | 7 |
For more information, please see the SQLBulkOperations function in the MS ODBC API at http://msdn.microsoft.com/library/en-us/odbc/htm/odbcsqlbulkoperations.asp.
Function Results
SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_NEED_DATA, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.
Example
The following method adds three rows from data in two arrays (arID and arEmployeeName) into the Employee table:
vattrVal:=SQL_CONCUR_ROWVER
$result:=ODBC_SQLSetStmtAttr ($statementID;SQL_ATTR_CONCURRENCY ;->vattrVal)
vattrVal:=SQL_CURSOR_KEYSET_DRIVEN
$result:=ODBC_SQLSetStmtAttr ($statementID;SQL_ATTR_CURSOR_TYPE ;->vattrVal)
vattrVal:=3 ` Size of the arrays that contain our values below
$result:=ODBC_SQLSetStmtAttr ($statementID;SQL_ATTR_ROW_ARRAY_SIZE ;->vattrVal)
$result:=ODBC_SQLSetStmtAttr ($statementID;SQL_ATTR_ROW_STATUS_PTR;->arStatus;vIndic)
vattrVal:=SQL_UB_VARIABLE
$result:=ODBC_SQLSetStmtAttr ($statementID;SQL_USE_BOOKMARKS ;->vattrVal)
`Use variable length bookmark
$result:=ODBC_SQLPrepare ($statementID;"SELECT * FROM Employee") `Define which table
$result:=ODBC_SQLExecute ($statementID)
$result:=ODBC_SQLBindCol ($statementID;1;->arID) `Bind the columns to arrays
$result:=ODBC_SQLBindCol ($statementID;2;->arEmployeeName)
arID{1}:=1006
arID{2}:=1007
arID{3}:=1008
arEmployeeName{1}:="John Smith"
arEmployeeName{2}:="Betty Jones"
arEmployeeName{3}:="Sally Peters"
$result:=ODBC_SQLBulkOperations ($statementID;4) `SQL_ADD
$result:=ODBC_SQLRowCount ($statementID;vRowCount)
See Also
ODBC_SQLBindCol, ODBC_SQLRowCount, ODBC_SQLSetStmtAttr.