Package org.jooq

Examples of org.jooq.Configuration


    @Override
    public final int execute() {
        if (isExecutable()) {

            // Let listeners provide a configuration to this query
            Configuration configuration = org.jooq.ConfigurationRegistry.provideFor(getConfiguration());
            if (configuration == null) {
                configuration = getConfiguration();
            }

            // [#1191] The following triggers a start event on all listeners.
            // This may be used to provide jOOQ with a JDBC connection, in case
            // this Query / Configuration was previously deserialised
            ExecuteContext ctx = new DefaultExecuteContext(configuration, this);
            ExecuteListener listener = new ExecuteListeners(ctx);

            Connection connection = configuration.getConnection();
            if (connection == null) {
                throw new DetachedException("Cannot execute query. No Connection configured");
            }

            // Ensure that all depending Attachables are attached
View Full Code Here


        if (log.isDebugEnabled()) {
            log.debug("Deserialising", this);
        }

        Configuration registered = org.jooq.ConfigurationRegistry.provideFor(this);
        if (registered != null) {
            connection = registered.getConnection();
        }

        if (log.isDebugEnabled()) {
            log.debug("Deserialised", this);
        }
View Full Code Here

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

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

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

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

        return fieldArray(fields);
    }
View Full Code Here

    public final String getSQLTypeName() throws SQLException {
        StringBuilder sb = new StringBuilder();

        // [#1693] This needs to return the fully qualified SQL type name, in
        // case the connected user is not the owner of the UDT
        Configuration configuration = localConfiguration();
        if (configuration != null) {
            Schema schema = Utils.getMappedSchema(configuration, getUDT().getSchema());

            if (schema != null) {
                sb.append(schema.getName());
View Full Code Here

        return sb.toString();
    }

    @Override
    public final void readSQL(SQLInput stream, String typeName) throws SQLException {
        Configuration configuration = localConfiguration();

        for (Field<?> field : getUDT().fields()) {
            setValue(configuration, stream, field);
        }
    }
View Full Code Here

            }
        });
    }

    private final boolean isExecuteWithOptimisticLocking() {
        Configuration configuration = configuration();

        // This can be null when the current record is detached
        if (configuration != null) {
            return TRUE.equals(configuration.settings().isExecuteWithOptimisticLocking());
        }

        return false;
    }
View Full Code Here

    @Override
    public final int execute() {
        if (isExecutable()) {

            // Get the attached configuration of this query
            Configuration c = configuration();

            // [#1191] The following triggers a start event on all listeners.
            //         This may be used to provide jOOQ with a JDBC connection,
            //         in case this Query / Configuration was previously
            //         deserialised
            DefaultExecuteContext ctx = new DefaultExecuteContext(c, this);
            ExecuteListener listener = new ExecuteListeners(ctx);

            int result = 0;
            try {

                // [#385] If a statement was previously kept open
                if (keepStatement() && statement != null) {
                    ctx.sql(sql);
                    ctx.statement(statement);

                    // [#3191] Pre-initialise the ExecuteContext with a previous connection, if available.
                    ctx.connection(c.connectionProvider(), statement.getConnection());
                }

                // [#385] First time statement preparing
                else {
                    listener.renderStart(ctx);
                    ctx.sql(getSQL0(ctx));
                    listener.renderEnd(ctx);

                    sql = ctx.sql();

                    // [#3234] Defer initialising of a connection until the prepare step
                    // This optimises unnecessary ConnectionProvider.acquire() calls when
                    // ControlFlowSignals are thrown
                    if (ctx.connection() == null) {
                        throw new DetachedException("Cannot execute query. No Connection configured");
                    }

                    listener.prepareStart(ctx);
                    prepare(ctx);
                    listener.prepareEnd(ctx);

                    statement = ctx.statement();
                }

                // [#1856] Set the query timeout onto the Statement
                if (timeout != 0) {
                    ctx.statement().setQueryTimeout(timeout);
                }

                if (

                    // [#1145] Bind variables only for true prepared statements
                    // [#2414] Even if parameters are inlined here, child
                    //         QueryParts may override this behaviour!
                    executePreparedStatements(c.settings()) &&

                    // [#1520] Renderers may enforce static statements, too
                    !Boolean.TRUE.equals(ctx.data(DATA_FORCE_STATIC_STATEMENT))) {

                    listener.bindStart(ctx);
View Full Code Here

    @Override
    public final int execute(Configuration c) {

        // Ensure that all depending Attachables are attached
        Configuration previous = configuration();
        try {
            attach(c);
            return execute();
        }
        finally {
View Full Code Here

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

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

        return fieldArray(fields);
    }
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.