Beispiel #1
0
 /**
  * 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;
 }
Beispiel #2
0
 /**
  * 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;
 }
Beispiel #3
0
 public CreateTableClause(Connection conn, SQLTemplates templates, String table) {
   this.connection = conn;
   this.templates = templates;
   this.table = templates.quoteIdentifier(table);
 }
Beispiel #4
0
 /**
  * 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);
 }