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

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

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

Insert.setNonIdempotentOps介绍

暂无

代码示例

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

/**
 * Sets the 'IF NOT EXISTS' option for this {@code INSERT} statement.
 *
 * <p>An insert with that option will not succeed unless the row does not exist at the time the
 * insertion is executed. The existence check and insertions are done transactionally in the sense
 * that if multiple clients attempt to create a given row with this option, then at most one may
 * succeed.
 *
 * <p>Please keep in mind that using this option has a non negligible performance impact and
 * should be avoided when possible.
 *
 * <p>This will configure the statement as non-idempotent, see {@link
 * com.datastax.driver.core.Statement#isIdempotent()} for more information.
 *
 * @return this {@code INSERT} statement.
 */
public Insert ifNotExists() {
 this.setNonIdempotentOps();
 this.ifNotExists = true;
 return this;
}

代码示例来源: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.yugabyte/cassandra-driver-core

/**
 * Sets the 'IF NOT EXISTS' option for this INSERT statement.
 * <p/>
 * An insert with that option will not succeed unless the row does not
 * exist at the time the insertion is executed. The existence check and
 * insertions are done transactionally in the sense that if multiple
 * clients attempt to create a given row with this option, then at most one
 * may succeed.
 * <p/>
 * Please keep in mind that using this option has a non negligible
 * performance impact and should be avoided when possible.
 * <p/>
 * This will configure the statement as non-idempotent, see {@link com.datastax.driver.core.Statement#isIdempotent()}
 * for more information.
 *
 * @return this INSERT statement.
 */
public Insert ifNotExists() {
  this.setNonIdempotentOps();
  this.ifNotExists = true;
  return this;
}

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

/**
 * Sets the 'IF NOT EXISTS' option for this INSERT statement.
 * <p/>
 * An insert with that option will not succeed unless the row does not
 * exist at the time the insertion is executed. The existence check and
 * insertions are done transactionally in the sense that if multiple
 * clients attempt to create a given row with this option, then at most one
 * may succeed.
 * <p/>
 * Please keep in mind that using this option has a non negligible
 * performance impact and should be avoided when possible.
 * <p/>
 * This will configure the statement as non-idempotent, see {@link com.datastax.driver.core.Statement#isIdempotent()}
 * for more information.
 *
 * @return this INSERT statement.
 */
public Insert ifNotExists() {
  this.setNonIdempotentOps();
  this.ifNotExists = true;
  return this;
}

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

/**
 * Sets the 'IF NOT EXISTS' option for this INSERT statement.
 * <p/>
 * An insert with that option will not succeed unless the row does not
 * exist at the time the insertion is executed. The existence check and
 * insertions are done transactionally in the sense that if multiple
 * clients attempt to create a given row with this option, then at most one
 * may succeed.
 * <p/>
 * Please keep in mind that using this option has a non negligible
 * performance impact and should be avoided when possible.
 * <p/>
 * This will configure the statement as non-idempotent, see {@link com.datastax.driver.core.Statement#isIdempotent()}
 * for more information.
 *
 * @return this INSERT statement.
 */
public Insert ifNotExists() {
  this.setNonIdempotentOps();
  this.ifNotExists = true;
  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;
}

相关文章