Examples of DSLContext


Examples of org.jooq.DSLContext

            }
        }
    }

    private final int executeSelectFrom() {
        DSLContext create = create(configuration);
        Result<?> result = create.selectFrom(table(asField())).fetch();
        outValues.put(returnParameter, result);
        return 0;
    }
View Full Code Here

Examples of org.jooq.DSLContext

public class Example_1_4_Predicates {

    @Test
    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()
        );

        /*
        Tools.title("Wrong types in comparison predicate");
        Tools.print(
            dsl.select()
               .from(BOOK)
               .where(BOOK.ID.eq("abc"))
               .fetch()
        );
        */

        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

Examples of org.jooq.DSLContext

        formatInsert(new OutputStreamWriter(stream), table, f);
    }

    @Override
    public final void formatInsert(Writer writer, Table<?> table, Field<?>... f) {
        DSLContext ctx = DSL.using(configuration());

        try {
            for (R record : this) {
                writer.append(ctx.renderInlined(insertInto(table, f).values(record.intoArray())));
                writer.append(";\n");
            }
        }
        catch (java.io.IOException e) {
            throw new IOException("Exception while writing INSERTs", e);
View Full Code Here

Examples of org.jooq.DSLContext

  public DSLContext get() {
    if (!isWorking()) {
      begin();
    }

    DSLContext factory = threadFactory.get();
    Preconditions.checkState(null != factory, "Requested Factory outside work unit. "
        + "Try calling UnitOfWork.begin() first, or use a PersistFilter if you "
        + "are inside a servlet environment.");

    return factory;
View Full Code Here

Examples of org.jooq.DSLContext

      conn = new DefaultConnectionProvider(jdbcSource.getConnection());
    } catch (SQLException e) {
      throw new RuntimeException(e);
    }
   
    DSLContext jooqFactory;
    if (jooqSettings == null) {
      jooqFactory = DSL.using(conn, sqlDialect);
    } else {
      jooqFactory = DSL.using(conn, sqlDialect, jooqSettings);
    }
View Full Code Here

Examples of org.jooq.DSLContext

    threadConnection.set(conn);
    threadFactory.set(jooqFactory);
  }

  public void end() {
    DSLContext jooqFactory = threadFactory.get();
    DefaultConnectionProvider conn = threadConnection.get();
    // Let's not penalize users for calling end() multiple times.
    if (null == jooqFactory) {
      return;
    }
View Full Code Here

Examples of org.jooq.DSLContext

    {
        ResultQuery q;

        public void init()
        {
            DSLContext create;
            try {
                create = DSL.using(DriverManager.getConnection(DB_URL, DB_USER, DB_PASSWORD), JOOQ_DIALECT);
            } catch (SQLException e) {
                throw new RuntimeException("Error initializing jOOQ DSLContext", e);
            }

            q = create.select()
                      .from("post")
                      .where("id = ?", -1) // param needs an initial value, else future calls the bind() will fail.
                      .keepStatement(true);
        }
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.