Exemplo n.º 1
0
  // -----------------
  // Constructors
  // -----------------
  public DB2Table(DBRProgressMonitor monitor, DB2Schema schema, ResultSet dbResult)
      throws DBException {
    super(monitor, schema, dbResult);

    this.status =
        CommonUtils.valueOf(DB2TableStatus.class, JDBCUtils.safeGetString(dbResult, "STATUS"));
    this.type = CommonUtils.valueOf(DB2TableType.class, JDBCUtils.safeGetString(dbResult, "TYPE"));
    this.statsTime = JDBCUtils.safeGetTimestamp(dbResult, "STATS_TIME");

    this.dataCapture = JDBCUtils.safeGetString(dbResult, "DATACAPTURE");
    this.constChecked = JDBCUtils.safeGetString(dbResult, "CONST_CHECKED");
    this.partitionMode =
        CommonUtils.valueOf(
            DB2TablePartitionMode.class, JDBCUtils.safeGetString(dbResult, "PARTITION_MODE"));
    this.append = JDBCUtils.safeGetBoolean(dbResult, "APPEND_MODE", DB2YesNo.Y.name());
    this.volatileMode = JDBCUtils.safeGetString(dbResult, "VOLATILE");
    this.compression =
        CommonUtils.valueOf(
            DB2TableCompressionMode.class, JDBCUtils.safeGetString(dbResult, "COMPRESSION"));
    this.accessMode =
        CommonUtils.valueOf(
            DB2TableAccessMode.class, JDBCUtils.safeGetString(dbResult, "ACCESS_MODE"));
    this.mdcClustered = JDBCUtils.safeGetBoolean(dbResult, "CLUSTERED", DB2YesNo.Y.name());
    this.dropRule =
        CommonUtils.valueOf(DB2TableDropRule.class, JDBCUtils.safeGetString(dbResult, "DROPRULE"));

    this.card = JDBCUtils.safeGetLongNullable(dbResult, "CARD");
    this.nPages = JDBCUtils.safeGetLongNullable(dbResult, "NPAGES");
    this.fPages = JDBCUtils.safeGetLongNullable(dbResult, "FPAGES");
    this.overFLow = JDBCUtils.safeGetLongNullable(dbResult, "OVERFLOW");

    this.invalidateTime = JDBCUtils.safeGetTimestamp(dbResult, "INVALIDATE_TIME");
    this.lastRegenTime = JDBCUtils.safeGetTimestamp(dbResult, "LAST_REGEN_TIME");
    if (getDataSource().isAtLeastV9_5()) {
      this.alterTime = JDBCUtils.safeGetTimestamp(dbResult, "ALTER_TIME");
    }
    if (getDataSource().isAtLeastV10_1()) {
      this.temporalType =
          CommonUtils.valueOf(
              DB2TableTemporalType.class, JDBCUtils.safeGetString(dbResult, "TEMPORALTYPE"));
    }

    String lockSizeString = JDBCUtils.safeGetString(dbResult, "LOCKSIZE");
    if (CommonUtils.isNotEmpty(lockSizeString)) {
      this.lockSize = CommonUtils.valueOf(DB2TableLockSize.class, lockSizeString);
    }

    this.tablespace = JDBCUtils.safeGetString(dbResult, "TBSPACE");
    this.indexTablespace = JDBCUtils.safeGetString(dbResult, "INDEX_TBSPACE");
    this.longTablespace = JDBCUtils.safeGetString(dbResult, "LONG_TBSPACE");

    this.partitionCache =
        new JDBCObjectSimpleCache<>(DB2TablePartition.class, C_PT, schema.getName(), getName());
    this.periodCache =
        new JDBCObjectSimpleCache<>(DB2TablePeriod.class, C_PE, schema.getName(), getName());
  }
Exemplo n.º 2
0
  // -----------------
  // Constructors
  // -----------------
  public DB2Index(
      DBRProgressMonitor monitor, DB2Schema schema, DB2TableBase table, ResultSet dbResult) {
    super(schema, table, JDBCUtils.safeGetStringTrimmed(dbResult, "INDNAME"), null, true);

    DB2DataSource db2DataSource = (DB2DataSource) schema.getDataSource();

    this.uniqueRule =
        CommonUtils.valueOf(DB2UniqueRule.class, JDBCUtils.safeGetString(dbResult, "UNIQUERULE"));
    this.colCount = JDBCUtils.safeGetInteger(dbResult, "COLCOUNT");
    this.uniqueColCount = JDBCUtils.safeGetInteger(dbResult, "UNIQUE_COLCOUNT");
    this.pctFree = JDBCUtils.safeGetInteger(dbResult, "PCTFREE");
    this.indexId = JDBCUtils.safeGetInteger(dbResult, "IID");
    this.minPctUsed = JDBCUtils.safeGetInteger(dbResult, "MINPCTUSED");
    this.reverseScans = JDBCUtils.safeGetBoolean(dbResult, "REVERSE_SCANS", DB2YesNo.Y.name());
    this.tablespaceId = JDBCUtils.safeGetInteger(dbResult, "TBSPACEID");
    this.pageSplit =
        CommonUtils.valueOf(
            DB2IndexPageSplit.class, JDBCUtils.safeGetStringTrimmed(dbResult, "PAGESPLIT"));
    this.remarks = JDBCUtils.safeGetString(dbResult, "REMARKS");

    this.createTime = JDBCUtils.safeGetTimestamp(dbResult, "CREATE_TIME");
    this.madeUnique = JDBCUtils.safeGetBoolean(dbResult, "MADE_UNIQUE");

    this.statsTime = JDBCUtils.safeGetTimestamp(dbResult, "STATS_TIME");
    this.fullKeycard = JDBCUtils.safeGetLong(dbResult, "FULLKEYCARD");
    this.firstKeycard = JDBCUtils.safeGetLong(dbResult, "FIRSTKEYCARD");
    this.first2Keycard = JDBCUtils.safeGetLong(dbResult, "FIRST2KEYCARD");
    this.first3Keycard = JDBCUtils.safeGetLong(dbResult, "FIRST3KEYCARD");
    this.first4Keycard = JDBCUtils.safeGetLong(dbResult, "FIRST4KEYCARD");
    this.clusterRatio = JDBCUtils.safeGetInteger(dbResult, "CLUSTERRATIO");

    if (db2DataSource.isAtLeastV9_5()) {
      this.compression = JDBCUtils.safeGetBoolean(dbResult, "COMPRESSION", DB2YesNo.Y.name());
    }

    // DF: Could have been done in constructor. More "readable" to do it here
    this.db2IndexType =
        CommonUtils.valueOf(
            DB2IndexType.class, JDBCUtils.safeGetStringTrimmed(dbResult, "INDEXTYPE"));
    this.indexType = db2IndexType.getDBSIndexType();
  }
Exemplo n.º 3
0
  // -----------------------
  // Constructors
  // -----------------------
  public DB2Sequence(DB2Schema schema, ResultSet dbResult) {
    super(schema, JDBCUtils.safeGetString(dbResult, "SEQNAME"), true);

    DB2DataSource db2DataSource = schema.getDataSource();

    this.owner = JDBCUtils.safeGetString(dbResult, "OWNER");
    this.seqId = JDBCUtils.safeGetInteger(dbResult, "SEQID");
    this.seqType =
        CommonUtils.valueOf(DB2SequenceType.class, JDBCUtils.safeGetString(dbResult, "SEQTYPE"));
    this.incrementBy = JDBCUtils.safeGetLong(dbResult, "INCREMENT");
    this.start = JDBCUtils.safeGetLong(dbResult, "START");
    this.maxValue = JDBCUtils.safeGetLong(dbResult, "MAXVALUE");
    this.minValue = JDBCUtils.safeGetLong(dbResult, "MINVALUE");
    this.nextCacheFirstValue = JDBCUtils.safeGetLong(dbResult, "NEXTCACHEFIRSTVALUE");
    this.cycle = JDBCUtils.safeGetBoolean(dbResult, "CYCLE", DB2YesNo.Y.name());
    this.cache = JDBCUtils.safeGetInteger(dbResult, "CACHE");
    this.order = JDBCUtils.safeGetBoolean(dbResult, "ORDER", DB2YesNo.Y.name());
    this.dataTypeId = JDBCUtils.safeGetInteger(dbResult, "DATATYPEID");
    this.sourceTypeId = JDBCUtils.safeGetInteger(dbResult, "SOURCETYPEID");
    this.createTime = JDBCUtils.safeGetTimestamp(dbResult, "CREATE_TIME");
    this.alterTime = JDBCUtils.safeGetTimestamp(dbResult, "ALTER_TIME");
    this.precision =
        DB2SequencePrecision.getFromDataType(JDBCUtils.safeGetInteger(dbResult, "PRECISION"));
    this.origin =
        CommonUtils.valueOf(DB2OwnerType.class, JDBCUtils.safeGetString(dbResult, "ORIGIN"));
    this.remarks = JDBCUtils.safeGetString(dbResult, "REMARKS");

    if (db2DataSource.isAtLeastV9_5()) {
      this.ownerType =
          CommonUtils.valueOf(DB2OwnerType.class, JDBCUtils.safeGetString(dbResult, "OWNERTYPE"));
    }
    if (db2DataSource.isAtLeastV9_7()) {
      this.baseSchema = JDBCUtils.safeGetStringTrimmed(dbResult, "BASE_SEQSCHEMA");
      this.baseSequence = JDBCUtils.safeGetString(dbResult, "BASE_SEQNAME");
    }
  }