4D v16

ODBC_SQLBulkOperations

Página Inicial

 
4D v16
ODBC_SQLBulkOperations

ODBC_SQLBulkOperations 


 

ODBC_SQLBulkOperations ( stmtID ; operaçao ) -> Resultado 
Parâmetro Tipo   Descrição
stmtID  Inteiro longo in Statement ID
operaçao  Inteiro longo in Operation to perform
Resultado  Inteiro longo 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.

Exemplo  

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)



Ver também 

ODBC_SQLBindCol
ODBC_SQLRowCount
ODBC_SQLSetStmtAttr

 
PROPRIEDADES 

Produto: 4D
Tema: ODBC_Results
Número 16963

 
HISTÓRIA 

Criado por: 4D ODBC Pro 2004

 
ARTICLE USAGE

4D ODBC Pro ( 4D v16)