private int getDataType(ColumnMetadata value) { switch (value.getDataType()) { case "ARRAY": return Types.ARRAY;
output.writeBool(7, message.getIsNullable(), false); if(message.hasDataType()) output.writeString(8, message.getDataType(), false); if(message.hasCharMaxLength()) output.writeInt32(9, message.getCharMaxLength(), false);
Integer getDecimalDigits(ColumnMetadata value) { switch(value.getDataType()) { case "TINYINT": case "SMALLINT": case "INTEGER": case "BIGINT": case "DECIMAL": case "NUMERIC": return value.hasNumericScale() ? value.getNumericScale() : null; case "REAL": return DECIMAL_DIGITS_REAL; case "FLOAT": return DECIMAL_DIGITS_FLOAT; case "DOUBLE": return DECIMAL_DIGITS_DOUBLE; case "DATE": case "TIME": case "TIMESTAMP": case "INTERVAL": return value.getDateTimePrecision(); default: return null; } }
private Integer getNumPrecRadix(ColumnMetadata value) { switch(value.getDataType()) { case "TINYINT": case "SMALLINT": case "INTEGER": case "BIGINT": case "DECIMAL": case "NUMERIC": case "REAL": case "FLOAT": case "DOUBLE": return value.getNumericPrecisionRadix(); case "INTERVAL": return RADIX_INTERVAL; case "DATE": case "TIME": case "TIMESTAMP": return RADIX_DATETIME; default: return null; } }
@Override protected MetaColumn adapt(ColumnMetadata value) { return new MetaColumn( value.getCatalogName(), value.getSchemaName(), value.getTableName(), value.getColumnName(), getDataType(value), // It might require the full SQL type value.getDataType(), value.getColumnSize(), getDecimalDigits(value), getNumPrecRadix(value), getNullable(value), getCharOctetLength(value), value.getOrdinalPosition(), getIsNullable(value)); } }.getMeta(connection.getClient().getColumns(catalogNameFilter, schemaNameFilter, tableNameFilter, columnNameFilter));
private Integer getCharOctetLength(ColumnMetadata value) { if (!value.hasCharMaxLength()) { return null; } switch(value.getDataType()) { case "CHARACTER": case "CHARACTER LARGE OBJECT": case "CHARACTER VARYING": case "LONGVARCHAR": case "LONGNVARCHAR": case "NATIONAL CHARACTER": case "NATIONAL CHARACTER LARGE OBJECT": case "NATIONAL CHARACTER VARYING": return value.getCharOctetLength(); default: return null; } }
/** * <code>optional string data_type = 8;</code> */ public Builder clearDataType() { bitField0_ = (bitField0_ & ~0x00000080); dataType_ = getDefaultInstance().getDataType(); onChanged(); return this; } /**
private int getDataType(ColumnMetadata value) { switch (value.getDataType()) { case "ARRAY": return Types.ARRAY;
output.writeBool(7, message.getIsNullable(), false); if(message.hasDataType()) output.writeString(8, message.getDataType(), false); if(message.hasCharMaxLength()) output.writeInt32(9, message.getCharMaxLength(), false);
Integer getDecimalDigits(ColumnMetadata value) { switch(value.getDataType()) { case "TINYINT": case "SMALLINT": case "INTEGER": case "BIGINT": case "DECIMAL": case "NUMERIC": return value.hasNumericScale() ? value.getNumericScale() : null; case "REAL": return DECIMAL_DIGITS_REAL; case "FLOAT": return DECIMAL_DIGITS_FLOAT; case "DOUBLE": return DECIMAL_DIGITS_DOUBLE; case "DATE": case "TIME": case "TIMESTAMP": case "INTERVAL": return value.getDateTimePrecision(); default: return null; } }
private Integer getNumPrecRadix(ColumnMetadata value) { switch(value.getDataType()) { case "TINYINT": case "SMALLINT": case "INTEGER": case "BIGINT": case "DECIMAL": case "NUMERIC": case "REAL": case "FLOAT": case "DOUBLE": return value.getNumericPrecisionRadix(); case "INTERVAL": return RADIX_INTERVAL; case "DATE": case "TIME": case "TIMESTAMP": return RADIX_DATETIME; default: return null; } }
@Override protected MetaColumn adapt(ColumnMetadata value) { return new MetaColumn( value.getCatalogName(), value.getSchemaName(), value.getTableName(), value.getColumnName(), getDataType(value), // It might require the full SQL type value.getDataType(), value.getColumnSize(), getDecimalDigits(value), getNumPrecRadix(value), getNullable(value), getCharOctetLength(value), value.getOrdinalPosition(), getIsNullable(value)); } }.getMeta(connection.getClient().getColumns(catalogNameFilter, schemaNameFilter, tableNameFilter, columnNameFilter));
private Integer getCharOctetLength(ColumnMetadata value) { if (!value.hasCharMaxLength()) { return null; } switch(value.getDataType()) { case "CHARACTER": case "CHARACTER LARGE OBJECT": case "CHARACTER VARYING": case "LONGVARCHAR": case "LONGNVARCHAR": case "NATIONAL CHARACTER": case "NATIONAL CHARACTER LARGE OBJECT": case "NATIONAL CHARACTER VARYING": return value.getCharOctetLength(); default: return null; } }
/** * <code>optional string data_type = 8;</code> */ public Builder clearDataType() { bitField0_ = (bitField0_ & ~0x00000080); dataType_ = getDefaultInstance().getDataType(); onChanged(); return this; } /**