Class TypeRegistry

java.lang.Object
io.debezium.connector.postgresql.TypeRegistry

public class TypeRegistry extends Object
A registry of types supported by a PostgreSQL instance. Allows lookup of the types according to type name or OID.
Author:
Jiri Pechanec
  • Field Details

  • Constructor Details

  • Method Details

    • getLongTypeNames

      private static Map<String,String> getLongTypeNames()
    • addType

      private void addType(PostgresType type)
    • get

      public PostgresType get(int oid)
      Parameters:
      oid - - PostgreSQL OID
      Returns:
      type associated with the given OID
    • get

      public PostgresType get(String name)
      Parameters:
      name - - PostgreSQL type name
      Returns:
      type associated with the given type name
    • getRegisteredTypes

      public Map<String,PostgresType> getRegisteredTypes()
    • geometryOid

      public int geometryOid()
      Returns:
      OID for GEOMETRY type of this PostgreSQL instance
    • geographyOid

      public int geographyOid()
      Returns:
      OID for GEOGRAPHY type of this PostgreSQL instance
    • citextOid

      public int citextOid()
      Returns:
      OID for CITEXT type of this PostgreSQL instance
    • hstoreOid

      public int hstoreOid()
      Returns:
      OID for HSTORE type of this PostgreSQL instance
    • ltreeOid

      public int ltreeOid()
      Returns:
      OID for LTREE type of this PostgreSQL instance
    • hstoreArrayOid

      public int hstoreArrayOid()
      Returns:
      OID for array of HSTORE type of this PostgreSQL instance
    • geometryArrayOid

      public int geometryArrayOid()
      Returns:
      OID for array of GEOMETRY type of this PostgreSQL instance
    • geographyArrayOid

      public int geographyArrayOid()
      Returns:
      OID for array of GEOGRAPHY type of this PostgreSQL instance
    • citextArrayOid

      public int citextArrayOid()
      Returns:
      OID for array of CITEXT type of this PostgreSQL instance
    • ltreeArrayOid

      public int ltreeArrayOid()
      Returns:
      OID for array of LTREE type of this PostgreSQL instance
    • normalizeTypeName

      public static String normalizeTypeName(String typeName)
      Converts a type name in long (readable) format like boolean to s standard data type name like bool.
      Parameters:
      typeName - - a type name in long format
      Returns:
      - the type name in standardized format
    • prime

      private void prime() throws SQLException
      Prime the TypeRegistry with all existing database types
      Throws:
      SQLException
    • createTypeBuilderFromResultSet

      private PostgresType.Builder createTypeBuilderFromResultSet(ResultSet rs) throws SQLException
      Throws:
      SQLException
    • resolveUnknownType

      private PostgresType resolveUnknownType(String name)
    • resolveUnknownType

      private PostgresType resolveUnknownType(int lookupOid)
    • loadType

      private PostgresType loadType(PreparedStatement statement) throws SQLException
      Throws:
      SQLException
    • getTypeInfo

      private static org.postgresql.core.TypeInfo getTypeInfo(PostgresConnection connection) throws SQLException
      Throws:
      SQLException