/** * Adds a new statement to this batch. * * @param statement the new statement to add. * @return this batch. * @throws IllegalArgumentException if counter and non-counter operations are mixed. */ public Batch add(RegularStatement statement) { boolean isCounterOp = statement instanceof BuiltStatement && ((BuiltStatement) statement).isCounterOp(); if (this.isCounterOp == null) setCounterOp(isCounterOp); else if (isCounterOp() != isCounterOp) throw new IllegalArgumentException( "Cannot mix counter operations and non-counter operations in a batch statement"); this.statements.add(statement); if (statement instanceof BuiltStatement) { this.hasBindMarkers |= ((BuiltStatement) statement).hasBindMarkers; } else { // For non-BuiltStatement, we cannot know if it includes a bind makers and we assume it does. // In practice, // this means we will always serialize values as strings when there is non-BuiltStatement this.hasBindMarkers = true; this.nonBuiltStatementValues += ((SimpleStatement) statement).valuesCount(); } setDirty(); return this; }
/** * Adds a new statement to this batch. * * @param statement the new statement to add. * @return this batch. * @throws IllegalArgumentException if counter and non-counter operations * are mixed. */ public Batch add(RegularStatement statement) { boolean isCounterOp = statement instanceof BuiltStatement && ((BuiltStatement) statement).isCounterOp(); if (this.isCounterOp == null) setCounterOp(isCounterOp); else if (isCounterOp() != isCounterOp) throw new IllegalArgumentException("Cannot mix counter operations and non-counter operations in a batch statement"); this.statements.add(statement); if (statement instanceof BuiltStatement) { this.hasBindMarkers |= ((BuiltStatement) statement).hasBindMarkers; } else { // For non-BuiltStatement, we cannot know if it includes a bind makers and we assume it does. In practice, // this means we will always serialize values as strings when there is non-BuiltStatement this.hasBindMarkers = true; this.nonBuiltStatementValues += ((SimpleStatement) statement).valuesCount(); } setDirty(); return this; }
/** * Adds a new statement to this batch. * * @param statement the new statement to add. * @return this batch. * @throws IllegalArgumentException if counter and non-counter operations * are mixed. */ public Batch add(RegularStatement statement) { boolean isCounterOp = statement instanceof BuiltStatement && ((BuiltStatement) statement).isCounterOp(); if (this.isCounterOp == null) setCounterOp(isCounterOp); else if (isCounterOp() != isCounterOp) throw new IllegalArgumentException("Cannot mix counter operations and non-counter operations in a batch statement"); this.statements.add(statement); if (statement instanceof BuiltStatement) { this.hasBindMarkers |= ((BuiltStatement) statement).hasBindMarkers; } else { // For non-BuiltStatement, we cannot know if it includes a bind makers and we assume it does. In practice, // this means we will always serialize values as strings when there is non-BuiltStatement this.hasBindMarkers = true; this.nonBuiltStatementValues += ((SimpleStatement) statement).valuesCount(); } setDirty(); return this; }
/** * Adds a new statement to this batch. * * @param statement the new statement to add. * @return this batch. * @throws IllegalArgumentException if counter and non-counter operations * are mixed. */ public Batch add(RegularStatement statement) { boolean isCounterOp = statement instanceof BuiltStatement && ((BuiltStatement) statement).isCounterOp(); if (this.isCounterOp == null) setCounterOp(isCounterOp); else if (isCounterOp() != isCounterOp) throw new IllegalArgumentException("Cannot mix counter operations and non-counter operations in a batch statement"); this.statements.add(statement); if (statement instanceof BuiltStatement) { this.hasBindMarkers |= ((BuiltStatement) statement).hasBindMarkers; } else { // For non-BuiltStatement, we cannot know if it includes a bind makers and we assume it does. In practice, // this means we will always serialize values as strings when there is non-BuiltStatement this.hasBindMarkers = true; this.nonBuiltStatementValues += ((SimpleStatement) statement).valuesCount(); } setDirty(); return this; }