Package org.jooq

Examples of org.jooq.Configuration


        }

        void run(Transactional tx) {
            // Initialise some jOOQ objects
            final DefaultConnectionProvider c = new DefaultConnectionProvider(connection);
            final Configuration configuration = new DefaultConfiguration().set(c).set(SQLDialect.H2);

            try {
                // Run the transaction and pass a jOOQ
                // DSLContext object to it
                tx.run(DSL.using(configuration));
View Full Code Here


            if (table != null) {
                Schema schema = table.getSchema();

                if (schema != null) {
                    Configuration configuration = ((AttachableInternal) rs.result).configuration();
                    Schema mapped = null;

                    if (configuration != null) {
                        mapped = DSL.using(configuration).map(schema);
                    }
View Full Code Here

        this.rows = rows;
        this.data = data;
    }

    private static final Result<?> result(Record data) {
        Configuration configuration = data instanceof AttachableInternal
            ? ((AttachableInternal) data).configuration()
            : new DefaultConfiguration();

        Result<Record> result = using(configuration).newResult(data.fields());
        result.add(data);
View Full Code Here

    private final int[] executePrepared() {
        Map<String, List<Query>> queries = new LinkedHashMap<String, List<Query>>();
        QueryCollector collector = new QueryCollector();

        // Add the QueryCollector to intercept query execution after rendering
        Configuration local = configuration.derive(Utils.combine(
            configuration.executeListenerProviders(),
            new DefaultExecuteListenerProvider(collector)
        ));

        // [#1537] Communicate with UpdatableRecordImpl
        local.data(Utils.DATA_OMIT_RETURNING_CLAUSE, true);

        // [#1529] Avoid DEBUG logging of single INSERT / UPDATE statements
        local.settings().setExecuteLogging(false);

        for (int i = 0; i < records.length; i++) {
            Configuration previous = ((AttachableInternal) records[i]).configuration();

            try {
                records[i].attach(local);
                executeAction(i);
            }
View Full Code Here

    private final int[] executeStatic() {
        List<Query> queries = new ArrayList<Query>();
        QueryCollector collector = new QueryCollector();

        Configuration local = configuration.derive(Utils.combine(
            configuration.executeListenerProviders(),
            new DefaultExecuteListenerProvider(collector)
        ));

        for (int i = 0; i < records.length; i++) {
            Configuration previous = ((AttachableInternal) records[i]).configuration();

            try {
                records[i].attach(local);
                executeAction(i);
            }
View Full Code Here

    public final Clause[] clauses(Context<?> ctx) {
        return delegate(ctx).clauses(ctx);
    }

    private final QueryPartInternal delegate(Context<?> ctx) {
        final Configuration configuration = ctx.configuration();
        final RenderContext render = ctx instanceof RenderContext ? (RenderContext) ctx : null;

        SQLDialect family = configuration.dialect().family();

        // [#3505] TODO: Emulate this where it is not supported
        if (rightQuantified != null) {
            return new Native();
        }
View Full Code Here

    // The DSL API
    // -------------------------------------------------------------------------

    @Override
    public final Insert<R> select(Select<?> select) {
        Configuration configuration = getDelegate().internalAPI(AttachableInternal.class).getConfiguration();
        return new InsertSelectQueryImpl<R>(configuration, into, fields, select);
    }
View Full Code Here

      List<Field<?>> select = getSelect();

      // If no projection was specified explicitly, create fields from result
      // set meta data instead. This is typically the case for SELECT * ...
      if (select.isEmpty()) {
            Configuration configuration = getConfiguration();
            return new MetaDataFieldProvider(configuration, meta).getFields();
        }

        return select;
    }
View Full Code Here

        results.put(returnParameter, create(attachable).select(field).fetchOne(field));
        return 0;
    }

    private final int executeCallableStatement() {
        Configuration configuration = attachable.getConfiguration();
        ExecuteContext ctx = new DefaultExecuteContext(configuration, this);
        ExecuteListener listener = new ExecuteListeners(ctx);

        try {
            Connection connection = configuration.getConnection();

            listener.renderStart(ctx);
            ctx.sql(create(configuration).render(this));
            listener.renderEnd(ctx);

            listener.prepareStart(ctx);
            ctx.statement(connection.prepareCall(ctx.sql()));
            listener.prepareEnd(ctx);

            listener.bindStart(ctx);
            create(configuration).bind(this, ctx.statement());
            registerOutParameters(configuration, (CallableStatement) ctx.statement());
            listener.bindEnd(ctx);

            // Postgres requires two separate queries running in the same
            // transaction to be executed when fetching refcursor types
            boolean autoCommit = connection.getAutoCommit();
            if (autoCommit && configuration.getDialect() == SQLDialect.POSTGRES) {
                connection.setAutoCommit(false);
            }

            listener.executeStart(ctx);
            ctx.statement().execute();
            listener.executeEnd(ctx);

            if (autoCommit && configuration.getDialect() == SQLDialect.POSTGRES) {
                connection.setAutoCommit(autoCommit);
            }

            fetchOutParameters(ctx);
            return 0;
View Full Code Here

        return RecordImpl.class;
    }

    @Override
    protected final List<Field<?>> getFields(ResultSetMetaData meta) {
        Configuration configuration = getConfiguration();
        return new MetaDataFieldProvider(configuration, meta).getFields();
    }
View Full Code Here

TOP

Related Classes of org.jooq.Configuration

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.