/** * {@inheritDoc} */ @Override public final Configuration set(Settings newSettings) { this.settings = newSettings != null ? SettingsTools.clone(newSettings) : SettingsTools.defaultSettings(); this.mapping = new SchemaMapping(this); return this; }
/** * Get the parameter type from the settings. * <p> * The {@link ParamType} can be overridden by the {@link StatementType}. * If the latter is set to {@link StatementType#STATIC_STATEMENT}, then the * former defaults to {@link ParamType#INLINED}. */ public static final ParamType getParamType(Settings settings) { if (executeStaticStatements(settings)) { return INLINED; } else if (settings != null) { ParamType result = settings.getParamType(); if (result != null) return result; } return INDEXED; }
private final RenderMapping mapping() { return SettingsTools.getRenderMapping(configuration.settings()); }
@Override public final PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { if (executePreparedStatements(settings)) { return getDelegate().prepareStatement(sql, resultSetType, resultSetConcurrency); } else { return new SettingsEnabledPreparedStatement(getDelegate(), sql, resultSetType, resultSetConcurrency); } }
/** * Retrieve the configured default settings. * <p> * <ul> * <li>If the JVM flag <code>-Dorg.jooq.settings</code> points to a valid * settings file on the classpath, this will be loaded</li> * <li>If the JVM flag <code>-Dorg.jooq.settings</code> points to a valid * settings file on the file system, this will be loaded</li> * <li>If a valid settings file is found on the classpath at * <code>/jooq-settings.xml</code>, this will be loaded</li> * <li>Otherwise, a new <code>Settings</code> object is created with its * defaults</li> * </ul> */ public static final Settings defaultSettings() { // Clone the DEFAULT_SETTINGS to prevent modification return clone(DEFAULT_SETTINGS); }
this.forcedParamType = SettingsTools.getStatementType(settings()) == StatementType.STATIC_STATEMENT ? ParamType.INLINED : SettingsTools.getParamType(settings()) == ParamType.FORCE_INDEXED ? ParamType.INDEXED : null;
else if (updatablePrimaryKeys(settings(this))) { changed.set(index);
/** * Whether static {@link Statement} should be executed. */ public static final boolean executeStaticStatements(Settings settings) { return getStatementType(settings) == STATIC_STATEMENT; }
/** * {@inheritDoc} */ @Override public final String getSQL() { return getSQL(getParamType(Tools.settings(configuration()))); }
int t = SettingsTools.getQueryTimeout(timeout, ctx.settings()); if (t != 0) { ctx.statement().setQueryTimeout(t); executePreparedStatements(c.settings()) &&
/** * Create a new "empty" configuration object given a {@link SQLDialect}. * <p> * This can be used as is, as a "dummy" configuration object, or as a base * implementation for creating more sophisticated "derived" configurations * through the various <code>derive()</code> or <code>set()</code> methods. * * @param dialect The pre-existing {@link SQLDialect}. */ DefaultConfiguration(SQLDialect dialect) { this( null, null, null, null, null, dialect, SettingsTools.defaultSettings(), null ); }
if (!reflectionCaching(configuration.settings())) return operation.call();
@Override public final PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { if (executePreparedStatements(settings)) { return getDelegate().prepareStatement(sql, autoGeneratedKeys); } else { return new SettingsEnabledPreparedStatement(getDelegate(), sql, autoGeneratedKeys); } }
/** * Retrieve the configured default settings. * <p> * <ul> * <li>If the JVM flag <code>-Dorg.jooq.settings</code> points to a valid * settings file on the classpath, this will be loaded</li> * <li>If the JVM flag <code>-Dorg.jooq.settings</code> points to a valid * settings file on the file system, this will be loaded</li> * <li>If a valid settings file is found on the classpath at * <code>/jooq-settings.xml</code>, this will be loaded</li> * <li>Otherwise, a new <code>Settings</code> object is created with its * defaults</li> * </ul> */ public static final Settings defaultSettings() { // Clone the DEFAULT_SETTINGS to prevent modification return clone(DEFAULT_SETTINGS); }
final Collection<Field<?>> setReturningIfNeeded(StoreQuery<R> query) { Collection<Field<?>> key = null; if (configuration() != null) if (!TRUE.equals(configuration().data(DATA_OMIT_RETURNING_CLAUSE))) // [#1859] Return also non-key columns if (TRUE.equals(configuration().settings().isReturnAllOnUpdatableRecord())) key = Arrays.asList(fields()); // [#5940] Getting the primary key mostly doesn't make sense on UPDATE statements else if (query instanceof InsertQuery || updatablePrimaryKeys(settings(this))) key = getReturning(); if (key != null) query.setReturning(key); return key; }
/** * Whether a {@link PreparedStatement} should be executed. */ public static final boolean executePreparedStatements(Settings settings) { return getStatementType(settings) == PREPARED_STATEMENT; }
/** * {@inheritDoc} */ @Override public final String getSQL() { return getSQL(getParamType(configuration().settings())); }
/** * Create a new "empty" configuration object given a {@link SQLDialect}. * <p> * This can be used as is, as a "dummy" configuration object, or as a base * implementation for creating more sophisticated "derived" configurations * through the various <code>derive()</code> or <code>set()</code> methods. * * @param dialect The pre-existing {@link SQLDialect}. */ DefaultConfiguration(SQLDialect dialect) { this( null, null, null, null, null, null, null, null, null, dialect, SettingsTools.defaultSettings(), null ); }
if (!reflectionCaching(configuration.settings())) return operation.call();
@Override public final PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { if (executePreparedStatements(settings)) { return getDelegate().prepareStatement(sql, columnIndexes); } else { return new SettingsEnabledPreparedStatement(getDelegate(), sql, columnIndexes); } }