Package org.jooq.conf

Examples of org.jooq.conf.Settings


    public String version(SchemaDefinition schema) {
        return "" +
            DSL.using(
                new DefaultConfiguration()
                    .set(connection)
                    .set(new Settings().withStatementType(STATIC_STATEMENT))
            ).fetchValue(
                // [#2906] TODO Plain SQL statements do not yet support named parameters
                sql.replace(":schema_name", "?"), param("schema_name", schema.getInputName())
            );
    }
View Full Code Here


        settings = SettingsTools.defaultSettings();
    }

    @Test
    public void testDefaultSettings() {
        Settings settings2 = SettingsTools.defaultSettings();
        settings.setAttachRecords(false);

        // Check that the above change to the default settings has no effect
        // on the clone
        assertTrue(settings2.isAttachRecords());
        assertTrue(SettingsTools.defaultSettings().isAttachRecords());
        assertFalse(settings.isAttachRecords());
    }
View Full Code Here

        Table<?> table = new TableImpl<Record>("T", schema);

        DSLContext create0 = DSL.using(SQLDialect.POSTGRES);
        assertEquals("\"S\".\"T\"", create0.render(table));

        DSLContext create1 = DSL.using(SQLDialect.POSTGRES, new Settings().withRenderSchema(false));
        assertEquals("\"T\"", create1.render(table));

        DSLContext create2 = DSL.using(SQLDialect.POSTGRES);
        create2.configuration().settings().setRenderSchema(false);
        assertEquals("\"T\"", create2.render(table));
View Full Code Here

        assertEquals("\"T\"", create2.render(table));
    }

    @Test
    public void testRenderMapping() {
        DSLContext create1 = DSL.using(SQLDialect.POSTGRES, new Settings().withRenderMapping(mapping()));
        assertEquals("\"TABLEX\"", create1.render(TABLE1));

        DSLContext create2 = DSL.using(SQLDialect.POSTGRES);
        create2.configuration().settings().setRenderMapping(mapping());
        assertEquals("\"TABLEX\"", create2.render(TABLE1));
View Full Code Here

               );
    }

    @Test
    public void testCloneable() {
        Settings settings1 = new Settings();
        Settings settings2 = SettingsTools.clone(settings1);

        assertEquals(settings1.isAttachRecords(), settings2.isAttachRecords());
    }
View Full Code Here

    }

    @Test
    public void testGetSQLWithParamTypeINDEXED() {
        Query q =
        DSL.using(SQLDialect.MYSQL, new Settings().withParamType(INDEXED))
           .select(param("var", 1), val("A"));

        testGetSQL0(q, "select ?, ? from dual");
    }
View Full Code Here

    }

    @Test
    public void testGetSQLWithParamTypeINDEXEDandStatementTypeSTATIC() {
        Query q =
        DSL.using(SQLDialect.MYSQL, new Settings().withParamType(INDEXED)
                                                   .withStatementType(STATIC_STATEMENT))
           .select(param("var", 1), val("A"));

        testGetSQL0(q, "select 1, 'A' from dual");
    }
View Full Code Here

    }

    @Test
    public void testGetSQLWithParamTypeNAMED() {
        Query q =
        DSL.using(SQLDialect.MYSQL, new Settings().withParamType(NAMED))
           .select(param("var", 1), val("A"));

        testGetSQL0(q, "select :var, :2 from dual");
    }
View Full Code Here

    }

    @Test
    public void testGetSQLWithParamTypeNAMEDandStatementTypeSTATIC() {
        Query q =
        DSL.using(SQLDialect.MYSQL, new Settings().withParamType(NAMED)
                                                  .withStatementType(STATIC_STATEMENT))
           .select(param("var", 1), val("A"));

        testGetSQL0(q, "select 1, 'A' from dual");
    }
View Full Code Here

    }

    @Test
    public void testGetSQLWithParamTypeNAMED_OR_INLINED() {
        Query q =
        DSL.using(SQLDialect.MYSQL, new Settings().withParamType(NAMED_OR_INLINED))
           .select(param("var", 1), val("A"));

        testGetSQL0(q, "select :var, 'A' from dual");
    }
View Full Code Here

TOP

Related Classes of org.jooq.conf.Settings

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.