public interface TypeInfo
Modifier and Type | Method and Description |
---|---|
void |
addCoreType(java.lang.String pgTypeName,
java.lang.Integer oid,
java.lang.Integer sqlType,
java.lang.String javaClass,
java.lang.Integer arrayOid) |
void |
addDataType(java.lang.String type,
java.lang.Class<? extends PGobject> klass) |
char |
getArrayDelimiter(int oid)
Determine the delimiter for the elements of the given array type oid.
|
int |
getDisplaySize(int oid,
int typmod) |
int |
getJavaArrayType(java.lang.String className) |
java.lang.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(java.lang.String elementTypeName)
Determine the oid of the given base postgresql type's array type.
|
java.lang.Class<? extends PGobject> |
getPGobject(java.lang.String type) |
java.lang.String |
getPGType(int oid)
Look up the postgresql type name for a given oid.
|
int |
getPGType(java.lang.String pgTypeName)
Look up the oid for a given postgresql type name.
|
java.util.Iterator<java.lang.String> |
getPGTypeNamesWithSQLTypes() |
java.util.Iterator<java.lang.Integer> |
getPGTypeOidsWithSQLTypes() |
int |
getPrecision(int oid,
int typmod) |
int |
getScale(int oid,
int typmod) |
int |
getSQLType(int oid)
Look up the SQL typecode for a given type oid.
|
int |
getSQLType(java.lang.String pgTypeName)
Look up the SQL typecode for a given postgresql type name.
|
java.lang.String |
getTypeForAlias(java.lang.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.
|
void addCoreType(java.lang.String pgTypeName, java.lang.Integer oid, java.lang.Integer sqlType, java.lang.String javaClass, java.lang.Integer arrayOid)
void addDataType(java.lang.String type, java.lang.Class<? extends PGobject> klass) throws java.sql.SQLException
java.sql.SQLException
int getSQLType(int oid) throws java.sql.SQLException
oid
- the type's OIDTypes
) for the typejava.sql.SQLException
- if an error occurs when retrieving sql typeint getSQLType(java.lang.String pgTypeName) throws java.sql.SQLException
pgTypeName
- the server type name to look upTypes
) for the typejava.sql.SQLException
- if an error occurs when retrieving sql typeint getJavaArrayType(java.lang.String className) throws java.sql.SQLException
java.sql.SQLException
int getPGType(java.lang.String pgTypeName) throws java.sql.SQLException
getPGType(int)
.pgTypeName
- the server type name to look upjava.sql.SQLException
- if an error occurs when retrieving PG typejava.lang.String getPGType(int oid) throws java.sql.SQLException
getPGType(String)
.oid
- the type's OIDjava.sql.SQLException
- if an error occurs when retrieving PG typeint getPGArrayElement(int oid) throws java.sql.SQLException
oid
- the array type's OIDjava.sql.SQLException
- if an error occurs when retrieving array elementint getPGArrayType(java.lang.String elementTypeName) throws java.sql.SQLException
elementTypeName
- the base type'sjava.sql.SQLException
- if an error occurs when retrieving array typechar getArrayDelimiter(int oid) throws java.sql.SQLException
oid
- the array type's OIDjava.sql.SQLException
- if an error occurs when retrieving array delimiterjava.util.Iterator<java.lang.String> getPGTypeNamesWithSQLTypes()
java.util.Iterator<java.lang.Integer> getPGTypeOidsWithSQLTypes()
java.lang.Class<? extends PGobject> getPGobject(java.lang.String type)
java.lang.String getJavaClass(int oid) throws java.sql.SQLException
java.sql.SQLException
java.lang.String getTypeForAlias(java.lang.String alias)
int getPrecision(int oid, int typmod)
int getScale(int oid, int typmod)
boolean isCaseSensitive(int oid)
boolean isSigned(int oid)
int getDisplaySize(int oid, int typmod)
int getMaximumPrecision(int oid)
boolean requiresQuoting(int oid) throws java.sql.SQLException
java.sql.SQLException
boolean requiresQuotingSqlType(int sqlType) throws java.sql.SQLException
sqlType
- sql type as in java.sql.Typesjava.sql.SQLException
- if something goes wrongint longOidToInt(long oid) throws java.sql.SQLException
Java 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.
oid
- the oid as a long.java.sql.SQLException
- if the long has a value outside of the range representable by uint32long intOidToLong(int oid)
oid
- the (signed) integer oid to convert into a long.Copyright © 2024 PostgreSQL Global Development Group. All rights reserved.