congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
org.jooq
Code IndexAdd Tabnine to your IDE (free)

How to use org.jooq

Best Java code snippets using org.jooq (Showing top 20 results out of 765)

origin: spring-projects/spring-data-examples

  public List<Category> getCategoriesWithAgeGroup(AgeGroup ageGroup) {
    return this.dslContext.select().from(CATEGORY).where(CATEGORY.AGE_GROUP.equal(ageGroup.name()))
        .fetchInto(Category.class);
  }
}
origin: stackoverflow.com

 SelectQuery q = factory.selectQuery();
q.addSelect(Table1.TABLE1.fields());
q.addSelect(Table1.ID.count().as("IdCount"));
q.addFrom(Table1.TABLE1);
origin: jooby-project/jooby

 @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));
 }
}
origin: palantir/atlasdb

private Select<? extends Record> getLatestTimestampQuerySomeColumns(DSLContext ctx,
                                  TableReference tableRef,
                                  Collection<byte[]> rows,
                                  Collection<byte[]> cols,
                                  long timestamp) {
  return ctx.select(A_ROW_NAME, A_COL_NAME, DSL.max(A_TIMESTAMP).as(MAX_TIMESTAMP))
      .from(atlasTable(tableRef).as(ATLAS_TABLE))
      .where(A_ROW_NAME.in(rows)
          .and(A_COL_NAME.in(cols)))
          .and(A_TIMESTAMP.lessThan(timestamp))
      .groupBy(A_ROW_NAME, A_COL_NAME);
}
origin: palantir/atlasdb

private Select<? extends Record> getAllTimestampsQuerySomeColumns(DSLContext ctx,
                                 TableReference tableRef,
                                 Select<Record1<byte[]>> subQuery,
                                 Collection<byte[]> cols,
                                 long timestamp) {
  return ctx.select(A_ROW_NAME, A_COL_NAME, A_TIMESTAMP)
      .from(atlasTable(tableRef).as(ATLAS_TABLE))
      .where(A_ROW_NAME.in(subQuery)
          .and(A_COL_NAME.in(cols)))
          .and(A_TIMESTAMP.lessThan(timestamp));
}
origin: palantir/atlasdb

private Select<? extends Record> getLatestTimestampQueryManyTimestamps(DSLContext ctx,
                                    TableReference tableRef,
                                    RowN[] rows) {
  return ctx.select(A_ROW_NAME, A_COL_NAME, DSL.max(A_TIMESTAMP).as(MAX_TIMESTAMP))
      .from(atlasTable(tableRef).as(ATLAS_TABLE))
      .join(values(ctx, rows, TEMP_TABLE_1, ROW_NAME, COL_NAME, TIMESTAMP))
      .on(A_ROW_NAME.eq(T1_ROW_NAME)
          .and(A_COL_NAME.eq(T1_COL_NAME)))
      .where(A_TIMESTAMP.lessThan(T1_TIMESTAMP))
      .groupBy(A_ROW_NAME, A_COL_NAME);
}
origin: palantir/atlasdb

  private long getLatestTimestamp(DSLContext ctx) {
    return ctx.select(LATEST_TIMESTAMP)
        .from(TABLE)
        .where(DUMMY_COLUMN.eq(0))
        .fetchOne(LATEST_TIMESTAMP);
  }
}
origin: palantir/atlasdb

private Result<? extends Record> fetchValues(DSLContext ctx,
                       TableReference tableRef,
                       Select<? extends Record> subQuery) {
  return ctx.select(A_ROW_NAME, A_COL_NAME, A_TIMESTAMP, A_VALUE)
      .from(atlasTable(tableRef).as(ATLAS_TABLE))
      .join(subQuery.asTable(TEMP_TABLE_2))
      .on(A_ROW_NAME.eq(T2_ROW_NAME)
          .and(A_COL_NAME.eq(T2_COL_NAME))
          .and(A_TIMESTAMP.eq(T2_MAX_TIMESTAMP)))
      .fetch();
}
origin: palantir/atlasdb

private Set<TableReference> getAllTableNames(DSLContext ctx) {
  Result<? extends Record> records = ctx
      .select(TABLE_NAME)
      .from(METADATA_TABLE)
      .fetch();
  Set<TableReference> tableRefs = Sets.newHashSetWithExpectedSize(records.size());
  for (Record record : records) {
    tableRefs.add(TableReference.createUnsafe(record.getValue(TABLE_NAME)));
  }
  return tableRefs;
}
origin: palantir/atlasdb

@Override
public void dropTables(final Set<TableReference> tableRefs) throws InsufficientConsistencyException {
  if (tableRefs.isEmpty()) {
    return;
  }
  run((Function<DSLContext, Void>) ctx -> {
    for (TableReference tableRef : tableRefs) {
      ctx.dropTableIfExists(tableName(tableRef)).execute();
    }
    ctx.deleteFrom(METADATA_TABLE)
      .where(TABLE_NAME.in(tableRefs))
      .execute();
    return null;
  });
}
origin: my2iu/Jinq

private <K> void copyValueIntoRecord(T outputRecord, Record inputRecord, Field<K> field, int idx)
{
 outputRecord.setValue(field, inputRecord.getValue(idx, field.getConverter()));
}
origin: palantir/atlasdb

@Override
public void compactInternally(final TableReference tableRef) {
  if (sqlDialect.family() == SQLDialect.POSTGRES) {
    run((Function<DSLContext, Void>) ctx -> {
      ctx.execute("VACUUM ANALYZE " + tableName(tableRef));
      return null;
    });
  }
}
origin: my2iu/Jinq

@SuppressWarnings("unchecked")
@Override
public T readResult(Record results, int offset)
{
 return (T)results.getValue(offset);
}
origin: my2iu/Jinq

@Override
public int getNumColumns()
{
 return table.fields().length;
}
origin: palantir/atlasdb

private Select<? extends Record> getLatestTimestampQueryAllColumnsSubQuery(DSLContext ctx,
                                      TableReference tableRef,
                                      Select<Record1<byte[]>> subQuery,
                                      long timestamp) {
  return ctx.select(A_ROW_NAME, A_COL_NAME, DSL.max(A_TIMESTAMP).as(MAX_TIMESTAMP))
      .from(atlasTable(tableRef).as(ATLAS_TABLE))
      .where(A_ROW_NAME.in(subQuery)
          .and(A_TIMESTAMP.lessThan(timestamp)))
      .groupBy(A_ROW_NAME, A_COL_NAME);
}
origin: palantir/atlasdb

private Select<? extends Record> getAllTimestampsQueryAllColumns(DSLContext ctx,
                                 TableReference tableRef,
                                 Select<Record1<byte[]>> subQuery,
                                 long timestamp) {
  return ctx.select(A_ROW_NAME, A_COL_NAME, A_TIMESTAMP)
      .from(atlasTable(tableRef).as(ATLAS_TABLE))
      .where(A_ROW_NAME.in(subQuery)
          .and(A_TIMESTAMP.lessThan(timestamp)));
}
origin: palantir/atlasdb

@Override
public byte[] getMetadataForTable(final TableReference tableRef) {
  return run(ctx -> {
    byte[] metadata = ctx
        .select(METADATA)
        .from(METADATA_TABLE)
        .where(TABLE_NAME.eq(tableRef.getQualifiedName()))
        .fetchOne(METADATA);
    return MoreObjects.firstNonNull(metadata, new byte[0]);
  });
}
origin: palantir/atlasdb

@Override
public Map<TableReference, byte[]> getMetadataForTables() {
  return run(ctx -> {
    Result<? extends Record> records = ctx
        .select(TABLE_NAME, METADATA)
        .from(METADATA_TABLE)
        .fetch();
    Map<TableReference, byte[]> metadata = Maps.newHashMapWithExpectedSize(records.size());
    for (Record record : records) {
      metadata.put(TableReference.createUnsafe(record.getValue(TABLE_NAME)), record.getValue(METADATA));
    }
    return metadata;
  });
}
origin: palantir/atlasdb

private Select<? extends Record> getLatestTimestampQuerySomeColumnsSubQuery(DSLContext ctx,
                                      TableReference tableRef,
                                      Select<Record1<byte[]>> subQuery,
                                      Collection<byte[]> cols,
                                      long timestamp) {
  return ctx.select(A_ROW_NAME, A_COL_NAME, DSL.max(A_TIMESTAMP).as(MAX_TIMESTAMP))
      .from(atlasTable(tableRef).as(ATLAS_TABLE))
      .where(A_ROW_NAME.in(subQuery)
          .and(A_COL_NAME.in(cols)))
          .and(A_TIMESTAMP.lessThan(timestamp))
      .groupBy(A_ROW_NAME, A_COL_NAME);
}
origin: palantir/atlasdb

private Select<? extends Record> getLatestTimestampQueryAllColumns(DSLContext ctx,
                                  TableReference tableRef,
                                  Collection<byte[]> rows,
                                  long timestamp) {
  return ctx.select(A_ROW_NAME, A_COL_NAME, DSL.max(A_TIMESTAMP).as(MAX_TIMESTAMP))
      .from(atlasTable(tableRef).as(ATLAS_TABLE))
      .where(A_ROW_NAME.in(rows)
          .and(A_TIMESTAMP.lessThan(timestamp)))
      .groupBy(A_ROW_NAME, A_COL_NAME);
}
org.jooq

Most used classes

  • DSLContext
    A contextual DSL providing "attached" implementations to theorg.jooq interfaces. Apart from the DSL
  • DSL
    A DSL "entry point" providing implementations to the org.jooq interfaces. The DSLContext and this DS
  • SelectConditionStep
    This type is used for the Select's DSL API when selecting generic Record types. Example: -- get a
  • TableField
  • SelectSelectStep
    This type is used for the Select's DSL API when selecting generic Record types. Example: -- get a
  • SelectJoinStep,
  • Field,
  • SelectWhereStep,
  • DeleteWhereStep,
  • Record,
  • Result,
  • Table,
  • Configuration,
  • DeleteConditionStep,
  • SelectOnConditionStep,
  • DefaultConfiguration,
  • Unchecked,
  • SelectOnStep,
  • Settings
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now