ClusteringOrder(String clusteringColumnName, SchemaBuilder.Direction direction) { validateNotEmpty(clusteringColumnName, "Column name for clustering order"); this.clusteringColumnName = clusteringColumnName; this.direction = direction; }
Alter(String tableName) { validateNotEmpty(tableName, "Table name"); validateNotKeyWord( tableName, String.format( "The table name '%s' is not allowed because it is a reserved keyword", tableName)); this.tableName = tableName; }
static UDTType literal(String literal) { SchemaStatement.validateNotEmpty(literal, "UDT type literal"); return new UDTType(literal); } }
CreateIndex(String indexName) { validateNotEmpty(indexName, "Index name"); validateNotKeyWord( indexName, String.format( "The index name '%s' is not allowed because it is a reserved keyword", indexName)); this.indexName = indexName; }
static UDTType frozen(String udtName) { SchemaStatement.validateNotEmpty(udtName, "UDT name"); return new UDTType("frozen<" + udtName + ">"); }
Alter(String keyspaceName, String tableName) { validateNotEmpty(keyspaceName, "Keyspace name"); validateNotEmpty(tableName, "Table name"); validateNotKeyWord( keyspaceName, String.format( "The keyspace name '%s' is not allowed because it is a reserved keyword", keyspaceName)); validateNotKeyWord( tableName, String.format( "The table name '%s' is not allowed because it is a reserved keyword", tableName)); this.tableName = tableName; this.keyspaceName = Optional.fromNullable(keyspaceName); }
/** * Specify the table to create the index on. * * @param tableName the table name. * @return a {@link CreateIndexOn} that will allow the specification of the column. */ public CreateIndexOn onTable(String tableName) { validateNotEmpty(tableName, "Table name"); validateNotKeyWord( tableName, String.format( "The table name '%s' is not allowed because it is a reserved keyword", tableName)); this.tableName = tableName; return new CreateIndexOn(); }
/** * Add a new ADD column clause to this ALTER TABLE statement, to add a static column. * * @param columnName the name of the column to be added. * @return a new {@link Alter.AddColumn} instance. */ public AddColumn addStaticColumn(String columnName) { validateNotEmpty(columnName, "Added static column"); validateNotKeyWord( columnName, String.format( "The new static column name '%s' is not allowed because it is a reserved keyword", columnName)); return new AddColumn(this, columnName, true); }
/** * Add an ALTER column clause (to change the column type) to this ALTER TABLE statement. * * @param columnName the name of the column to be altered. * @return a new {@link Alter.AlterColumn} instance. */ public AlterColumn alterColumn(String columnName) { validateNotEmpty(columnName, "Column to be altered"); validateNotKeyWord( columnName, String.format( "The altered column name '%s' is not allowed because it is a reserved keyword", columnName)); return new AlterColumn(this, columnName); }
/** * Add a new ADD column clause to this ALTER TABLE statement. * * @param columnName the name of the column to be added. * @return a new {@link Alter.AddColumn} instance. */ public AddColumn addColumn(String columnName) { validateNotEmpty(columnName, "Added column"); validateNotKeyWord( columnName, String.format( "The new column name '%s' is not allowed because it is a reserved keyword", columnName)); return new AddColumn(this, columnName, false); }
/** * Specify the keyspace and table to create the index on. * * @param keyspaceName the keyspace name. * @param tableName the table name. * @return a {@link CreateIndexOn} that will allow the specification of the column. */ public CreateIndexOn onTable(String keyspaceName, String tableName) { validateNotEmpty(keyspaceName, "Keyspace name"); validateNotEmpty(tableName, "Table name"); validateNotKeyWord( keyspaceName, String.format( "The keyspace name '%s' is not allowed because it is a reserved keyword", keyspaceName)); validateNotKeyWord( tableName, String.format( "The table name '%s' is not allowed because it is a reserved keyword", tableName)); this.keyspaceName = Optional.fromNullable(keyspaceName); this.tableName = tableName; return new CreateIndexOn(); }
/** * Add a new RENAME column clause to this ALTER TABLE statement. * * <p>Note that you can only rename a column that is part of the primary key. * * @param columnName the name of the column to be renamed. * @return a new {@link Alter.RenameColumn} instance. */ public RenameColumn renameColumn(String columnName) { validateNotEmpty(columnName, "Column to be renamed"); validateNotKeyWord( columnName, String.format( "The renamed column name '%s' is not allowed because it is a reserved keyword", columnName)); return new RenameColumn(this, columnName); }
/** * Specify the column to create the index on. * * @param columnName the column name. * @return the final CREATE INDEX statement. */ public SchemaStatement andColumn(String columnName) { validateNotEmpty(columnName, "Column name"); validateNotKeyWord( columnName, String.format( "The column name '%s' is not allowed because it is a reserved keyword", columnName)); CreateIndex.this.columnName = columnName; return SchemaStatement.fromQueryString(buildInternal()); }
/** * Create an index on the keys of the given map column. * * @param columnName the column name. * @return the final CREATE INDEX statement. */ public SchemaStatement andKeysOfColumn(String columnName) { validateNotEmpty(columnName, "Column name"); validateNotKeyWord( columnName, String.format( "The column name '%s' is not allowed because it is a reserved keyword", columnName)); CreateIndex.this.columnName = columnName; CreateIndex.this.keys = true; return SchemaStatement.fromQueryString(buildInternal()); } }
/** * Add a new DROP column clause to this ALTER TABLE statement. * * <p>Note that you cannot drop a column that is part of the primary key. * * @param columnName the name of the column to be dropped. * @return the final ALTER TABLE DROP COLUMN statement. */ public SchemaStatement dropColumn(String columnName) { validateNotEmpty(columnName, "Column to be dropped"); validateNotKeyWord( columnName, String.format( "The dropped column name '%s' is not allowed because it is a reserved keyword", columnName)); return SchemaStatement.fromQueryString(buildInternal() + " DROP " + columnName); }
/** * Define the new name of the column. * * @param newColumnName the new name of the column. * @return the final statement. */ public SchemaStatement to(String newColumnName) { validateNotEmpty(newColumnName, "New column name"); validateNotKeyWord( newColumnName, String.format( "The new column name '%s' is not allowed because it is a reserved keyword", newColumnName)); return SchemaStatement.fromQueryString( alter.buildInternal() + " RENAME " + columnName + " TO " + newColumnName); } }
CreateIndex(String indexName) { validateNotEmpty(indexName, "Index name"); validateNotKeyWord(indexName, String.format("The index name '%s' is not allowed because it is a reserved keyword", indexName)); this.indexName = indexName; }
CreateIndex(String indexName) { validateNotEmpty(indexName, "Index name"); validateNotKeyWord(indexName, String.format("The index name '%s' is not allowed because it is a reserved keyword", indexName)); this.indexName = indexName; }
Alter(String keyspaceName, String tableName) { validateNotEmpty(keyspaceName, "Keyspace name"); validateNotEmpty(tableName, "Table name"); validateNotKeyWord(keyspaceName, String.format("The keyspace name '%s' is not allowed because it is a reserved keyword", keyspaceName)); validateNotKeyWord(tableName, String.format("The table name '%s' is not allowed because it is a reserved keyword", tableName)); this.tableName = tableName; this.keyspaceName = Optional.fromNullable(keyspaceName); }
/** * Specify the table to create the index on. * * @param tableName the table name. * @return a {@link CreateIndexOn} that will allow the specification of the column. */ public CreateIndexOn onTable(String tableName) { validateNotEmpty(tableName, "Table name"); validateNotKeyWord(tableName, String.format("The table name '%s' is not allowed because it is a reserved keyword", tableName)); this.tableName = tableName; return new CreateIndexOn(); }