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

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

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

Query.prepare介绍

[英]Prepare join batching.
[中]准备加入配料。

代码示例

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

/**
 * Optimize a query. This will remember the subquery info, clear it, prepare
 * the query, and reset the subquery info.
 *
 * @param query the query to prepare
 */
public void optimizeQueryExpression(Query query) {
  // we have to hide current subQueryInfo if we are going to optimize
  // query expression
  SubQueryInfo tmp = subQueryInfo;
  subQueryInfo = null;
  preparingQueryExpression++;
  try {
    query.prepare();
  } finally {
    subQueryInfo = tmp;
    preparingQueryExpression--;
  }
}

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

Query theQuery, String[] querySQLOutput) {
List<Column> columnTemplateList = new ArrayList<>();
theQuery.prepare();

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

query.prepare();
if (query.getColumnCount() != columns.length) {
  throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

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

left.prepare();
right.prepare();
int len = left.getColumnCount();

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

query.prepare();
if (query.getColumnCount() != columns.length) {
  throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

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

query.prepare();
if (query.getColumnCount() != columns.length) {
  throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

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

query.prepare();
if (query.getColumnCount() != columns.length) {
  throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

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

try {
  query = parseSelect();
  query.prepare();
} finally {
  session.setParsingCreateView(false, viewName);

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

asQuery.prepare();
if (data.columns.isEmpty()) {
  generateColumnsFromQuery();

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

public Expression optimize(Session session) throws SQLException {
  query.prepare();
  return this;
}

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

public Expression optimize(Session session) throws SQLException {
  query.prepare();
  return this;
}

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

/**
 * Optimize a query. This will remember the subquery info, clear it, prepare
 * the query, and reset the subquery info.
 *
 * @param query the query to prepare
 */
public void optimizeQueryExpression(Query query) {
  // we have to hide current subQueryInfo if we are going to optimize
  // query expression
  SubQueryInfo tmp = subQueryInfo;
  subQueryInfo = null;
  preparingQueryExpression++;
  try {
    query.prepare();
  } finally {
    subQueryInfo = tmp;
    preparingQueryExpression--;
  }
}

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

/**
 * Optimize a query. This will remember the subquery info, clear it, prepare
 * the query, and reset the subquery info.
 *
 * @param query the query to prepare
 */
public void optimizeQueryExpression(Query query) {
  // we have to hide current subQueryInfo if we are going to optimize
  // query expression
  SubQueryInfo tmp = subQueryInfo;
  subQueryInfo = null;
  preparingQueryExpression++;
  try {
    query.prepare();
  } finally {
    subQueryInfo = tmp;
    preparingQueryExpression--;
  }
}

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

public Expression optimize(Session session) throws SQLException {
  left = left.optimize(session);
  if (left == ValueExpression.NULL) {
    return left;
  }
  query.prepare();
  if (query.getColumnCount() != 1) {
    throw Message.getSQLException(ErrorCode.SUBQUERY_IS_NOT_SINGLE_COLUMN);
  }
  // Can not optimize IN(SELECT...): the data may change
  // However, could transform to an inner join
  return this;
}

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

query.prepare();
if (query.getColumnCount() != columns.length) {
  throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

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

left.prepare();
right.prepare();
int len = left.getColumnCount();

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

private Query parserWith() throws SQLException {
  String tempViewName = readIdentifierWithSchema();
  Schema schema = getSchema();
  TableData recursiveTable;
  read("(");
  String[] cols = parseColumnList();
  ObjectArray columns = new ObjectArray();
  for (int i = 0; i < cols.length; i++) {
    columns.add(new Column(cols[i], Value.STRING));
  }
  int id = database.allocateObjectId(true, true);
  recursiveTable = schema.createTable(tempViewName, id, columns, false, false);
  recursiveTable.setTemporary(true);
  session.addLocalTempTable(recursiveTable);
  String querySQL = StringCache.getNew(sqlCommand.substring(parseIndex));
  read("AS");
  Query withQuery = parseSelect();
  withQuery.prepare();
  session.removeLocalTempTable(recursiveTable);
  id = database.allocateObjectId(true, true);
  TableView view = new TableView(schema, id, tempViewName, querySQL, null, cols, session, true);
  view.setTemporary(true);
  // view.setOnCommitDrop(true);
  session.addLocalTempTable(view);
  Query query = parseSelect();
  query.prepare();
  query.setPrepareAlways(true);
  // session.removeLocalTempTable(view);
  return query;
}

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

public void prepare() throws SQLException {
  if (columns == null) {
    if (list.size() > 0 && ((Expression[]) list.get(0)).length == 0) {
      // special case where table is used as a sequence
      columns = new Column[0];
    } else {
      columns = table.getColumns();
    }
  }
  if (list.size() > 0) {
    for (int x = 0; x < list.size(); x++) {
      Expression[] expr = (Expression[]) list.get(x);
      if (expr.length != columns.length) {
        throw Message.getSQLException(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);
      }
      for (int i = 0; i < expr.length; i++) {
        Expression e = expr[i];
        if (e != null) {
          expr[i] = e.optimize(session);
        }
      }
    }
  } else {
    query.prepare();
    if (query.getColumnCount() != columns.length) {
      throw Message.getSQLException(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);
    }
  }
}

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

public void prepare() throws SQLException {
  if (columns == null) {
    if (list.size() > 0 && ((Expression[]) list.get(0)).length == 0) {
      // special case where table is used as a sequence
      columns = new Column[0];
    } else {
      columns = table.getColumns();
    }
  }
  if (list.size() > 0) {
    for (int x = 0; x < list.size(); x++) {
      Expression[] expr = (Expression[]) list.get(x);
      if (expr.length != columns.length) {
        throw Message.getSQLException(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);
      }
      for (int i = 0; i < expr.length; i++) {
        Expression e = expr[i];
        if (e != null) {
          expr[i] = e.optimize(session);
        }
      }
    }
  } else {
    query.prepare();
    if (query.getColumnCount() != columns.length) {
      throw Message.getSQLException(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);
    }
  }
}

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

private CreateView parseCreateView(boolean force) throws SQLException {
  boolean ifNotExists = readIfNoExists();
  String viewName = readIdentifierWithSchema();
  CreateView command = new CreateView(session, getSchema());
  this.prepared = command;
  command.setViewName(viewName);
  command.setIfNotExists(ifNotExists);
  command.setComment(readCommentIf());
  if (readIf("(")) {
    String[] cols = parseColumnList();
    command.setColumnNames(cols);
  }
  String select = StringCache.getNew(sqlCommand.substring(parseIndex));
  read("AS");
  try {
    Query query = parseSelect();
    query.prepare();
    command.setSelect(query);
  } catch (SQLException e) {
    if (force) {
      command.setSelectSQL(select);
    } else {
      throw e;
    }
  }
  return command;
}

相关文章