Exemplo n.º 1
0
  /*
      RangeVariable(Table table, String alias, OrderedHashSet columnList,
                    Index index, CompileContext compileContext) {

          rangeTable       = table;
          tableAlias       = alias;
          columnAliases    = columnList;
          emptyData        = rangeTable.getEmptyRowData();
          columnsInGroupBy = rangeTable.getNewColumnCheckList();
          usedColumns      = rangeTable.getNewColumnCheckList();
          rangeIndex       = index;

          compileContext.registerRangeVariable(this);
      }
  */
  RangeVariable(RangeVariable range) {

    rangeTable = range.rangeTable;
    tableAlias = null;
    emptyData = rangeTable.getEmptyRowData();
    columnsInGroupBy = rangeTable.getNewColumnCheckList();
    usedColumns = rangeTable.getNewColumnCheckList();
    rangeIndex = rangeTable.getPrimaryIndex();
    rangePosition = range.rangePosition;
    level = range.level;
  }
  public void setRangeTableVariables() {

    if (columnAliasNames != null && rangeTable.getColumnCount() != columnAliasNames.length) {
      throw Error.error(ErrorCode.X_42593);
    }

    emptyData = rangeTable.getEmptyRowData();
    columnsInGroupBy = rangeTable.getNewColumnCheckList();
    usedColumns = rangeTable.getNewColumnCheckList();
    joinConditions[0].rangeIndex = rangeTable.getPrimaryIndex();
  }
  public RangeVariable(Table table, int position) {

    rangeType = TABLE_RANGE;
    rangeTable = table;
    tableAlias = null;
    emptyData = rangeTable.getEmptyRowData();
    columnsInGroupBy = rangeTable.getNewColumnCheckList();
    usedColumns = rangeTable.getNewColumnCheckList();
    rangePosition = position;
    joinConditions = new RangeVariableConditions[] {new RangeVariableConditions(this, true)};
    whereConditions = new RangeVariableConditions[] {new RangeVariableConditions(this, false)};
  }
  /**
   * Chooses certain query conditions and assigns a copy of them to this filter. The original
   * condition is set to Expression.TRUE once assigned.
   *
   * @param condition
   * @throws HsqlException
   */
  void setConditions(Expression condition) throws HsqlException {

    setCondition(condition);

    if (filterIndex == null) {
      filterIndex = filterTable.getPrimaryIndex();
    }

    if (filterIndex.getVisibleColumns() == 1
        || eStart == null
        || eAnd == null
        || eStart.exprType != Expression.EQUAL) {
      return;
    }

    boolean[] check = filterTable.getNewColumnCheckList();
    Expression[] expr = new Expression[check.length];
    int colindex = eStart.getArg().getColumnNr();

    check[colindex] = true;
    expr[colindex] = eStart.getArg2();

    eAnd.getEquiJoinColumns(this, check, expr);

    if (ArrayUtil.containsAllTrueElements(check, filterIndex.colCheck)) {
      isMultiFindFirst = true;
      findFirstExpressions = expr;
    }
  }
Exemplo n.º 5
0
  /**
   * Constructor declaration
   *
   * @param name HsqlName of the index
   * @param table table of the index
   * @param column array of column indexes
   * @param type array of column types
   * @param unique is this a unique index
   * @param constraint does this index belonging to a constraint
   * @param forward is this an auto-index for an FK that refers to a table defined after this table
   * @param visColumns count of visible columns
   */
  Index(
      Database database,
      HsqlName name,
      Table table,
      int[] column,
      int[] type,
      boolean isPk,
      boolean unique,
      boolean constraint,
      boolean forward,
      int[] pkcols,
      int[] pktypes,
      boolean temp) {

    indexName = name;
    colIndex = column;
    colType = type;
    pkCols = pkcols;
    pkTypes = pktypes;
    isUnique = unique;
    isConstraint = constraint;
    isForward = forward;
    useRowId = (!isUnique && pkCols.length == 0) || (colIndex.length == 0);
    colCheck = table.getNewColumnCheckList();

    ArrayUtil.intIndexesToBooleanArray(colIndex, colCheck);

    updatableIterators = Index.emptyIterator;
    updatableIterators.next = updatableIterators.last = updatableIterators;
    collation = database.collation;
    isTemp = temp;
    onCommitPreserve = table.onCommitPreserve;
  }
Exemplo n.º 6
0
  RangeVariable(
      Table table,
      SimpleName alias,
      OrderedHashSet columnList,
      SimpleName[] columnNameList,
      CompileContext compileContext) {

    rangeTable = table;
    tableAlias = alias;
    columnAliases = columnList;
    columnAliasNames = columnNameList;
    emptyData = rangeTable.getEmptyRowData();
    columnsInGroupBy = rangeTable.getNewColumnCheckList();
    usedColumns = rangeTable.getNewColumnCheckList();
    rangeIndex = rangeTable.getPrimaryIndex();

    compileContext.registerRangeVariable(this);
  }