/** * {@inheritDoc} */ @Override public Row4<Integer, String, String, String> fieldsRow() { return (Row4) super.fieldsRow(); }
/** * Create an aliased <code>PUBLIC.CATEGORY</code> table reference */ public Category(String alias) { this(DSL.name(alias), CATEGORY); }
/** * {@inheritDoc} */ @Override public Row4<Integer, String, String, String> valuesRow() { return (Row4) super.valuesRow(); }
@Override public void configure(final Env env, final Config conf, final Binder binder) { Key<DataSource> dskey = Key.get(DataSource.class, Names.named(name)); Supplier<NoSuchElementException> noSuchElement = () -> new NoSuchElementException( "DataSource missing: " + dskey); HikariDataSource ds = (HikariDataSource) env.get(dskey).orElseThrow(noSuchElement); Configuration jooqconf = new DefaultConfiguration(); ConnectionProvider dscp = new DataSourceConnectionProvider(ds); jooqconf.set(JDBCUtils.dialect(env.get(Key.get(String.class, Names.named(name + ".url"))) .orElseThrow(noSuchElement))); jooqconf.set(dscp); jooqconf.set(new DefaultTransactionProvider(dscp)); if (callback != null) { callback.accept(jooqconf, conf); } ServiceKey serviceKey = env.serviceKey(); serviceKey.generate(Configuration.class, name, k -> binder.bind(k).toInstance(jooqconf)); Provider<DSLContext> dsl = () -> DSL.using(jooqconf); serviceKey.generate(DSLContext.class, name, k -> binder.bind(k).toProvider(dsl)); } }
public DefaultConfiguration configuration() { DefaultConfiguration jooqConfiguration = new DefaultConfiguration(); jooqConfiguration.set(connectionProvider()); return jooqConfiguration; } }
private JdbcKeyValueService( Settings settings, SQLDialect sqlDialect, DataSource dataSource, String tablePrefix, int rowBatchSize, int batchSizeForReads, int batchSizeForMutations) { this.settings = settings; this.sqlDialect = sqlDialect; this.dataSource = dataSource; this.tablePrefix = tablePrefix; this.rowBatchSize = rowBatchSize; this.batchSizeForReads = batchSizeForReads; this.batchSizeForMutations = batchSizeForMutations; METADATA_TABLE = table(tablePrefix + "_metadata"); }
/** * {@inheritDoc} */ @Override public Record1<Integer> key() { return (Record1) super.key(); }
@Override public ColumnExpressions<?> booleanConstantValue(ConstantValue.BooleanConstant val, Void in) throws TypedValueVisitorException { return ColumnExpressions.singleColumn(new SimpleRowReader<Boolean>(), DSL.val(val.val)); }
private static RowN[] toRows(List<Entry<Cell, Long>> cellTimestampPairs) { RowN[] rows = new RowN[cellTimestampPairs.size()]; int i = 0; for (Entry<Cell, Long> entry : cellTimestampPairs) { rows[i++] = row(new Object[] {entry.getKey().getRowName(), entry.getKey().getColumnName(), entry.getValue()}); } return rows; }
private Category(Name alias, Table<CategoryRecord> aliased, Field<?>[] parameters) { super(alias, null, aliased, parameters, DSL.comment("")); }
@Bean DefaultDSLContext dsl() { return new DefaultDSLContext(configuration()); }
@Bean public DataSourceConnectionProvider connectionProvider() { return new DataSourceConnectionProvider(new TransactionAwareDataSourceProxy(dataSource)); }
/** * Create a <code>PUBLIC.CATEGORY</code> table reference */ public Category() { this(DSL.name("CATEGORY"), null); }
private JdbcTimestampBoundStore(JdbcKeyValueService kvs) { this.kvs = kvs; TABLE = DSL.table(kvs.tableName(TIMESTAMP_TABLE)); }
@Override public ColumnExpressions<?> stringConstantValue(ConstantValue.StringConstant val, Void in) throws TypedValueVisitorException { return ColumnExpressions.singleColumn(new SimpleRowReader<String>(), DSL.val(val.val)); }
private static RowN[] toRows(Set<Cell> cells) { RowN[] rows = new RowN[cells.size()]; int i = 0; for (Cell cell : cells) { rows[i++] = row(new Object[] {cell.getRowName(), cell.getColumnName()}); } return rows; }
/** * {@inheritDoc} */ @Override public Category as(String alias) { return new Category(DSL.name(alias), this); }
Table<Record> atlasTable(TableReference tableRef) { return table(tableName(tableRef)); }
@Override public ColumnExpressions<?> integerConstantValue(ConstantValue.IntegerConstant val, Void in) throws TypedValueVisitorException { return ColumnExpressions.singleColumn(new SimpleRowReader<Integer>(), DSL.val(val.val)); }
/** * Rename this table */ @Override public Category rename(String name) { return new Category(DSL.name(name), null); }