4D v16

ODBC_SQLBulkOperations

Home

 
4D v16
ODBC_SQLBulkOperations

ODBC_SQLBulkOperations 


 

ODBC_SQLBulkOperations ( stmtID ; operation ) -> Function result 
Parameter Type   Description
stmtID  Longint in Statement ID
operation  Longint in Operation to perform
Function result  Longint in Returns the result of the MS ODBC API function SQLBulkOperations

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:

ConstantValue
SQL_ADD4
SQL_UPDATE_BY_BOOKMARK5
SQL_DELETE_BY_BOOKMARK6
SQL_FETCH_BY_BOOKMARK7


For more information, please see the SQLBulkOperations function in the MS ODBC API Reference at http://msdn.microsoft.com/en-us/library/ms712471(VS.85).aspx.

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 &NBSP` 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") &NBSP`Define which table
 $result:=ODBC_SQLExecute($statementID)
 $result:=ODBC_SQLBindCol($statementID;1;->arID) &NBSP`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) &NBSP`SQL_ADD
 
 $result:=ODBC_SQLRowCount($statementID;vRowCount)



See also 

ODBC_SQLBindCol
ODBC_SQLRowCount
ODBC_SQLSetStmtAttr

 
PROPERTIES 

Product: 4D
Theme: ODBC_Results
Number: 16963

 
HISTORY 

Created: 4D ODBC Pro 2004

 
ARTICLE USAGE

4D ODBC Pro ( 4D v16)