• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ResultQuery类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jooq.ResultQuery的典型用法代码示例。如果您正苦于以下问题:Java ResultQuery类的具体用法?Java ResultQuery怎么用?Java ResultQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ResultQuery类属于org.jooq包,在下文中一共展示了ResultQuery类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: Select

import org.jooq.ResultQuery; //导入依赖的package包/类
private Select(
  Connection connection,
  QueryBuilder<ResultQuery<? extends R>> queryBuilder,
  RecordMapper<? super R, ? extends T> recordMapper
) {
  super(
    subscriber -> {
      try (ResultQuery<? extends R> query = queryBuilder.build(connection)) {
        Cursor<? extends R> cursor = query.fetchLazy();
        setupUnsubscription(subscriber, query, cursor);
        log.debug("Select setProducer for  {}", query);
        subscriber.setProducer(new SelectProducer<>(
          subscriber,
          query,
          cursor,
          recordMapper
        ));
      } catch (Throwable t) {
        handleException(t, subscriber);
      }
    }
  );
}
 
开发者ID:Trunkplatform,项目名称:tiny-rxjava-jdbc,代码行数:24,代码来源:Select.java


示例2: cleanupServiceEventTable

import org.jooq.ResultQuery; //导入依赖的package包/类
private void cleanupServiceEventTable(Date cutoff) {
    ResultQuery<Record1<Long>> ids = create()
            .select(SERVICE_EVENT.ID)
            .from(SERVICE_EVENT)
            .where(SERVICE_EVENT.CREATED.lt(cutoff))
            .and(SERVICE_EVENT.STATE.eq(CommonStatesConstants.CREATED))
            .limit(QUERY_LIMIT_ROWS.getValue());

    List<Long> toDelete = null;
    int rowsDeleted = 0;
    while ((toDelete = ids.fetch().into(Long.class)).size() > 0) {
        rowsDeleted += create().delete(SERVICE_EVENT)
        .where(SERVICE_EVENT.ID.in(toDelete)).execute();
    }

    if (rowsDeleted > 0) {
        log.info("[Rows Deleted] service_event={}", rowsDeleted);
    }
}
 
开发者ID:rancher,项目名称:cattle,代码行数:20,代码来源:TableCleanup.java


示例3: select

import org.jooq.ResultQuery; //导入依赖的package包/类
@SuppressWarnings(value={"unused"})
private int select (String tableName, List<String> rows, List<String> columns) {
  Timer timer = Timer.start ("flat-dataset");

  Table<Record> table = tableByName (tableName);    
  List<Field<String>> selectFields = createFieldList (columns);

  ResultQuery<Record> query;
  List<String> rowKeys = getRowKeys (tableName, ID_FIELD_NAME);
  if (rowKeys.size () == rows.size ())
    query = queryAllRows (selectFields, table);
  else {
    query = queryINRows (tableName, selectFields, rows);
  }
  int count = read (query);
  timer.read ();
  return count;
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:19,代码来源:TestJooqCursorLUSCLevel2.java


示例4: fetchList

import org.jooq.ResultQuery; //导入依赖的package包/类
private List<String> fetchList (ResultQuery<Record1<String>> query, String columnField) {
  Cursor<Record1<String>> cursor = null;
  List<String> result = new ArrayList<String> (1000);
  try {
    cursor = query.fetchLazy ();
    // Cursor has similar methods as Iterator<R>
    while (cursor.hasNext ()) {
      Record record = cursor.fetchOne ();
      String sValue = (String) record.getValue (columnField);
      result.add (sValue);
    }
  } finally {
    if (cursor != null) {
      cursor.close ();
    }
  }
  return result;
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:19,代码来源:TestJooqCursorLUSCLevel2.java


示例5: getRowKeys

import org.jooq.ResultQuery; //导入依赖的package包/类
@Synchronized @SuppressWarnings("unused")
private List<String> getRowKeys (String tableName, String fieldRowIdName) {
  Timer timer = Timer.start ("get-row-keys");
  if (this.rowKeys == null) {
    Table<Record> table = tableByName (tableName);
    Field<String> fieldRowId = fieldByName (String.class, fieldRowIdName);
    // get rows
    Timer timer2 = Timer.start ("fetch-array");
    ResultQuery<Record1<String>> queryRowKeys = context.select (fieldRowId).from (table).getQuery ();
    String[] arows = queryRowKeys.fetchArray (fieldRowId);
    timer2.read ();
    // List<String> rows = Arrays.asList (arows);
    timer2 = Timer.start ("copy-array-to-list");
    // this.rowKeys = new ArrayList<String>(arows.length);
    // Collections.addAll (this.rowKeys, arows);
    // this.rowKeys = Arrays.asList (arows);
    this.rowKeys = fetchList (queryRowKeys, ID_FIELD_NAME);
    timer2.read ();

    log.debug ("rows.size(): " + this.rowKeys.size ());
  }
  timer.read ();
  return this.rowKeys;
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:25,代码来源:TestJooqCursorLUSCLevel2.java


示例6: select

import org.jooq.ResultQuery; //导入依赖的package包/类
@SuppressWarnings(value={"unused"})
private int select(String tableName, List<String> rows, List<String> columns){
  Timer timer = Timer.start ("flat-dataset");
  
  Table<Record> table = tableByName (tableName);    
  List<Field<String>> selectFields = createFieldList (columns);
  
  ResultQuery<Record> query;    
  List<String> rowKeys = getRowKeys (tableName, ID_FIELD_NAME);    
  if(rowKeys.size ()==rows.size ())
    query = queryAllRows (selectFields, table);
  else{
    query = queryINRows (tableName, selectFields, rows);
  }
  int count = read(query);
  timer.read ();
  return count;
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:19,代码来源:TestJooqCursorLGGLevel2.java


示例7: select

import org.jooq.ResultQuery; //导入依赖的package包/类
@SuppressWarnings(value={"unused"})
private int select (String tableName, List<String> rows, List<String> columns) {
  Timer timer = Timer.start ("flat-dataset");

  Table<Record> table = tableByName (tableName);
  Field<String> fieldRowId = fieldByName (String.class, ID_FIELD_NAME);
  List<Field<String>> selectFields = createFieldList (columns);

  ResultQuery<Record> query;
  List<String> rowKeys = getRowKeys (tableName, ID_FIELD_NAME);
  if (rowKeys.size () == rows.size ())
    query = queryAllRows (selectFields, table);
  else {
    query = queryINRows (tableName, selectFields, rows);
  }
  int count = read (query);
  timer.read ();
  return count;
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:20,代码来源:TestJooqCursorGBMLevel2.java


示例8: getRowKeys

import org.jooq.ResultQuery; //导入依赖的package包/类
@Synchronized 
private List<String> getRowKeys(String tableName, String fieldRowIdName){
  if(rowCasche.containsKey (tableName)){
    return rowCasche.get (tableName);
  }else{
    
    Table<Record> table = tableByName (tableName);
    Field<String> fieldRowId = fieldByName (String.class, fieldRowIdName);
    //get rows
    Timer timer = Timer.start ("get-row-keys");      
    ResultQuery<Record1<String>> queryRowKeys =context.select(fieldRowId).from(table).orderBy (fieldRowId).getQuery ();      
    String[] arows = queryRowKeys.fetchArray (fieldRowId);
    timer.read ("fetch-array");
//    List<String> rows = Arrays.asList (arows);
    List<String> rows = new ArrayList<String>(arows.length);      
    Collections.addAll (rows, arows);
    timer.read ("collection");      
    if(log.isDebugEnabled ()){
      timer.read();
      log.debug ("rows.size(): " + rows.size ());
    }
    rowCasche.put (tableName, rows);
    return rows;
  }
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:26,代码来源:PresetDimensionBuilderFlatTable.java


示例9: getColumnKeys

import org.jooq.ResultQuery; //导入依赖的package包/类
private List<String> getColumnKeys(String tableName, String fieldRowIdName){
  //get columns
  Table<Record> table = tableByName (tableName);    
  Timer timer = Timer.start ("get-column-keys");
  ResultQuery<Record> queryColumnKeys =context.selectFrom(table).limit (1) .getQuery ();
  Record recordColumnKeys = queryColumnKeys.fetchOne ();
  List<String> columns = new ArrayList<String>();
  for(Field<?> field : recordColumnKeys.fields())
    if(!field.getName ().equals (ID_FIELD_NAME))
      columns.add (field.getName ());
  
  if(log.isDebugEnabled ()){
    timer.read();
    log.debug ("columns.size(): " + columns.size ());
    log.debug ("columns: " + columns);
  }
  return columns;
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:19,代码来源:PresetDimensionBuilderFlatTable.java


示例10: getAsStream

import org.jooq.ResultQuery; //导入依赖的package包/类
@Override
  public InputStream getAsStream (Dimension dimension) {
    
//    SelectQuery<Tables> query = context.selectQuery()
    
    Table<?>  table = tableByName (TABLE_NAME_PREFIX+this.platformId ());
    Field<String> probeId = fieldByName (String.class, "PROBESET_ID");
    
    InputStream input=null;    
    ResultQuery<?> query = context.selectFrom(table)
            .where(probeId.in (dimension.keys ()));
     log.debug(query.toString ());
     String csv = query.fetch().formatCSV('\t');
     try {
      input = new ByteArrayInputStream (csv.getBytes ("UTF-8"));
    } catch (UnsupportedEncodingException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return input;
  }
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:22,代码来源:JooqProbeAnnotations.java


示例11: SelectProducer

import org.jooq.ResultQuery; //导入依赖的package包/类
public SelectProducer(
  Subscriber<? super T> subscriber,
  ResultQuery<? extends R> query,
  Cursor<? extends R> cursor,
  RecordMapper<? super R, ? extends T> recordMapper
) {
  this.subscriber = subscriber;
  this.query = query;
  this.cursor = cursor;
  this.recordMapper = recordMapper;
}
 
开发者ID:Trunkplatform,项目名称:tiny-rxjava-jdbc,代码行数:12,代码来源:SelectProducer.java


示例12: setupUnsubscription

import org.jooq.ResultQuery; //导入依赖的package包/类
private static <R extends Record, T> void setupUnsubscription(
  Subscriber<? super T> subscriber,
  ResultQuery<? extends R> query,
  Cursor<? extends R> cursor
) {
  subscriber.add(
    Subscriptions.create(
      () -> {
        closeQuietly(cursor);
        closeQuietly(query);
      }
    )
  );
}
 
开发者ID:Trunkplatform,项目名称:tiny-rxjava-jdbc,代码行数:15,代码来源:Select.java


示例13: limit

import org.jooq.ResultQuery; //导入依赖的package包/类
private ResultQuery<Record> limit(Integer startPos, Integer maxRows, SelectSeekStep1<Record, Timestamp> selectSeekStep) {
	if (maxRows != null) {
		if (startPos == null) {
			startPos = 0;
		}
		return selectSeekStep.limit(startPos, maxRows);
	} else {
		return selectSeekStep;
	}
}
 
开发者ID:oglimmer,项目名称:lunchy,代码行数:11,代码来源:UpdatesDao.java


示例14: toQuery

import org.jooq.ResultQuery; //导入依赖的package包/类
protected ResultQuery<?> toQuery(Class<?> clz, Map<Object, Object> values) {
    String type = schemaFactory.getSchemaName(clz);
    if (type == null) {
        throw new IllegalArgumentException("Failed to find type of class [" + clz + "]");
    }
    Class<UpdatableRecord<?>> recordClass = JooqUtils.getRecordClass(schemaFactory, clz);
    Table<?> table = JooqUtils.getTableFromRecordClass(recordClass);
    return create().selectFrom(table).where(JooqUtils.toConditions(metaDataManager, type, values));
}
 
开发者ID:rancher,项目名称:cattle,代码行数:10,代码来源:JooqObjectManager.java


示例15: toQuery

import org.jooq.ResultQuery; //导入依赖的package包/类
protected ResultQuery<?> toQuery(Class<?> clz, Map<Object, Object> values) {
    String type = schemaFactory.getSchemaName(clz);
    if ( type == null ) {
        throw new IllegalArgumentException("Failed to find type of class [" + clz + "]");
    }
    Class<UpdatableRecord<?>> recordClass = JooqUtils.getRecordClass(schemaFactory, clz);
    Table<?> table = JooqUtils.getTableFromRecordClass(recordClass);
    return create()
            .selectFrom(table)
            .where(JooqUtils.toConditions(metaDataManager, type, values));
}
 
开发者ID:cloudnautique,项目名称:cloud-cattle,代码行数:12,代码来源:JooqObjectManager.java


示例16: testSimpleSelectAll

import org.jooq.ResultQuery; //导入依赖的package包/类
@Test
@Ignore @SuppressWarnings("unused")
public void testSimpleSelectAll () {
  Table<Record> table = tableByName (tsvFileName);

  long startTime = System.nanoTime ();
  int count = 0;
  ResultQuery<Record> query = context.selectFrom (table);
  // log.debug ("PresetValuesFlatTable sql:"+query.getSQL ());
  Cursor<Record> cursor = null;
  try {
    cursor = query.fetchLazy ();
    // Cursor has similar methods as Iterator<R>
    while (cursor.hasNext ()) {
      Record record = cursor.fetchOne ();
      for (Field<?> columnField : record.fields ()) {
        String value = (String) record.getValue (columnField);
        count++;
      }
    }
  } finally {
    if (cursor != null) {
      cursor.close ();
    }
  }

  long endTime = System.nanoTime ();
  long duration = endTime - startTime;
  log.debug ("flat-count:" + count + ", duration: " + duration);
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:31,代码来源:TestJooqCursorLUSCLevel2.java


示例17: queryINRows

import org.jooq.ResultQuery; //导入依赖的package包/类
private ResultQuery<Record> queryINRows (String tableName, List<Field<String>> selectFields, List<String> rows) {
  Table<Record> table = tableByName (tableName);
  Field<String> fieldRowId = fieldByName (String.class, ID_FIELD_NAME);
  return context.select (selectFields)
                .from (table).where (fieldRowId.in (rows))
                .getQuery ();
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:8,代码来源:TestJooqCursorLUSCLevel2.java


示例18: queryRowByID

import org.jooq.ResultQuery; //导入依赖的package包/类
private ResultQuery<Record> queryRowByID (String tableName, List<Field<String>> selectFields, String row) {
  Table<Record> table = tableByName (tableName);
  Field<String> fieldRowId = fieldByName (String.class, ID_FIELD_NAME);
  return context.select (selectFields)
                .from (table).where (fieldRowId.eq (row))
                .getQuery ();
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:8,代码来源:TestJooqCursorLUSCLevel2.java


示例19: select2

import org.jooq.ResultQuery; //导入依赖的package包/类
/**
   * @param tableName
   * @param rows
   * @param columns
   * @return
   */
  @SuppressWarnings(value={"all"})
  private int select2 (String tableName, List<String> rows, List<String> columns) {
    Timer timer = Timer.start ("flat-dataset");

    Table<Record> table = tableByName (tableName);
    Field<String> fieldRowId = fieldByName (String.class, ID_FIELD_NAME);
    List<Field<String>> selectFields = createFieldList (columns);

    int totalCellCount = 0;
    ResultQuery<Record> query;
    List<String> rowKeys = getRowKeys (tableName, ID_FIELD_NAME);
    if(rowKeys.size ()==rows.size ()){
    // TODO:hardcoded data size for test only
//    if (90797 == rows.size ()){
      query = queryAllRows (selectFields, table);
      totalCellCount = read (query);
    }else {
      final int FETCH_LIMIT = 1;

      List<String> batchRows = new ArrayList<String> (FETCH_LIMIT);
      for (String row : rows) {
        batchRows.add (row);
        if (batchRows.size () % FETCH_LIMIT == 0) {
          if (FETCH_LIMIT == 1)
            query = queryRowByID (tableName, selectFields, row);
          else
            query = queryINRows (tableName, selectFields, rows);
          totalCellCount += read (query);
          batchRows = new ArrayList<String> (FETCH_LIMIT); // reset
        }
      }
      if (batchRows.size () > 0) {
        query = queryINRows (tableName, selectFields, rows);
        totalCellCount += read (query);
      }
    }
    timer.read ();
    return totalCellCount;
  }
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:46,代码来源:TestJooqCursorLUSCLevel2.java


示例20: read

import org.jooq.ResultQuery; //导入依赖的package包/类
private int read (ResultQuery<Record> query) {
  Cursor<Record> cursor = null;
  int count = 0;
  try {
    cursor = query.fetchLazy ();
    // Cursor has similar methods as Iterator<R>
    while (cursor.hasNext ()) {
      Record record = cursor.fetchOne ();
      for (Field<?> columnField : record.fields ()) {
        String sValue = (String) record.getValue (columnField);
        @SuppressWarnings("unused") double value = NaN;
        if ("Inf".equalsIgnoreCase (sValue))
          value = POSITIVE_INFINITY;
        else if ("-Inf".equalsIgnoreCase (sValue))
          value = NEGATIVE_INFINITY;
        else if ("NA".equalsIgnoreCase (sValue))
          value = NaN;
        else if ("null".equalsIgnoreCase (sValue))
          value = NaN;
        else if (sValue == null)
          value = NaN;
        else
          value = Double.parseDouble (sValue);
        count++;
      }
    }
  } finally {
    if (cursor != null) {
      cursor.close ();
    }
  }
  return count;
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:34,代码来源:TestJooqCursorLUSCLevel2.java



注:本文中的org.jooq.ResultQuery类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IncorrectnessListener类代码示例发布时间:2022-05-23
下一篇:
Java DictValue类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap