Search in sources :

Example 11 with DMLResult

use of herddb.client.DMLResult in project herddb by diennea.

the class HerdDBPreparedStatement method executeBatch.

@Override
public int[] executeBatch() throws SQLException {
    try {
        int[] results = new int[batch.size()];
        int i = 0;
        lastUpdateCount = 0;
        parent.discoverTableSpace(sql);
        List<DMLResult> dmlresults = parent.getConnection().executeUpdates(parent.getTableSpace(), sql, parent.ensureTransaction(), false, true, this.batch);
        for (DMLResult dmlresult : dmlresults) {
            results[i++] = (int) dmlresult.updateCount;
            parent.bindToTransaction(dmlresult.transactionId);
            lastUpdateCount += dmlresult.updateCount;
            lastKey = dmlresult.key;
        }
        return results;
    } catch (ClientSideMetadataProviderException | HDBException err) {
        throw SQLExceptionUtils.wrapException(err);
    } finally {
        batch.clear();
    }
}
Also used : DMLResult(herddb.client.DMLResult) ClientSideMetadataProviderException(herddb.client.ClientSideMetadataProviderException) HDBException(herddb.client.HDBException)

Aggregations

DMLResult (herddb.client.DMLResult)11 Map (java.util.Map)6 ClientConfiguration (herddb.client.ClientConfiguration)5 GetResult (herddb.client.GetResult)5 HDBClient (herddb.client.HDBClient)5 HDBConnection (herddb.client.HDBConnection)5 HDBException (herddb.client.HDBException)5 Path (java.nio.file.Path)5 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)5 RawString (herddb.utils.RawString)4 ArrayList (java.util.ArrayList)4 AtomicLong (java.util.concurrent.atomic.AtomicLong)4 ClientSideMetadataProviderException (herddb.client.ClientSideMetadataProviderException)3 ScanResultSet (herddb.client.ScanResultSet)3 TableManagerStats (herddb.core.stats.TableManagerStats)3 SQLException (java.sql.SQLException)3 DDLStatementExecutionResult (herddb.model.DDLStatementExecutionResult)2 DMLStatementExecutionResult (herddb.model.DMLStatementExecutionResult)2 DuplicatePrimaryKeyException (herddb.model.DuplicatePrimaryKeyException)2 Record (herddb.model.Record)2