/** * Set the primary key * * @param name * @param columns * @return */ public CreateTableClause primaryKey(String name, String... columns) { for (int i = 0; i < columns.length; i++) { columns[i] = templates.quoteIdentifier(columns[i]); } primaryKey = new PrimaryKeyData(templates.quoteIdentifier(name), columns); return this; }
/** * Add a new column definition * * @param name * @param type * @return */ public CreateTableClause column(String name, Class<?> type) { columns.add(new ColumnData(templates.quoteIdentifier(name), templates.getTypeForClass(type))); return this; }
public CreateTableClause(Connection conn, SQLTemplates templates, String table) { this.connection = conn; this.templates = templates; this.table = templates.quoteIdentifier(table); }
/** * Add a foreign key * * @param name * @param columns * @return */ public ForeignKeyBuilder foreignKey(String name, String... columns) { return new ForeignKeyBuilder( this, templates, foreignKeys, templates.quoteIdentifier(name), columns); }