Esempio n. 1
0
  public void removeSpecificRoutine(Routine routine) {

    for (int i = 0; i < this.routines.length; i++) {
      if (routines[i] == routine) {
        routines = (Routine[]) ArrayUtil.toAdjustedArray(routines, null, i, -1);

        break;
      }
    }
  }
  /**
   * Removes any foreign key Constraint objects (exported keys) held by any tables referenced by the
   * specified table.
   *
   * <p>This method is called as the last step of a successful call to dropTable() in order to
   * ensure that the dropped Table ceases to be referenced when enforcing referential integrity.
   *
   * @param toDrop The table to which other tables may be holding keys. This is a table that is in
   *     the process of being dropped.
   */
  void removeExportedKeys(Table toDrop) {

    for (int i = 0; i < tTable.size(); i++) {
      Table table = (Table) tTable.get(i);

      for (int j = table.constraintList.length - 1; j >= 0; j--) {
        Table refTable = table.constraintList[j].getRef();

        if (toDrop == refTable) {
          table.constraintList =
              (Constraint[]) ArrayUtil.toAdjustedArray(table.constraintList, null, j, -1);
        }
      }
    }
  }
  public void resetAccessorKeys(Index[] keys) {

    if (indexList.length == 0 || indexList[0] == null || accessorList[0] == null) {
      indexList = keys;
      accessorList = new CachedObject[indexList.length];

      return;
    }

    CachedObject[] oldAccessors = accessorList;
    Index[] oldIndexList = indexList;
    int limit = indexList.length;
    int diff = 1;
    int position = 0;

    if (keys.length < indexList.length) {
      diff = -1;
      limit = keys.length;
    }

    for (; position < limit; position++) {
      if (indexList[position] != keys[position]) {
        break;
      }
    }

    accessorList = (CachedObject[]) ArrayUtil.toAdjustedArray(accessorList, null, position, diff);
    indexList = keys;

    try {
      if (diff > 0) {
        insertIndexNodes(indexList[0], indexList[position]);
      } else {
        dropIndexFromRows(indexList[0], oldIndexList[position]);
      }
    } catch (HsqlException e) {
      accessorList = oldAccessors;
      indexList = oldIndexList;

      throw e;
    }
  }
  public void resolveRangeTable(Session session, RangeGroup rangeGroup, RangeGroup[] rangeGroups) {

    QueryExpression queryExpression = rangeTable.getQueryExpression();
    Expression dataExpression = rangeTable.getDataExpression();

    if (queryExpression == null && dataExpression == null) {
      return;
    }

    rangeGroups =
        (RangeGroup[]) ArrayUtil.toAdjustedArray(rangeGroups, rangeGroup, rangeGroups.length, 1);

    if (dataExpression != null) {
      HsqlList unresolved =
          dataExpression.resolveColumnReferences(session, RangeGroup.emptyGroup, rangeGroups, null);

      unresolved =
          Expression.resolveColumnSet(
              session, RangeVariable.emptyArray, RangeGroup.emptyArray, unresolved);

      ExpressionColumn.checkColumnsResolved(unresolved);
      dataExpression.resolveTypes(session, null);
      setRangeTableVariables();
    }

    if (queryExpression != null) {
      queryExpression.resolveReferences(session, rangeGroups);

      HsqlList unresolved = queryExpression.getUnresolvedExpressions();

      unresolved =
          Expression.resolveColumnSet(
              session, RangeVariable.emptyArray, RangeGroup.emptyArray, unresolved);

      ExpressionColumn.checkColumnsResolved(unresolved);
      queryExpression.resolveTypesPartOne(session);
      queryExpression.resolveTypesPartTwo(session);
      rangeTable.prepareTable();
      setRangeTableVariables();
    }
  }