Exemplo n.º 1
0
  /**
   * Used to update constrains to reflect structural changes in a table. Prior checks must ensure
   * that this method does not throw.
   *
   * @param session Session
   * @param oldTable reference to the old version of the table
   * @param newTable referenct to the new version of the table
   * @param colIndex index at which table column is added or removed
   * @param adjust -1, 0, +1 to indicate if column is added or removed @
   */
  void updateTable(Session session, Table oldTable, Table newTable, int colIndex, int adjust) {

    if (oldTable == core.mainTable) {
      core.mainTable = newTable;

      if (core.mainIndex != null) {
        core.mainIndex = core.mainTable.getIndex(core.mainIndex.getName().name);
        core.mainCols = ArrayUtil.toAdjustedColumnArray(core.mainCols, colIndex, adjust);
      }
    }

    if (oldTable == core.refTable) {
      core.refTable = newTable;

      if (core.refIndex != null) {
        core.refIndex = core.refTable.getIndex(core.refIndex.getName().name);
        core.refCols = ArrayUtil.toAdjustedColumnArray(core.refCols, colIndex, adjust);
      }
    }

    // CHECK
    if (constType == CHECK) {
      recompile(session, newTable);
    }
  }
Exemplo n.º 2
0
 void updateTable(
     Session paramSession, Table paramTable1, Table paramTable2, int paramInt1, int paramInt2) {
   if (paramTable1 == this.core.mainTable) {
     this.core.mainTable = paramTable2;
     if (this.core.mainIndex != null) {
       this.core.mainIndex = this.core.mainTable.getIndex(this.core.mainIndex.getName().name);
       this.core.mainCols =
           ArrayUtil.toAdjustedColumnArray(this.core.mainCols, paramInt1, paramInt2);
       this.core.mainIndex.setTable(paramTable2);
     }
   }
   if (paramTable1 == this.core.refTable) {
     this.core.refTable = paramTable2;
     if (this.core.refIndex != null) {
       this.core.refIndex = this.core.refTable.getIndex(this.core.refIndex.getName().name);
       this.core.refCols =
           ArrayUtil.toAdjustedColumnArray(this.core.refCols, paramInt1, paramInt2);
       this.core.refIndex.setTable(paramTable2);
     }
   }
   if (this.constType == 3) recompile(paramSession, paramTable2);
 }