@Override public SelectSelectStep<Record1<Integer>> selectOne() { return delegate.selectOne(); }
public static JdbcTimestampBoundStore create(final JdbcKeyValueService kvs) { final JdbcTimestampBoundStore store = new JdbcTimestampBoundStore(kvs); kvs.run((Function<DSLContext, Void>) ctx -> { String partialSql = ctx.createTable(store.TABLE) .column(DUMMY_COLUMN, INTEGER.nullable(false)) .column(LATEST_TIMESTAMP, BIGINT.nullable(false)) .getSQL(); int endIndex = partialSql.lastIndexOf(')'); String fullSql = partialSql.substring(0, endIndex) + "," + " CONSTRAINT " + kvs.primaryKey(TIMESTAMP_TABLE) + " PRIMARY KEY (" + DUMMY_COLUMN.getName() + ")" + partialSql.substring(endIndex); try { ctx.execute(fullSql); } catch (DataAccessException e) { kvs.handleTableCreationException(e); } ctx.insertInto(store.TABLE, DUMMY_COLUMN, LATEST_TIMESTAMP) .select(ctx.select(DUMMY_COLUMN, LATEST_TIMESTAMP) .from(kvs.values(ctx, new RowN[] {(RowN) DSL.row(0, 10000L)}, "t", DUMMY_COLUMN.getName(), LATEST_TIMESTAMP.getName())) .whereNotExists(ctx.selectOne() .from(store.TABLE) .where(DUMMY_COLUMN.eq(0)))) .execute(); return null; }); return store; }
@Bean CommandLineRunner runner(DSLContext create) { new CommandLineRunner() { @Override void run(String... args) throws Exception { create.selectOne().fetch() } } }
@Override public final MergeImpl usingDual() { this.using = create().selectOne(); return this; }
@Override public final MergeImpl usingDual() { this.using = create().selectOne(); return this; }
.select(ctx.select(T1_ROW_NAME, T1_COL_NAME, T1_TIMESTAMP, T1_VALUE) .from(values(ctx, rows, TEMP_TABLE_1, ROW_NAME, COL_NAME, TIMESTAMP, VALUE)) .whereNotExists(ctx.selectOne() .from(atlasTable(tableRef).as(ATLAS_TABLE)) .where(A_ROW_NAME.eq(T1_ROW_NAME)
@Override public void start(ExecuteContext ctx) { // [#4974] Prevent any class loading effects from impacting below // SQLPerformanceWarning. if (!initialised) { try { DSL.using(configuration).selectOne().fetch(); } // [#7248] Unsupported dialects might not be able to run queries on the DUAL table catch (DataAccessException ignore) { log.debug("Error while running init query", ignore); } initialised = true; } }
return dsl().selectOne();
@Override public final boolean exists(Table<?> table) { Boolean result = exists.get(table); if (result == null) { try { create(true) .selectOne() .from(table) .where(falseCondition()) .fetch(); result = true; } catch (DataAccessException e) { result = false; } exists.put(table, result); } return result; }
private boolean is55() { // Check if this is a MySQL 5.5 or later database if (is55 == null) { try { create().selectOne().from(PARAMETERS).limit(1).fetchOne(); is55 = true; } catch (Exception e) { is55 = false; } } return is55; } }
@Override public boolean contains(final Object key) { // This method will be invoked by the PersistenceManager to determine if the loader contains the specified key. // The implementation should be as fast as possible, e.g. it should strive to transfer the least amount of data possible // from the external storage to perform the check. Also, if possible, make sure the field is indexed on the external storage // so that its existence can be determined as quickly as possible. // // Note that keys will be in the cache's native format, which means that if the cache is being used by a remoting protocol // such as HotRod or REST and compatibility mode has not been enabled, then they will be encoded in a byte[]. Loggers.SQL_LOG.trace("[IS0106] SQL store: Checking {} cache key {}", getCacheName(), key); try { return sql.selectOne() .from(table(sqlRecordTransformer.getTableName())) .where(sqlRecordTransformer.resolveSelectionConditions(resolveKey(key))) .fetchOne() != null; } catch (Exception e) { Loggers.SQL_LOG.error("[IS0107] {}: {}", e.getMessage(), e); throw new PersistenceException(e.getMessage(), e); } }
@Override public boolean contains(final Object key) { // This method will be invoked by the PersistenceManager to determine if the loader contains the specified key. // The implementation should be as fast as possible, e.g. it should strive to transfer the least amount of data possible // from the external storage to perform the check. Also, if possible, make sure the field is indexed on the external storage // so that its existence can be determined as quickly as possible. // // Note that keys will be in the cache's native format, which means that if the cache is being used by a remoting protocol // such as HotRod or REST and compatibility mode has not been enabled, then they will be encoded in a byte[]. Loggers.SQL_LOG.trace("[IS0106] SQL store: Checking {} cache key {}", getCacheName(), key); try (Connection connection = dataSource.getConnection()) { return DSL.using(connection, config.sqlDialect) .selectOne() .from(table(sqlRecordTransformer.getTableName())) .where(sqlRecordTransformer.resolveSelectionConditions(resolveKey(key))) .fetchOne() != null; } catch (Exception e) { Loggers.SQL_LOG.error("[IS0107] {}: {}", e.getMessage(), e); throw new PersistenceException(e.getMessage(), e); } }
.select(DSL.inline(symbol, stringIndexType())) .whereNotExists(context .selectOne() .from(symbolTable) .where(symbolValueField.eq(symbol))));