IStatement.ExecuteBatch Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts.
[Android.Runtime.Register("executeBatch", "()[I", "GetExecuteBatchHandler:Java.Sql.IStatementInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public int[]? ExecuteBatch ();
[<Android.Runtime.Register("executeBatch", "()[I", "GetExecuteBatchHandler:Java.Sql.IStatementInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member ExecuteBatch : unit -> int[]
Returns
an array of update counts containing one element for each command in the batch. The elements of the array are ordered according to the order in which commands were added to the batch.
- Attributes
Exceptions
if an error occurs accessing the database.
Remarks
Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts. The int
elements of the array that is returned are ordered to correspond to the commands in the batch, which are ordered according to the order in which they were added to the batch. The elements in the array returned by the method executeBatch
may be one of the following: <OL> <LI>A number greater than or equal to zero -- indicates that the command was processed successfully and is an update count giving the number of rows in the database that were affected by the command's execution <LI>A value of SUCCESS_NO_INFO
-- indicates that the command was processed successfully but that the number of rows affected is unknown
If one of the commands in a batch update fails to execute properly, this method throws a BatchUpdateException
, and a JDBC driver may or may not continue to process the remaining commands in the batch. However, the driver's behavior must be consistent with a particular DBMS, either always continuing to process commands or never continuing to process commands. If the driver continues processing after a failure, the array returned by the method BatchUpdateException.getUpdateCounts
will contain as many elements as there are commands in the batch, and at least one of the elements will be the following:
<LI>A value of EXECUTE_FAILED
-- indicates that the command failed to execute successfully and occurs only if a driver continues to process commands after a command fails </OL>
The possible implementations and return values have been modified in the Java 2 SDK, Standard Edition, version 1.3 to accommodate the option of continuing to proccess commands in a batch update after a BatchUpdateException
obejct has been thrown.
Added in 1.2.
Java documentation for java.sql.Statement.executeBatch()
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.