コード例 #1
0
ファイル: MetaUtils.java プロジェクト: snaga/stado
  /**
   * Returns the Maximum sequence number assigned to a column of the table with name 'tableName' in
   * the MetaData DB. Works off the cache only.
   *
   * <p>Returns -ve value if table is not found in the MetaData.
   */
  public static int getMaxColSeqNum(SysDatabase database, String tableName) {
    int maxSeq = -1000;

    SysTable sysTab = database.getSysTable(tableName);

    if (sysTab != null) {
      for (Iterator it = sysTab.getColumns().iterator(); it.hasNext(); ) {
        SysColumn aSysColumn = (SysColumn) it.next();
        if (aSysColumn.getColSeq() > maxSeq) {
          maxSeq = aSysColumn.getColSeq();
        }
      }
    }

    return maxSeq; // will be -ve if tableName not found
  }