Search in sources :

Example 1 with CreateSchema

use of org.h2.command.ddl.CreateSchema in project java-design-patterns by iluwatar.

the class App method main.

/**
 * Program entry point.
 *
 * @param args command line args.
 * @throws Exception if any error occurs.
 */
public static void main(final String[] args) throws Exception {
    final CustomerDao inMemoryDao = new InMemoryCustomerDao();
    performOperationsUsing(inMemoryDao);
    final DataSource dataSource = createDataSource();
    createSchema(dataSource);
    final CustomerDao dbDao = new DbCustomerDao(dataSource);
    performOperationsUsing(dbDao);
    deleteSchema(dataSource);
}
Also used : DataSource(javax.sql.DataSource) JdbcDataSource(org.h2.jdbcx.JdbcDataSource)

Example 2 with CreateSchema

use of org.h2.command.ddl.CreateSchema in project h2database by h2database.

the class Parser method parseCreateSchema.

private CreateSchema parseCreateSchema() {
    CreateSchema command = new CreateSchema(session);
    command.setIfNotExists(readIfNotExists());
    command.setSchemaName(readUniqueIdentifier());
    if (readIf("AUTHORIZATION")) {
        command.setAuthorization(readUniqueIdentifier());
    } else {
        command.setAuthorization(session.getUser().getName());
    }
    if (readIf("WITH")) {
        command.setTableEngineParams(readTableEngineParams());
    }
    return command;
}
Also used : CreateSchema(org.h2.command.ddl.CreateSchema)

Aggregations

DataSource (javax.sql.DataSource)1 CreateSchema (org.h2.command.ddl.CreateSchema)1 JdbcDataSource (org.h2.jdbcx.JdbcDataSource)1