| Constructor and Description |
|---|
TypeInfoCache(BaseConnection conn,
int unknownLength) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCoreType(String pgTypeName,
Integer oid,
Integer sqlType,
String javaClass,
Integer arrayOid) |
void |
addDataType(String type,
Class<? extends PGobject> klass) |
void |
cacheSQLTypes() |
protected int |
convertArrayToBaseOid(int oid)
Return the oid of the array's base element if it's an array, if not return the provided oid.
|
char |
getArrayDelimiter(int oid)
Determine the delimiter for the elements of the given array type oid.
|
int |
getDisplaySize(int oid,
int typmod) |
String |
getJavaClass(int oid) |
int |
getMaximumPrecision(int oid) |
int |
getPGArrayElement(int oid)
Look up the oid of an array's base type given the array's type oid.
|
int |
getPGArrayType(@Nullable String elementTypeName)
Determine the oid of the given base postgresql type's array type.
|
@Nullable Class<? extends PGobject> |
getPGobject(String type) |
@Nullable String |
getPGType(int oid)
Look up the postgresql type name for a given oid.
|
int |
getPGType(String pgTypeName)
Look up the oid for a given postgresql type name.
|
Iterator<String> |
getPGTypeNamesWithSQLTypes() |
Iterator<Integer> |
getPGTypeOidsWithSQLTypes() |
int |
getPrecision(int oid,
int typmod) |
int |
getScale(int oid,
int typmod) |
int |
getSQLType(int typeOid)
Look up the SQL typecode for a given type oid.
|
int |
getSQLType(String pgTypeName)
Look up the SQL typecode for a given postgresql type name.
|
@Nullable String |
getTypeForAlias(@Nullable String alias) |
long |
intOidToLong(int oid)
Java Integers are signed 32-bit integers, but oids are unsigned 32-bit integers.
|
boolean |
isCaseSensitive(int oid) |
boolean |
isSigned(int oid) |
int |
longOidToInt(long oid)
Java Integers are signed 32-bit integers, but oids are unsigned 32-bit integers.
|
boolean |
requiresQuoting(int oid) |
boolean |
requiresQuotingSqlType(int sqlType)
Returns true if particular sqlType requires quoting.
|
public TypeInfoCache(BaseConnection conn, int unknownLength)
public void addCoreType(String pgTypeName, Integer oid, Integer sqlType, String javaClass, Integer arrayOid)
addCoreType in interface TypeInfopublic void addDataType(String type, Class<? extends PGobject> klass) throws SQLException
addDataType in interface TypeInfoSQLExceptionpublic Iterator<String> getPGTypeNamesWithSQLTypes()
getPGTypeNamesWithSQLTypes in interface TypeInfopublic Iterator<Integer> getPGTypeOidsWithSQLTypes()
getPGTypeOidsWithSQLTypes in interface TypeInfopublic void cacheSQLTypes()
throws SQLException
SQLExceptionpublic int getSQLType(String pgTypeName) throws SQLException
TypeInfogetSQLType in interface TypeInfopgTypeName - the server type name to look upTypes) for the typeSQLException - if an error occurs when retrieving sql typepublic int getSQLType(int typeOid)
throws SQLException
TypeInfogetSQLType in interface TypeInfotypeOid - the type's OIDTypes) for the typeSQLException - if an error occurs when retrieving sql typepublic int getPGType(String pgTypeName) throws SQLException
TypeInfoTypeInfo.getPGType(int).getPGType in interface TypeInfopgTypeName - the server type name to look upSQLException - if an error occurs when retrieving PG typepublic @Nullable String getPGType(int oid) throws SQLException
TypeInfoTypeInfo.getPGType(String).getPGType in interface TypeInfooid - the type's OIDSQLException - if an error occurs when retrieving PG typepublic int getPGArrayType(@Nullable String elementTypeName) throws SQLException
TypeInfogetPGArrayType in interface TypeInfoelementTypeName - the base type'sSQLException - if an error occurs when retrieving array typeprotected int convertArrayToBaseOid(int oid)
oid - input oidpublic char getArrayDelimiter(int oid)
throws SQLException
TypeInfogetArrayDelimiter in interface TypeInfooid - the array type's OIDSQLException - if an error occurs when retrieving array delimiterpublic int getPGArrayElement(int oid)
throws SQLException
TypeInfogetPGArrayElement in interface TypeInfooid - the array type's OIDSQLException - if an error occurs when retrieving array elementpublic @Nullable Class<? extends PGobject> getPGobject(String type)
getPGobject in interface TypeInfopublic String getJavaClass(int oid) throws SQLException
getJavaClass in interface TypeInfoSQLExceptionpublic @Nullable String getTypeForAlias(@Nullable String alias)
getTypeForAlias in interface TypeInfopublic int getPrecision(int oid,
int typmod)
getPrecision in interface TypeInfopublic boolean isCaseSensitive(int oid)
isCaseSensitive in interface TypeInfopublic int getDisplaySize(int oid,
int typmod)
getDisplaySize in interface TypeInfopublic int getMaximumPrecision(int oid)
getMaximumPrecision in interface TypeInfopublic boolean requiresQuoting(int oid)
throws SQLException
requiresQuoting in interface TypeInfoSQLExceptionpublic boolean requiresQuotingSqlType(int sqlType)
throws SQLException
requiresQuotingSqlType in interface TypeInfosqlType - sql type as in java.sql.TypesSQLException - if something goes wrongpublic int longOidToInt(long oid)
throws SQLException
TypeInfoJava Integers are signed 32-bit integers, but oids are unsigned 32-bit integers. We therefore read them as positive long values and then force them into signed integers (wrapping around into negative values when required) or we'd be unable to correctly handle the upper half of the oid space.
This function handles the mapping of uint32-values in the long to java integers, and throws for values that are out of range.
longOidToInt in interface TypeInfooid - the oid as a long.SQLException - if the long has a value outside of the range representable by uint32public long intOidToLong(int oid)
TypeInfointOidToLong in interface TypeInfooid - the (signed) integer oid to convert into a long.Copyright © 1997-2020 PostgreSQL Global Development Group. All Rights Reserved.