Class PostgresUtils


  • public class PostgresUtils
    extends java.lang.Object
    A collection of utilities to cover the Postgres JDBC driver's missing implementations.

    The Postgres JDBC driver is known to miss out on quite a few JDBC feature implementations. This class should fill those gaps.

    Author:
    Lukas Eder, Peter Ertl
    • Constructor Summary

      Constructors 
      Constructor Description
      PostgresUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] toBytes​(java.lang.String string)
      Parse a Postgres-encoded bytea string
      static DayToSecond toDayToSecond​(java.lang.Object pgInterval)
      Convert a Postgres interval to a jOOQ DAY TO SECOND interval
      static java.util.List<java.lang.String> toPGArray​(java.lang.String input)
      Tokenize a PGObject input string.
      static java.lang.String toPGArrayString​(java.lang.Object[] value)
      Create a Postgres string representation of an array
      static java.lang.Object toPGInterval​(DayToSecond interval)
      Convert a jOOQ DAY TO SECOND interval to a Postgres representation
      static java.lang.Object toPGInterval​(YearToMonth interval)
      Convert a jOOQ YEAR TO MONTH interval to a Postgres representation
      static java.lang.Object toPGInterval​(YearToSecond interval)
      Convert a jOOQ YEAR TO SECOND interval to a Postgres representation
      static java.util.List<java.lang.String> toPGObject​(java.lang.String input)
      Tokenize a PGObject input string.
      static java.lang.String toPGString​(byte[] binary)
      Create a PostgreSQL string representation of a binary.
      static java.lang.String toPGString​(java.lang.Object o)
      Create a PostgreSQL string representation of any object.
      static java.lang.String toPGString​(Record r)
      Create a PostgreSQL string representation of a record.
      static YearToMonth toYearToMonth​(java.lang.Object pgInterval)
      Convert a Postgres interval to a jOOQ YEAR TO MONTH interval
      static YearToSecond toYearToSecond​(java.lang.Object pgInterval)
      Convert a Postgres interval to a jOOQ YEAR TO SECOND interval
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PostgresUtils

        public PostgresUtils()
    • Method Detail

      • toBytes

        public static byte[] toBytes​(java.lang.String string)
        Parse a Postgres-encoded bytea string
      • toPGInterval

        public static java.lang.Object toPGInterval​(DayToSecond interval)
        Convert a jOOQ DAY TO SECOND interval to a Postgres representation
      • toPGInterval

        public static java.lang.Object toPGInterval​(YearToSecond interval)
        Convert a jOOQ YEAR TO SECOND interval to a Postgres representation
      • toPGInterval

        public static java.lang.Object toPGInterval​(YearToMonth interval)
        Convert a jOOQ YEAR TO MONTH interval to a Postgres representation
      • toDayToSecond

        public static DayToSecond toDayToSecond​(java.lang.Object pgInterval)
        Convert a Postgres interval to a jOOQ DAY TO SECOND interval
      • toYearToMonth

        public static YearToMonth toYearToMonth​(java.lang.Object pgInterval)
        Convert a Postgres interval to a jOOQ YEAR TO MONTH interval
      • toYearToSecond

        public static YearToSecond toYearToSecond​(java.lang.Object pgInterval)
        Convert a Postgres interval to a jOOQ YEAR TO SECOND interval
      • toPGArray

        public static java.util.List<java.lang.String> toPGArray​(java.lang.String input)
        Tokenize a PGObject input string.
      • toPGObject

        public static java.util.List<java.lang.String> toPGObject​(java.lang.String input)
        Tokenize a PGObject input string.
      • toPGArrayString

        public static java.lang.String toPGArrayString​(java.lang.Object[] value)
        Create a Postgres string representation of an array
      • toPGString

        public static java.lang.String toPGString​(java.lang.Object o)
        Create a PostgreSQL string representation of any object.
      • toPGString

        public static java.lang.String toPGString​(Record r)
        Create a PostgreSQL string representation of a record.
      • toPGString

        public static java.lang.String toPGString​(byte[] binary)
        Create a PostgreSQL string representation of a binary.