Example #1
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);
  }
Example #2
0
 @Override
 public String getObjectDefinitionText(DBRProgressMonitor monitor) throws DBException {
   return DB2Utils.generateDDLforTable(monitor, LINE_SEPARATOR, getDataSource(), this);
 }