public List<BatchResult> doFlushStatements(boolean isRollback) throws SQLException {
        try {
            if (isRollback) {
                return Collections.emptyList();
            } else {
                return executeStatements();
            }
        } finally {
            for (StatementData stmt : statementsData.values()) {
                closeStatement(stmt.getStatement());
            }
            if (!reuseBetweenFlushes) {
                for (StatementData stmt : unusedStatementData.values()) {
                    closeStatement(stmt.getStatement());
                }
            }
            lastKey = null;
            statementsData.clear();
            unusedStatementData.clear();
        }
    }