/** * Adds multiple column/value pairs to the values inserted by this INSERT statement. * * @param names a list of column names to insert/update. * @param values a list of values to insert/update. The {@code i}th value in {@code values} will * be inserted for the {@code i}th column in {@code names}. * @return this INSERT statement. * @throws IllegalArgumentException if {@code names.size() != values.size()}. * @throws IllegalStateException if this method is called and the {@link #json(Object)} method has * been called before, because it's not possible to mix {@code INSERT JSON} syntax with * regular {@code INSERT} syntax. */ public Insert values(List<String> names, List<Object> values) { if (names.size() != values.size()) throw new IllegalArgumentException( String.format("Got %d names but %d values", names.size(), values.size())); checkState( json == null && jsonDefault == null, "Cannot mix INSERT JSON syntax with regular INSERT syntax"); this.names.addAll(names); this.values.addAll(values); for (int i = 0; i < names.size(); i++) { Object value = values.get(i); checkForBindMarkers(value); maybeAddRoutingKey(names.get(i), value); if (!hasNonIdempotentOps() && !Utils.isIdempotent(value)) this.setNonIdempotentOps(); } return this; }
/** * Adds a column/value pair to the values inserted by this {@code INSERT} statement. * * @param name the name of the column to insert/update. * @param value the value to insert/update for {@code name}. * @return this {@code INSERT} statement. * @throws IllegalStateException if this method is called and the {@link #json(Object)} method has * been called before, because it's not possible to mix {@code INSERT JSON} syntax with * regular {@code INSERT} syntax. */ public Insert value(String name, Object value) { checkState( json == null && jsonDefault == null, "Cannot mix INSERT JSON syntax with regular INSERT syntax"); names.add(name); values.add(value); checkForBindMarkers(value); if (!hasNonIdempotentOps() && !Utils.isIdempotent(value)) this.setNonIdempotentOps(); maybeAddRoutingKey(name, value); return this; }
/** * Adds a column/value pair to the values inserted by this INSERT statement. * * @param name the name of the column to insert/update. * @param value the value to insert/update for {@code name}. * @return this INSERT statement. */ public Insert value(String name, Object value) { names.add(name); values.add(value); checkForBindMarkers(value); maybeAddRoutingKey(name, value); return this; }
/** * Adds multiple column/value pairs to the values inserted by this INSERT statement. * * @param names a list of column names to insert/update. * @param values a list of values to insert/update. The {@code i}th * value in {@code values} will be inserted for the {@code i}th column * in {@code names}. * @return this INSERT statement. * * @throws IllegalArgumentException if {@code names.length != values.length}. */ public Insert values(String[] names, Object[] values) { if (names.length != values.length) throw new IllegalArgumentException(String.format("Got %d names but %d values", names.length, values.length)); this.names.addAll(Arrays.asList(names)); this.values.addAll(Arrays.asList(values)); for (int i = 0; i < names.length; i++) { checkForBindMarkers(values[i]); maybeAddRoutingKey(names[i], values[i]); } return this; }
/** * Adds multiple column/value pairs to the values inserted by this INSERT statement. * * @param names a list of column names to insert/update. * @param values a list of values to insert/update. The {@code i}th * value in {@code values} will be inserted for the {@code i}th column * in {@code names}. * @return this INSERT statement. * @throws IllegalArgumentException if {@code names.size() != values.size()}. * @throws IllegalStateException if this method is called and the {@link #json(Object)} * method has been called before, because it's not possible * to mix {@code INSERT JSON} syntax with regular {@code INSERT} syntax. */ public Insert values(List<String> names, List<Object> values) { if (names.size() != values.size()) throw new IllegalArgumentException(String.format("Got %d names but %d values", names.size(), values.size())); checkState(json == null, "Cannot mix INSERT JSON syntax with regular INSERT syntax"); this.names.addAll(names); this.values.addAll(values); for (int i = 0; i < names.size(); i++) { Object value = values.get(i); checkForBindMarkers(value); maybeAddRoutingKey(names.get(i), value); if (!hasNonIdempotentOps() && !Utils.isIdempotent(value)) this.setNonIdempotentOps(); } return this; }
/** * Adds multiple column/value pairs to the values inserted by this INSERT statement. * * @param names a list of column names to insert/update. * @param values a list of values to insert/update. The {@code i}th * value in {@code values} will be inserted for the {@code i}th column * in {@code names}. * @return this INSERT statement. * @throws IllegalArgumentException if {@code names.size() != values.size()}. * @throws IllegalStateException if this method is called and the {@link #json(Object)} * method has been called before, because it's not possible * to mix {@code INSERT JSON} syntax with regular {@code INSERT} syntax. */ public Insert values(List<String> names, List<Object> values) { if (names.size() != values.size()) throw new IllegalArgumentException(String.format("Got %d names but %d values", names.size(), values.size())); checkState(json == null, "Cannot mix INSERT JSON syntax with regular INSERT syntax"); this.names.addAll(names); this.values.addAll(values); for (int i = 0; i < names.size(); i++) { Object value = values.get(i); checkForBindMarkers(value); maybeAddRoutingKey(names.get(i), value); if (!hasNonIdempotentOps() && !Utils.isIdempotent(value)) this.setNonIdempotentOps(); } return this; }
/** * Adds multiple column/value pairs to the values inserted by this INSERT statement. * * @param names a list of column names to insert/update. * @param values a list of values to insert/update. The {@code i}th * value in {@code values} will be inserted for the {@code i}th column * in {@code names}. * @return this INSERT statement. * @throws IllegalArgumentException if {@code names.size() != values.size()}. * @throws IllegalStateException if this method is called and the {@link #json(Object)} * method has been called before, because it's not possible * to mix {@code INSERT JSON} syntax with regular {@code INSERT} syntax. */ public Insert values(List<String> names, List<Object> values) { if (names.size() != values.size()) throw new IllegalArgumentException(String.format("Got %d names but %d values", names.size(), values.size())); checkState(json == null, "Cannot mix INSERT JSON syntax with regular INSERT syntax"); this.names.addAll(names); this.values.addAll(values); for (int i = 0; i < names.size(); i++) { Object value = values.get(i); checkForBindMarkers(value); maybeAddRoutingKey(names.get(i), value); if (!hasNonIdempotentOps() && !Utils.isIdempotent(value)) this.setNonIdempotentOps(); } return this; }
/** * Adds a column/value pair to the values inserted by this INSERT statement. * * @param name the name of the column to insert/update. * @param value the value to insert/update for {@code name}. * @return this INSERT statement. * @throws IllegalStateException if this method is called and the {@link #json(Object)} * method has been called before, because it's not possible * to mix {@code INSERT JSON} syntax with regular {@code INSERT} syntax. */ public Insert value(String name, Object value) { checkState(json == null, "Cannot mix INSERT JSON syntax with regular INSERT syntax"); names.add(name); values.add(value); checkForBindMarkers(value); if (!hasNonIdempotentOps() && !Utils.isIdempotent(value)) this.setNonIdempotentOps(); maybeAddRoutingKey(name, value); return this; }
/** * Adds a column/value pair to the values inserted by this INSERT statement. * * @param name the name of the column to insert/update. * @param value the value to insert/update for {@code name}. * @return this INSERT statement. * @throws IllegalStateException if this method is called and the {@link #json(Object)} * method has been called before, because it's not possible * to mix {@code INSERT JSON} syntax with regular {@code INSERT} syntax. */ public Insert value(String name, Object value) { checkState(json == null, "Cannot mix INSERT JSON syntax with regular INSERT syntax"); names.add(name); values.add(value); checkForBindMarkers(value); if (!hasNonIdempotentOps() && !Utils.isIdempotent(value)) this.setNonIdempotentOps(); maybeAddRoutingKey(name, value); return this; }
/** * Adds a column/value pair to the values inserted by this INSERT statement. * * @param name the name of the column to insert/update. * @param value the value to insert/update for {@code name}. * @return this INSERT statement. * @throws IllegalStateException if this method is called and the {@link #json(Object)} * method has been called before, because it's not possible * to mix {@code INSERT JSON} syntax with regular {@code INSERT} syntax. */ public Insert value(String name, Object value) { checkState(json == null, "Cannot mix INSERT JSON syntax with regular INSERT syntax"); names.add(name); values.add(value); checkForBindMarkers(value); if (!hasNonIdempotentOps() && !Utils.isIdempotent(value)) this.setNonIdempotentOps(); maybeAddRoutingKey(name, value); return this; }