Java 类org.jooq.conf.RenderMapping 实例源码

项目:hmftools    文件:DatabaseAccess.java   
@Nullable
private Settings settings(final String catalog) {
    return !catalog.equals(DEV_CATALOG)
            ? new Settings().withRenderMapping(new RenderMapping().withSchemata(new MappedSchema().withInput("hmfpatients")
            .withOutput(catalog)))
            : null;
}
项目:jooq-with-liquibase    文件:App.java   
public static void main(String[] args) {
    SQLDialect sqlDialect = args.length == 0 ? SQLDialect.HSQLDB : SQLDialect.POSTGRES; // SQLDialect.ORACLE

    Settings settings = new Settings()
        .withRenderFormatted(true)
        .withRenderSchema(TRUE)
        .withRenderNameStyle(RenderNameStyle.UPPER);
    if (sqlDialect == SQLDialect.POSTGRES) {
        String schema1Name = args[0];
        String schema2Name = args[1];
        settings.withRenderMapping(new RenderMapping()
            .withSchemata(
                new MappedSchema().withInput(SCHEMA1.getName()).withOutput(schema1Name),
                new MappedSchema().withInput(SCHEMA2.getName()).withOutput(schema2Name)));
    }

    Configuration config = new DefaultConfiguration()
        .set(sqlDialect)
        .set(settings);

    Configuration configuration = config;
    DSLContext dsl = DSL.using(configuration);

    System.out.println(
        dsl.select(A.ID, A.FLAG)
            .from(A)
            .join(B).on(B.NAME.eq(A.NAME))
            .toString());
}
项目:club-tracker    文件:ConfiguredConnector.java   
@Override
public Settings getSettings() {
    if(dialect == SQLDialect.POSTGRES) {
        return new Settings().withRenderNameStyle(RenderNameStyle.LOWER);
    }
    return updateSchema(dialect).map(s ->
            new Settings()
                    .withRenderNameStyle(RenderNameStyle.LOWER)
                    .withRenderMapping(new RenderMapping()
                    .withSchemata(
                        new MappedSchema().withInput(Club.CLUB.getName())
                                .withOutput(s))))
                .orElseGet(Settings::new);
}
项目:MBaaS    文件:ConfigurationFactoryBean.java   
@Override
    public void afterPropertiesSet() throws Exception {
        com.angkorteam.mbaas.server.bean.Configuration xml = null;
        String configurationFile = this.servletContext.getInitParameter("configuration");
        File file;
        if (!Strings.isNullOrEmpty(configurationFile)) {
            file = new File(configurationFile);
        } else {
            File home = new File(java.lang.System.getProperty("user.home"));
            file = new File(home, ".xml/" + com.angkorteam.mbaas.server.bean.Configuration.KEY);
        }
        try {
            xml = new com.angkorteam.mbaas.server.bean.Configuration(file);
        } catch (ConfigurationException e) {
        }

        MappedSchema mappedSchema = new MappedSchema();
        mappedSchema.withInput(xml.getString(com.angkorteam.mbaas.server.bean.Configuration.TEMP_JDBC_DATABASE));
        String itest = java.lang.System.getProperty("itest");
        if (itest == null || "".equals(itest)) {
            mappedSchema.withOutput(xml.getString(com.angkorteam.mbaas.server.bean.Configuration.APP_JDBC_DATABASE));
        } else {
            mappedSchema.withOutput(xml.getString(com.angkorteam.mbaas.server.bean.Configuration.TEST_JDBC_DATABASE));
        }
        RenderMapping renderMapping = new RenderMapping();
        renderMapping.withSchemata(mappedSchema);
        Settings settings = new Settings();
        settings.withRenderMapping(renderMapping);
        settings.withExecuteWithOptimisticLocking(true);
        settings.setUpdatablePrimaryKeys(false);

        DefaultConfiguration configuration = new DefaultConfiguration();
        configuration.setSettings(settings);
        configuration.setDataSource(this.dataSource);
        configuration.set(SQLDialect.MYSQL);
//        if ("com.mysql.cj.jdbc.Driver".equals(dataSource.getDriverClassName())) {
//            configuration.set(SQLDialect.MYSQL);
//        } else if ("com.mysql.jdbc.Driver".equals(dataSource.getDriverClassName())) {
//            configuration.set(SQLDialect.MYSQL);
//        } else if ("org.hsqldb.jdbcDriver".equals(dataSource.getDriverClassName())) {
//            configuration.set(SQLDialect.HSQLDB);
//        } else if ("org.mariadb.jdbc.Driver".equals(dataSource.getDriverClassName())) {
//            configuration.set(SQLDialect.MARIADB);
//        }
        this.configuration = configuration;
    }
项目:dropwizard-jooq    文件:HSQLDBInit.java   
public static void initPublic(Map<String, String> properties) throws Exception {
    String url = properties.get("url");
    String username = properties.get("username");
    String password = properties.get("password");

    Properties connectionProps = new Properties();
    connectionProps.put("user", username);
    connectionProps.put("password", password);

    Class.forName("org.hsqldb.jdbc.JDBCDriver");
    Connection conn = DriverManager.getConnection(url, connectionProps);

    DSLContext jooq = DSL.using(conn);

    jooq.createTable(AUTHOR).column(AUTHOR.ID, SQLDataType.INTEGER).column(AUTHOR.NAME, SQLDataType.VARCHAR)
            .execute();

    jooq.execute("ALTER TABLE PUBLIC.author ADD PRIMARY KEY (id)");

    jooq.insertInto(AUTHOR).set(AUTHOR.ID, 1).set(AUTHOR.NAME, "Tariq").execute();

    jooq.execute("CREATE SCHEMA BUGRARA;");

    conn.commit();

    jooq = DSL.using(conn, new Settings().withRenderMapping(
            new RenderMapping().withSchemata(new MappedSchema().withInput("PUBLIC").withOutput("BUGRARA"))));

    jooq.createTable(AUTHOR).column(AUTHOR.ID, SQLDataType.INTEGER).column(AUTHOR.NAME, SQLDataType.VARCHAR)
            .execute();

    jooq.execute("ALTER TABLE BUGRARA.author ADD PRIMARY KEY (id)");

    jooq.insertInto(AUTHOR).set(AUTHOR.ID, 1).set(AUTHOR.NAME, "Narmeen").execute();

    conn.commit();

    conn.close();

}