DuckDBBatchResult
com.softinio.duck4s.algebra.DuckDBBatchResult
Result of executing a batch operation, containing update counts and statistics.
This class encapsulates the results of executing a batch operation, providing both detailed update counts for each operation in the batch and summary statistics about successes and failures.
Value parameters
- failureCount
-
the number of operations that failed
- successCount
-
the number of operations that completed successfully
- updateCounts
-
array of update counts for each operation in the batch. Non-negative values indicate the number of rows affected by that operation. Negative values indicate failures.
Attributes
- See also
-
DuckDBBatch.executeBatch for executing batch operations
DuckDBBatch for batch operation management
- Since
-
0.1.0
- Example
-
val result = for { batch <- Right(DuckDBBatch(stmt)) _ <- batch.addBatch(("Alice", 25), ("Bob", 30), ("Charlie", 35)) result <- batch.executeBatch() } yield result result match { case Right(batchResult) => println(s"Total operations: ${batchResult.updateCounts.length}") println(s"Successful: ${batchResult.successCount}") println(s"Failed: ${batchResult.failureCount}") // Check individual operation results batchResult.updateCounts.zipWithIndex.foreach { case (count, index) => if (count >= 0) { println(s"Operation $index: $count rows affected") } else { println(s"Operation $index: failed") } } // Check if all operations succeeded if (batchResult.isAllSuccessful) { println("All operations completed successfully!") } case Left(error) => println(s"Batch execution failed: $error") }
- Graph
-
- Supertypes
Members list
In this article