示例#1
0
  // -----------------------
  // Constructors
  // -----------------------
  public DB2Grantee(
      DBRProgressMonitor monitor,
      DB2DataSource dataSource,
      ResultSet resultSet,
      String keyColName) {
    super(dataSource, true);
    this.name = JDBCUtils.safeGetStringTrimmed(resultSet, keyColName);

    cachePerObject = new HashMap<>(12);
  }
示例#2
0
  public DB2RoutineParm(DBRProgressMonitor monitor, DB2Routine procedure, ResultSet dbResult)
      throws DBException {
    super();

    this.procedure = procedure;

    DB2DataSource db2DataSource = getDataSource();

    this.name = JDBCUtils.safeGetStringTrimmed(dbResult, "PARMNAME");
    this.scale = JDBCUtils.safeGetInteger(dbResult, "SCALE");
    this.length = JDBCUtils.safeGetInteger(dbResult, "LENGTH");
    this.remarks = JDBCUtils.safeGetStringTrimmed(dbResult, "REMARKS");
    this.rowType =
        CommonUtils.valueOf(DB2RoutineRowType.class, JDBCUtils.safeGetString(dbResult, "ROWTYPE"));

    String typeSchemaName = JDBCUtils.safeGetStringTrimmed(dbResult, "TYPESCHEMA");
    String typeModuleName = JDBCUtils.safeGetStringTrimmed(dbResult, "TYPEMODULENAME");
    this.typeName = JDBCUtils.safeGetStringTrimmed(dbResult, "TYPENAME");
    this.dataTypeSchema = db2DataSource.getSchema(monitor, typeSchemaName);

    // -------------------
    // Search for DataType
    // -------------------

    // First Search in System/Standard Data Types
    this.dataType = db2DataSource.getLocalDataType(typeName);
    if (this.dataType != null) {
      return;
    }

    // Not found : Search for a UDT in Module
    if (typeModuleName != null) {
      DB2Module db2Module =
          DB2Utils.findModuleBySchemaNameAndName(
              monitor, db2DataSource, typeSchemaName, typeModuleName);
      this.dataType = db2Module.getType(monitor, typeName);
      return;
    }

    // Not found, search for a UDT
    this.dataType = this.dataTypeSchema.getUDT(monitor, typeName);
  }
示例#3
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();
  }
示例#4
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");
    }
  }