📄 typeid.java
字号:
return getBuiltInTypeId(Types.LONGVARCHAR); } if (SQLTypeName.equals(TypeId.LONGVARBIT_NAME)) { return getBuiltInTypeId(Types.LONGVARBINARY); } if (SQLTypeName.equals(TypeId.BLOB_NAME)) { return getBuiltInTypeId(JDBC20Translation.SQL_TYPES_BLOB); } if (SQLTypeName.equals(TypeId.CLOB_NAME)) { return getBuiltInTypeId(JDBC20Translation.SQL_TYPES_CLOB); } if (SQLTypeName.equals(TypeId.XML_NAME)) { return getBuiltInTypeId(StoredFormatIds.XML_TYPE_ID); } TypeId ret = null; // Types defined below here are SQL types and non-JDBC types that are supported by Cloudscape if (SQLTypeName.equals(TypeId.NCLOB_NAME)) { ret = NCLOB_ID; if (ret == null) ret = NCLOB_ID = new TypeId(StoredFormatIds.NCLOB_TYPE_ID, new BaseTypeIdImpl(StoredFormatIds.NCLOB_TYPE_ID_IMPL)); } else if (SQLTypeName.equals(TypeId.NATIONAL_CHAR_NAME)) { ret = NATIONAL_CHAR_ID; if (ret == null) ret = NATIONAL_CHAR_ID = new TypeId(StoredFormatIds.NATIONAL_CHAR_TYPE_ID, new BaseTypeIdImpl(StoredFormatIds.NATIONAL_CHAR_TYPE_ID_IMPL)); } else if (SQLTypeName.equals(TypeId.NATIONAL_LONGVARCHAR_NAME)) { ret = NATIONAL_LONGVARCHAR_ID; if (ret == null) ret = NATIONAL_LONGVARCHAR_ID = new TypeId(StoredFormatIds.NATIONAL_LONGVARCHAR_TYPE_ID, new BaseTypeIdImpl(StoredFormatIds.NATIONAL_LONGVARCHAR_TYPE_ID_IMPL)); } else if (SQLTypeName.equals(TypeId.NATIONAL_VARCHAR_NAME)) { ret = NATIONAL_VARCHAR_ID; if (ret == null) ret = NATIONAL_VARCHAR_ID = new TypeId(StoredFormatIds.NATIONAL_VARCHAR_TYPE_ID, new BaseTypeIdImpl(StoredFormatIds.NATIONAL_VARCHAR_TYPE_ID_IMPL)); } else if (SQLTypeName.equals(TypeId.REF_NAME)) { ret = REF_ID; if (ret == null) ret = REF_ID = new TypeId(StoredFormatIds.REF_TYPE_ID, new BaseTypeIdImpl(StoredFormatIds.REF_TYPE_ID_IMPL)); } return ret; } /* ** Instance fields and methods */ private BaseTypeIdImpl baseTypeId; private int formatId; /* Set in setTypeIdSpecificInstanceVariables() as needed */ private boolean classNameWasDelimitedIdentifier; private boolean isBuiltIn = true; private boolean isBitTypeId; private boolean isLOBTypeId; private boolean isBooleanTypeId; private boolean isConcatableTypeId; private boolean isDecimalTypeId; private boolean isLongConcatableTypeId; private boolean isNumericTypeId; private boolean isRefTypeId; private boolean isStringTypeId; private boolean isFloatingPointTypeId; private boolean isRealTypeId; private boolean isDateTimeTimeStampTypeId; private boolean isUserDefinedTypeId; private int maxPrecision; private int maxScale; private int typePrecedence; private String javaTypeName; private int maxMaxWidth; /** * 1 argmument constructor. Needed for Formatable interface to work. * * @param formatId Format id of specific type id. */ public TypeId(int formatId) { this.formatId = formatId; setTypeIdSpecificInstanceVariables(); } /** * Constructor for a TypeId * * @param formatId Format id of specific type id. * @param baseTypeId The Base type id */ public TypeId(int formatId, BaseTypeIdImpl baseTypeId) { this.formatId = formatId; this.baseTypeId = baseTypeId; setTypeIdSpecificInstanceVariables(); } /** * Constructor for a TypeId for user defined types * * @param formatId Format id of specific type id. * @param baseTypeId The Base type id * @param classNameWasDelimitedIdentifier Whether or not the class name * was a delimited identifier */ public TypeId(int formatId, BaseTypeIdImpl baseTypeId, boolean classNameWasDelimitedIdentifier) { this.formatId = formatId; this.baseTypeId = baseTypeId; this.classNameWasDelimitedIdentifier = classNameWasDelimitedIdentifier; setTypeIdSpecificInstanceVariables(); } /** * we want equals to say if these are the same type id or not. */ public boolean equals(Object that) { if (that instanceof TypeId) return this.getSQLTypeName().equals(((TypeId)that).getSQLTypeName()); else return false; } /* Hashcode which works with equals. */ public int hashCode() { return this.getSQLTypeName().hashCode(); } private void setTypeIdSpecificInstanceVariables() { switch (formatId) { case StoredFormatIds.BIT_TYPE_ID: typePrecedence = BIT_PRECEDENCE; javaTypeName = "byte[]"; maxMaxWidth = TypeId.BIT_MAXWIDTH; isBitTypeId = true; isConcatableTypeId = true; break; case StoredFormatIds.BOOLEAN_TYPE_ID: typePrecedence = BOOLEAN_PRECEDENCE; javaTypeName = "java.lang.Boolean"; maxMaxWidth = TypeId.BOOLEAN_MAXWIDTH; isBooleanTypeId = true; break; case StoredFormatIds.CHAR_TYPE_ID: typePrecedence = CHAR_PRECEDENCE; javaTypeName = "java.lang.String"; maxMaxWidth = TypeId.CHAR_MAXWIDTH; isStringTypeId = true; isConcatableTypeId = true; break; case StoredFormatIds.DATE_TYPE_ID: typePrecedence = DATE_PRECEDENCE; javaTypeName = "java.sql.Date"; maxMaxWidth = TypeId.DATE_MAXWIDTH; maxPrecision = TypeId.DATE_MAXWIDTH; isDateTimeTimeStampTypeId = true; break; case StoredFormatIds.DECIMAL_TYPE_ID: maxPrecision = TypeId.DECIMAL_PRECISION; maxScale = TypeId.DECIMAL_SCALE; typePrecedence = DECIMAL_PRECEDENCE; javaTypeName = "java.math.BigDecimal"; maxMaxWidth = TypeId.DECIMAL_MAXWIDTH; isDecimalTypeId = true; isNumericTypeId = true; break; case StoredFormatIds.DOUBLE_TYPE_ID: maxPrecision = TypeId.DOUBLE_PRECISION; maxScale = TypeId.DOUBLE_SCALE; typePrecedence = DOUBLE_PRECEDENCE; javaTypeName = "java.lang.Double"; maxMaxWidth = TypeId.DOUBLE_MAXWIDTH; isNumericTypeId = true; isFloatingPointTypeId = true; break; case StoredFormatIds.INT_TYPE_ID: maxPrecision = TypeId.INT_PRECISION; maxScale = TypeId.INT_SCALE; typePrecedence = INT_PRECEDENCE; javaTypeName = "java.lang.Integer"; maxMaxWidth = TypeId.INT_MAXWIDTH; isNumericTypeId = true; break; case StoredFormatIds.LONGINT_TYPE_ID: maxPrecision = TypeId.LONGINT_PRECISION; maxScale = TypeId.LONGINT_SCALE; typePrecedence = LONGINT_PRECEDENCE; javaTypeName = "java.lang.Long"; maxMaxWidth = TypeId.LONGINT_MAXWIDTH; isNumericTypeId = true; break; case StoredFormatIds.LONGVARBIT_TYPE_ID: typePrecedence = LONGVARBIT_PRECEDENCE; javaTypeName = "byte[]"; maxMaxWidth = TypeId.LONGVARBIT_MAXWIDTH; isBitTypeId = true; isConcatableTypeId = true; isLongConcatableTypeId = true; break; case StoredFormatIds.LONGVARCHAR_TYPE_ID: typePrecedence = LONGVARCHAR_PRECEDENCE; javaTypeName = "java.lang.String"; maxMaxWidth = TypeId.LONGVARCHAR_MAXWIDTH; isStringTypeId = true; isConcatableTypeId = true; isLongConcatableTypeId = true; break; case StoredFormatIds.NATIONAL_CHAR_TYPE_ID: typePrecedence = NATIONAL_CHAR_PRECEDENCE; javaTypeName = "java.lang.String"; maxMaxWidth = TypeId.NATIONAL_CHAR_MAXWIDTH; isStringTypeId = true; isConcatableTypeId = true; break; case StoredFormatIds.NATIONAL_LONGVARCHAR_TYPE_ID: typePrecedence = NATIONAL_LONGVARCHAR_PRECEDENCE; javaTypeName = "java.lang.String"; maxMaxWidth = TypeId.NATIONAL_LONGVARCHAR_MAXWIDTH; isStringTypeId = true; isConcatableTypeId = true; isLongConcatableTypeId = true; break; case StoredFormatIds.NATIONAL_VARCHAR_TYPE_ID: typePrecedence = NATIONAL_VARCHAR_PRECEDENCE; javaTypeName = "java.lang.String"; maxMaxWidth = TypeId.NATIONAL_VARCHAR_MAXWIDTH; isStringTypeId = true; isConcatableTypeId = true; break; case StoredFormatIds.REAL_TYPE_ID: maxPrecision = TypeId.REAL_PRECISION; maxScale = TypeId.REAL_SCALE; typePrecedence = REAL_PRECEDENCE; javaTypeName = "java.lang.Float"; maxMaxWidth = TypeId.REAL_MAXWIDTH; isNumericTypeId = true; isRealTypeId = true; isFloatingPointTypeId = true; break; case StoredFormatIds.REF_TYPE_ID: typePrecedence = REF_PRECEDENCE; isRefTypeId = true; break; case StoredFormatIds.SMALLINT_TYPE_ID: maxPrecision = TypeId.SMALLINT_PRECISION; maxScale = TypeId.SMALLINT_SCALE; typePrecedence = SMALLINT_PRECEDENCE; javaTypeName = "java.lang.Integer"; maxMaxWidth = TypeId.SMALLINT_MAXWIDTH; isNumericTypeId = true; break; case StoredFormatIds.TIME_TYPE_ID: typePrecedence = TIME_PRECEDENCE; javaTypeName = "java.sql.Time"; maxScale = TypeId.TIME_SCALE; maxMaxWidth = TypeId.TIME_MAXWIDTH; maxPrecision = TypeId.TIME_MAXWIDTH; isDateTimeTimeStampTypeId = true; break; case StoredFormatIds.TIMESTAMP_TYPE_ID:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -