open class BatchSqlUpdate : SqlUpdate
SqlUpdate subclass that performs batch update operations. Encapsulates queuing up records to be updated, and adds them as a single batch once flush is called or the given batch size has been met.
Note that this class is a non-thread-safe object, in contrast to all other JDBC operations objects in this package. You need to create a new instance of it for each use, or call reset before reuse within the same thread.
Author
Keith Donald
Author
Juergen Hoeller
Since
1.1
BatchSqlUpdate()
Constructor to allow use as a JavaBean. DataSource and SQL must be supplied before compilation and use. BatchSqlUpdate(ds: DataSource, sql: String)
Construct an update object with a given DataSource and SQL. BatchSqlUpdate(ds: DataSource, sql: String, types: IntArray)
Construct an update object with a given DataSource, SQL and anonymous parameters. BatchSqlUpdate(ds: DataSource, sql: String, types: IntArray, batchSize: Int)
Construct an update object with a given DataSource, SQL, anonymous parameters and specifying the maximum number of rows that may be affected. |
static var DEFAULT_BATCH_SIZE: Int
Default number of inserts to accumulate before commiting a batch (5000). |
open fun flush(): IntArray
Trigger any queued update operations to be added as a final batch. |
|
open fun getExecutionCount(): Int
Return the number of already executed statements. |
|
open fun getQueueCount(): Int
Return the current number of statements or statement parameters in the queue. |
|
open fun getRowsAffected(): IntArray
Return the number of affected rows for all already executed statements. Accumulates all of |
|
open fun reset(): Unit
Reset the statement parameter queue, the rows affected cache, and the execution count. |
|
open fun setBatchSize(batchSize: Int): Unit
Set the number of statements that will trigger an automatic intermediate flush. You can also flush already queued statements with an explicit |
|
open fun setTrackRowsAffected(trackRowsAffected: Boolean): Unit
Set whether to track the rows affected by batch updates performed by this operation object. Default is "true". Turn this off to save the memory needed for the list of row counts. |
|
open fun update(vararg params: Any): Int
Overridden version of You need to call |