Package org.jooq

Examples of org.jooq.DSLContext.select()


    @Test
    public void testArrays() {
        DSLContext e = DSL.using(new MockConnection(new ArrayResult(3)), SQLDialect.POSTGRES);

        Result<Record2<String[], Integer[]>> r = e.select(strings, integers).fetch();
        assertEquals(4, r.size());
        assertEquals(2, r.fields().length);
        assertNull(r.getValue(0, "STRINGS"));
        assertNull(r.getValue(0, "INTEGERS"));
        assertArrayEquals(new String[0], (String[]) r.getValue(1, "STRINGS"));
View Full Code Here


    @Test
    public void testJDBCArrays() throws SQLException {
        DSLContext e = DSL.using(new MockConnection(new ArrayResult(3)), SQLDialect.POSTGRES);

        ResultSet r = e.select(strings, integers).fetchResultSet();
        assertEquals(2, r.getMetaData().getColumnCount());

        assertTrue(r.next());
        assertNull(r.getArray("STRINGS"));
        assertNull(r.getArray("INTEGERS"));
View Full Code Here

                    ctx.rows(result);
                    listener.executeEnd(ctx);

                    DSLContext create = DSL.using(ctx.configuration());
                    returned =
                    create.select(returning)
                          .from(getInto())
                          .where(rowid().equal(rowid().getDataType().convert(create.lastID())))
                          .fetchInto(getInto());

                    return result;
View Full Code Here

    public void run() {
        DSLContext dsl = DSL.using(connection());

        Tools.title("CONCAT() function with prefix notation");
        Tools.print(
            dsl.select(concat(AUTHOR.FIRST_NAME, val(" "), AUTHOR.LAST_NAME))
               .from(AUTHOR)
               .orderBy(AUTHOR.ID)
               .fetch()
        );
View Full Code Here

               .fetch()
        );

        Tools.title("CONCAT() function with infix notation");
        Tools.print(
            dsl.select(AUTHOR.FIRST_NAME.concat(" ").concat(AUTHOR.LAST_NAME))
               .from(AUTHOR)
               .orderBy(AUTHOR.ID)
               .fetch()
        );
View Full Code Here

                   .execute()
            );
            */
            Tools.title("Check if our latest record was really created");
            Tools.print(
                dsl.select()
                   .from(AUTHOR)
                   .where(AUTHOR.ID.eq(3))
                   .fetch()
            );

View Full Code Here

                   .execute()
            );

            Tools.title("Check if our latest record was really updated");
            Tools.print(
                dsl.select()
                   .from(AUTHOR)
                   .where(AUTHOR.ID.eq(3))
                   .fetch()
            );
View Full Code Here

                   .execute()
            );

            Tools.title("Check if the record was really deleted");
            Tools.print(
                dsl.select()
                   .from(AUTHOR)
                   .fetch()
            );
        }
View Full Code Here

    public void run() {
        DSLContext dsl = DSL.using(connection());

        Tools.title("Combine predicates using AND");
        Tools.print(
            dsl.select()
               .from(BOOK)
               .where(BOOK.TITLE.like("%a%").and(BOOK.AUTHOR_ID.eq(1)))
               .fetch()
        );
View Full Code Here

        );
        */

        Tools.title("Use an IN-predicate");
        Tools.print(
            dsl.select()
               .from(AUTHOR)
               .where(AUTHOR.ID.in(select(BOOK.AUTHOR_ID).from(BOOK)))
               .fetch()
        );

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.