org.h2.command.dml.Query.query()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(321)

本文整理了Java中org.h2.command.dml.Query.query方法的一些代码示例,展示了Query.query的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.query方法的具体详情如下:
包路径:org.h2.command.dml.Query
类名称:Query
方法名:query

Query.query介绍

[英]Execute the query, writing the result to the target result.
[中]执行查询,将结果写入目标结果。

代码示例

代码示例来源:origin: com.h2database/h2

  1. /**
  2. * Get the current result of the expression. The rows may not be of the same
  3. * type, therefore the rows may not be unique.
  4. *
  5. * @return the result
  6. */
  7. public ResultInterface getCurrentResult() {
  8. return expressionQuery.query(0);
  9. }

代码示例来源:origin: com.h2database/h2

  1. @Override
  2. public final ResultInterface query(int maxrows) {
  3. return query(maxrows, null);
  4. }

代码示例来源:origin: com.h2database/h2

  1. private Cursor find(Session session, SearchRow first, SearchRow last,
  2. SearchRow intersection) {
  3. if (recursive) {
  4. return findRecursive(first, last);
  5. }
  6. setupQueryParameters(session, first, last, intersection);
  7. ResultInterface result = query.query(0);
  8. return new ViewCursor(this, result, first, last);
  9. }

代码示例来源:origin: com.h2database/h2

  1. @Override
  2. public Value getValue(Session session) {
  3. query.setSession(session);
  4. ResultInterface result = query.query(1);
  5. session.addTemporaryResult(result);
  6. boolean r = result.hasNext();
  7. return ValueBoolean.get(r);
  8. }

代码示例来源:origin: com.h2database/h2

  1. @Override
  2. protected Value[] fetchNextRow() {
  3. if (rightDone) {
  4. return null;
  5. }
  6. if (!leftDone) {
  7. if (l == null) {
  8. l = left.query(0);
  9. l.reset();
  10. }
  11. if (l.next()) {
  12. return l.currentRow();
  13. }
  14. leftDone = true;
  15. }
  16. if (r == null) {
  17. r = right.query(0);
  18. r.reset();
  19. }
  20. if (r.next()) {
  21. return r.currentRow();
  22. }
  23. rightDone = true;
  24. return null;
  25. }

代码示例来源:origin: com.h2database/h2

  1. @Override
  2. protected Cursor run() throws Exception {
  3. viewIndex.setupQueryParameters(viewIndex.getSession(), first, last, null);
  4. ArrayList<JoinBatch> joinBatches = batchUnion.joinBatches;
  5. for (int i = 0, size = joinBatches.size(); i < size; i++) {
  6. assert topFutureCursors[i] != null;
  7. joinBatches.get(i).viewTopFutureCursor = topFutureCursors[i];
  8. }
  9. ResultInterface localResult;
  10. boolean lazy = false;
  11. try {
  12. localResult = viewIndex.getQuery().query(0);
  13. lazy = localResult.isLazy();
  14. } finally {
  15. if (!lazy) {
  16. resetViewTopFutureCursorAfterQuery();
  17. }
  18. }
  19. return newCursor(localResult);
  20. }

代码示例来源:origin: com.h2database/h2

  1. @Override
  2. protected Cursor run() throws Exception {
  3. if (topFutureCursor == null) {
  4. // if the top cursor is empty then the whole query will produce
  5. // empty result
  6. return EMPTY_CURSOR;
  7. }
  8. viewIndex.setupQueryParameters(viewIndex.getSession(), first, last, null);
  9. JoinBatch.this.viewTopFutureCursor = topFutureCursor;
  10. ResultInterface localResult;
  11. boolean lazy = false;
  12. try {
  13. localResult = viewIndex.getQuery().query(0);
  14. lazy = localResult.isLazy();
  15. } finally {
  16. if (!lazy) {
  17. resetViewTopFutureCursorAfterQuery();
  18. }
  19. }
  20. return newCursor(localResult);
  21. }

代码示例来源:origin: com.h2database/h2

  1. @Override
  2. public Value getValue(Session session) {
  3. query.setSession(session);
  4. try (ResultInterface result = query.query(2)) {
  5. Value v;
  6. if (!result.next()) {
  7. v = ValueNull.INSTANCE;
  8. } else {
  9. Value[] values = result.currentRow();
  10. if (result.getVisibleColumnCount() == 1) {
  11. v = values[0];
  12. } else {
  13. v = ValueArray.get(values);
  14. }
  15. if (result.hasNext()) {
  16. throw DbException.get(ErrorCode.SCALAR_SUBQUERY_CONTAINS_MORE_THAN_ONE_ROW);
  17. }
  18. }
  19. return v;
  20. }
  21. }

代码示例来源:origin: com.h2database/h2

  1. @Override
  2. public int update() {
  3. // clear list of source table keys & rowids we have processed already
  4. targetRowidsRemembered.clear();
  5. if (targetTableFilter != null) {
  6. targetTableFilter.startQuery(session);
  7. targetTableFilter.reset();
  8. }
  9. if (sourceTableFilter != null) {
  10. sourceTableFilter.startQuery(session);
  11. sourceTableFilter.reset();
  12. }
  13. sourceQueryRowNumber = 0;
  14. checkRights();
  15. setCurrentRowNumber(0);
  16. // process source select query data for row creation
  17. ResultInterface rows = query.query(0);
  18. targetTable.fire(session, evaluateTriggerMasks(), true);
  19. targetTable.lock(session, true, false);
  20. while (rows.next()) {
  21. sourceQueryRowNumber++;
  22. Value[] sourceRowValues = rows.currentRow();
  23. Row sourceRow = new RowImpl(sourceRowValues, 0);
  24. setCurrentRowNumber(sourceQueryRowNumber);
  25. merge(sourceRow);
  26. }
  27. rows.close();
  28. targetTable.fire(session, evaluateTriggerMasks(), false);
  29. return countUpdatedRows;
  30. }

代码示例来源:origin: com.h2database/h2

  1. ResultInterface rows = query.query(0);
  2. count = 0;
  3. table.fire(session, Trigger.UPDATE | Trigger.INSERT, true);

代码示例来源:origin: com.h2database/h2

  1. query.setDistinct(true);
  2. ResultInterface rows = query.query(0);
  3. Value l = left.getValue(session);
  4. if (!rows.hasNext()) {

代码示例来源:origin: com.h2database/h2

  1. table.lock(session, true, false);
  2. if (insertFromSelect) {
  3. query.query(0, this);
  4. } else {
  5. ResultInterface rows = query.query(0);
  6. while (rows.next()) {
  7. generatedKeys.nextRow();

代码示例来源:origin: com.h2database/h2

  1. ResultInterface rows = query.query(0);
  2. count = 0;
  3. targetTable.fire(session, Trigger.UPDATE | Trigger.INSERT, true);

代码示例来源:origin: com.h2database/h2

  1. ResultInterface resultInterface = left.query(0);
  2. LocalResult localResult = union.getEmptyResult();
  3. resultInterface = right.query(0);
  4. if (!resultInterface.hasNext()) {
  5. break;

代码示例来源:origin: com.h2database/h2

  1. if (sort == null && !distinct && maxRows == 0 &&
  2. offsetExpr == null && limitExpr == null) {
  3. left.query(0, target);
  4. right.query(0, target);
  5. return null;
  6. DbException.throwInternalError("type=" + unionType);
  7. ResultInterface l = left.query(0);
  8. ResultInterface r = right.query(0);
  9. l.reset();
  10. r.reset();

代码示例来源:origin: com.eventsourcing/h2

  1. /**
  2. * Get the current result of the expression. The rows may not be of the same
  3. * type, therefore the rows may not be unique.
  4. *
  5. * @return the result
  6. */
  7. public ResultInterface getCurrentResult() {
  8. return expressionQuery.query(0);
  9. }

代码示例来源:origin: org.wowtools/h2

  1. @Override
  2. public LocalResult query(int maxrows) {
  3. return query(maxrows, null);
  4. }

代码示例来源:origin: org.wowtools/h2

  1. private Cursor find(Session session, SearchRow first, SearchRow last,
  2. SearchRow intersection) {
  3. if (recursive) {
  4. return findRecursive(first, last);
  5. }
  6. setupQueryParameters(session, first, last, intersection);
  7. LocalResult result = query.query(0);
  8. return new ViewCursor(this, result, first, last);
  9. }

代码示例来源:origin: com.h2database/com.springsource.org.h2

  1. public Value getValue(Session session) throws SQLException {
  2. query.setSession(session);
  3. LocalResult result = query.query(1);
  4. session.addTemporaryResult(result);
  5. boolean r = result.getRowCount() > 0;
  6. return ValueBoolean.get(r);
  7. }

代码示例来源:origin: com.eventsourcing/h2

  1. @Override
  2. public Value getValue(Session session) {
  3. query.setSession(session);
  4. LocalResult result = query.query(1);
  5. session.addTemporaryResult(result);
  6. boolean r = result.getRowCount() > 0;
  7. return ValueBoolean.get(r);
  8. }

相关文章