Пример #1
0
 public int getFieldJdbcType(int fieldOrdinal) {
   RelDataType type = getFieldNamedType(fieldOrdinal);
   SqlTypeName typeName = type.getSqlTypeName();
   if (typeName == null) {
     return Types.OTHER;
   }
   return typeName.getJdbcOrdinal();
 }
Пример #2
0
 public RelDataType getFieldType(int fieldOrdinal) {
   RelDataType namedType = getFieldNamedType(fieldOrdinal);
   if (namedType.getSqlTypeName() == SqlTypeName.DISTINCT) {
     // for most metadata calls, report information about the
     // predefined type on which the distinct type is based
     return namedType.getFields()[0].getType();
   } else {
     return namedType;
   }
 }
Пример #3
0
 public int getFieldScale(int fieldOrdinal) {
   RelDataType type = getFieldType(fieldOrdinal);
   SqlTypeName typeName = type.getSqlTypeName();
   if (typeName == null) {
     return 0;
   }
   if (typeName.allowsPrecScale(true, true)) {
     return type.getScale();
   } else {
     return 0;
   }
 }
Пример #4
0
 public String getFieldTypeName(int fieldOrdinal) {
   RelDataType type = getFieldNamedType(fieldOrdinal);
   SqlTypeName typeName = type.getSqlTypeName();
   if (typeName == null) {
     return type.toString();
   }
   switch (typeName) {
     case STRUCTURED:
     case DISTINCT:
       return type.getSqlIdentifier().toString();
     case INTERVAL_DAY_TIME:
     case INTERVAL_YEAR_MONTH:
       return type.toString();
   }
   return typeName.name();
 }
Пример #5
0
 /**
  * Creates a FarragoJdbcMetaDataImpl.
  *
  * @param rowType Type info to return
  * @param fieldOrigins Origin of each field in column of catalog object
  */
 protected FarragoJdbcMetaDataImpl(RelDataType rowType, List<List<String>> fieldOrigins) {
   this.rowType = rowType;
   this.fieldOrigins = fieldOrigins;
   assert rowType != null;
   assert fieldOrigins != null;
   assert fieldOrigins.size() == rowType.getFieldCount()
       : "field origins " + fieldOrigins + " have different count than row type " + rowType;
 }
Пример #6
0
 public int getFieldCount() {
   return rowType.getFieldCount();
 }
Пример #7
0
 public String getFieldName(int fieldOrdinal) {
   return rowType.getFields()[fieldOrdinal - 1].getName();
 }
Пример #8
0
 public RelDataType getFieldNamedType(int fieldOrdinal) {
   return rowType.getFields()[fieldOrdinal - 1].getType();
 }
Пример #9
0
 public boolean isFieldSearchable(int fieldOrdinal) {
   RelDataType type = getFieldType(fieldOrdinal);
   return RelDataTypeComparability.None != type.getComparability();
 }
Пример #10
0
 public int isFieldNullable(int fieldOrdinal) {
   RelDataType type = getFieldType(fieldOrdinal);
   return type.isNullable() ? ResultSetMetaData.columnNullable : ResultSetMetaData.columnNoNulls;
 }
Пример #11
0
 public int getFieldPrecision(int fieldOrdinal) {
   RelDataType type = getFieldType(fieldOrdinal);
   return type.getPrecision();
 }