Ejemplo n.º 1
0
 /**
  * The token of column names.
  *
  * <p>This variant is most useful when the partition key is composite.
  *
  * @param columnNames the column names to take the token of.
  * @return a string reprensenting the token of the provided column names.
  */
 public static String token(String... columnNames) {
   StringBuilder sb = new StringBuilder();
   sb.append("token(");
   Utils.joinAndAppendNames(sb, ",", Arrays.asList(columnNames));
   sb.append(")");
   return sb.toString();
 }
Ejemplo n.º 2
0
  @Override
  protected String buildQueryString() {
    StringBuilder builder = new StringBuilder();

    builder.append("INSERT INTO ");
    if (keyspace != null) Utils.appendName(keyspace, builder).append(".");
    Utils.appendName(table, builder);
    builder.append("(");
    Utils.joinAndAppendNames(builder, ",", names);
    builder.append(") VALUES (");
    Utils.joinAndAppendValues(builder, ",", values);
    builder.append(")");

    if (!usings.usings.isEmpty()) {
      builder.append(" USING ");
      Utils.joinAndAppend(builder, " AND ", usings.usings);
    }

    return builder.toString();
  }