DDLBuilder.java 978 Bytes
package fi.codecrew.moya.sql;

/**
 * Make PostgreSQL DDL for table creation, etc.
 */
public class DDLBuilder {

    public CreateTableDDL createTable(String tableName) {
        return new CreateTableDDL(tableName);
    }

    public CreateTableDDL createTable(String tableName, boolean iFNotExists) {
        return new CreateTableDDL(tableName, iFNotExists);
    }

    /**
     * @param tableName
     * @param params extra params such as CASCADE or RESTRICT
     * @return
     */
    public DropTableDDL dropTable(String tableName, String... params) {
        return new DropTableDDL(tableName, params);
    }

    /**
     * @param tableName
     * @param ifExists use IF EXISTS flag to ignore error when table is not found
     * @param params extra params such as CASCADE or RESTRICT
     * @return
     */
    public DropTableDDL dropTable(String tableName, boolean ifExists, String... params) {
        return new DropTableDDL(tableName, ifExists, params);
    }

}