com.datastax.driver.core.querybuilder.Insert.maybeAddRoutingKey()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(91)

本文整理了Java中com.datastax.driver.core.querybuilder.Insert.maybeAddRoutingKey()方法的一些代码示例,展示了Insert.maybeAddRoutingKey()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Insert.maybeAddRoutingKey()方法的具体详情如下:
包路径:com.datastax.driver.core.querybuilder.Insert
类名称:Insert
方法名:maybeAddRoutingKey

Insert.maybeAddRoutingKey介绍

暂无

代码示例

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

/**
 * 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;
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

/**
 * 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;
}

代码示例来源:origin: com.stratio.cassandra/cassandra-driver-core

/**
 * 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;
}

代码示例来源:origin: com.stratio.cassandra/cassandra-driver-core

/**
 * 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;
}

代码示例来源:origin: com.yugabyte/cassandra-driver-core

/**
 * 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;
}

代码示例来源:origin: io.prestosql.cassandra/cassandra-driver

/**
 * 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;
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver

/**
 * 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;
}

代码示例来源:origin: com.yugabyte/cassandra-driver-core

/**
 * 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;
}

代码示例来源:origin: io.prestosql.cassandra/cassandra-driver

/**
 * 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;
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver

/**
 * 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;
}

相关文章