Top Description Inners Fields Constructors Methods
org.jooq.util.postgres

public Class PostgresUtils

extends Object
Class Inheritance
Annotations
@Internal
Static Imports
java.lang.Integer.toOctalString, org.jooq.impl.Internal.converterContext, org.jooq.tools.StringUtils.leftPad, org.jooq.util.postgres.PostgresUtils.PGState.*

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.

Authors
Lukas Eder, Peter Ertl

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static enum

Field Summary

Modifier and TypeField and Description
private static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static void
convertOctalToBytes(final Reader reader, final OutputStream bytes)

private static int
hexValue(final int hexDigit)

Get the hex value of a char digit

private static boolean
private static int
octalValue(final int octalDigit)

Get the octal value of a char digit

public static byte[]
toBytes(final String string)

Parse a Postgres-encoded bytea string

private static byte[]
private static byte[]
public static DayToSecond
toDayToSecond(Object pgInterval)

Convert a Postgres interval to a jOOQ DAY TO SECOND interval

public static DayToSecond
toDayToSecond(PGInterval pgInterval)

Convert a Postgres interval to a jOOQ DAY TO SECOND interval

public static List<String>
toPGArray(String input)

Tokenize a PGObject input string.

public static String
toPGArrayString(Object[] value)

Create a Postgres string representation of an array

private static StringBuilder
public static PGInterval
toPGInterval(DayToSecond interval)

Convert a jOOQ DAY TO SECOND interval to a Postgres representation

public static PGInterval
toPGInterval(YearToSecond interval)

Convert a jOOQ YEAR TO SECOND interval to a Postgres representation

public static PGInterval
toPGInterval(YearToMonth interval)

Convert a jOOQ YEAR TO MONTH interval to a Postgres representation

public static List<String>
toPGObject(String input)

Tokenize a PGObject input string.

private static List<String>
toPGObjectOrArray(String input, char open, char close)

Tokenize a PGObject input string.

public static String
toPGString(Object o)

Create a PostgreSQL string representation of any object.

public static String
toPGString(Record r)

Create a PostgreSQL string representation of a record.

public static String
toPGString(byte[] binary)

Create a PostgreSQL string representation of a binary.

private static StringBuilder
private static StringBuilder
toPGString0(byte[] binary, StringBuilder sb)

public static YearToMonth
toYearToMonth(Object pgInterval)

Convert a Postgres interval to a jOOQ YEAR TO MONTH interval

public static YearToMonth
toYearToMonth(PGInterval pgInterval)

Convert a Postgres interval to a jOOQ YEAR TO MONTH interval

public static YearToSecond
toYearToSecond(Object pgInterval)

Convert a Postgres interval to a jOOQ YEAR TO SECOND interval

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

POSTGRESQL_HEX_STRING_PREFIXback to summary
private static final String POSTGRESQL_HEX_STRING_PREFIX

Constructor Detail

PostgresUtilsback to summary
public PostgresUtils()

Method Detail

convertOctalToBytesback to summary
private static void convertOctalToBytes(final Reader reader, final OutputStream bytes) throws IOException
hexValueback to summary
private static int hexValue(final int hexDigit)

Get the hex value of a char digit

isDeepEmptyback to summary
private static boolean isDeepEmpty(Object[] a)
octalValueback to summary
private static int octalValue(final int octalDigit)

Get the octal value of a char digit

toBytesback to summary
public static byte[] toBytes(final String string)

Parse a Postgres-encoded bytea string

toBytesFromHexEncodingback to summary
private static byte[] toBytesFromHexEncoding(String string)
toBytesFromOctalEncodingback to summary
private static byte[] toBytesFromOctalEncoding(final String string)
toDayToSecondback to summary
public static DayToSecond toDayToSecond(Object pgInterval)

Convert a Postgres interval to a jOOQ DAY TO SECOND interval

toDayToSecondback to summary
public static DayToSecond toDayToSecond(PGInterval pgInterval)

Convert a Postgres interval to a jOOQ DAY TO SECOND interval

toPGArrayback to summary
public static List<String> toPGArray(String input)

Tokenize a PGObject input string.

toPGArrayStringback to summary
public static String toPGArrayString(Object[] value)

Create a Postgres string representation of an array

toPGArrayString0back to summary
private static StringBuilder toPGArrayString0(Object[] value, StringBuilder sb)
toPGIntervalback to summary
public static PGInterval toPGInterval(DayToSecond interval)

Convert a jOOQ DAY TO SECOND interval to a Postgres representation

toPGIntervalback to summary
public static PGInterval toPGInterval(YearToSecond interval)

Convert a jOOQ YEAR TO SECOND interval to a Postgres representation

toPGIntervalback to summary
public static PGInterval toPGInterval(YearToMonth interval)

Convert a jOOQ YEAR TO MONTH interval to a Postgres representation

toPGObjectback to summary
public static List<String> toPGObject(String input)

Tokenize a PGObject input string.

toPGObjectOrArrayback to summary
private static List<String> toPGObjectOrArray(String input, char open, char close)

Tokenize a PGObject input string.

Annotations
@SuppressWarnings:null
toPGStringback to summary
public static String toPGString(Object o)

Create a PostgreSQL string representation of any object.

toPGStringback to summary
public static String toPGString(Record r)

Create a PostgreSQL string representation of a record.

toPGStringback to summary
public static String toPGString(byte[] binary)

Create a PostgreSQL string representation of a binary.

toPGString0back to summary
private static StringBuilder toPGString0(Record r, StringBuilder sb)
toPGString0back to summary
private static StringBuilder toPGString0(byte[] binary, StringBuilder sb)
toYearToMonthback to summary
public static YearToMonth toYearToMonth(Object pgInterval)

Convert a Postgres interval to a jOOQ YEAR TO MONTH interval

toYearToMonthback to summary
public static YearToMonth toYearToMonth(PGInterval pgInterval)

Convert a Postgres interval to a jOOQ YEAR TO MONTH interval

toYearToSecondback to summary
public static YearToSecond toYearToSecond(Object pgInterval)

Convert a Postgres interval to a jOOQ YEAR TO SECOND interval

org.jooq.util.postgres back to summary

pack-priv final Enum PostgresUtils.PGState

extends Enum<PostgresUtils.PGState>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final PostgresUtils.PGState
public static final PostgresUtils.PGState
public static final PostgresUtils.PGState
public static final PostgresUtils.PGState
public static final PostgresUtils.PGState
public static final PostgresUtils.PGState
public static final PostgresUtils.PGState
public static final PostgresUtils.PGState

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static PostgresUtils.PGState
public static PostgresUtils.PGState[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

PG_OBJECT_AFTER_VALUEback to summary
public static final PostgresUtils.PGState PG_OBJECT_AFTER_VALUE
PG_OBJECT_BEFORE_VALUEback to summary
public static final PostgresUtils.PGState PG_OBJECT_BEFORE_VALUE
PG_OBJECT_ENDback to summary
public static final PostgresUtils.PGState PG_OBJECT_END
PG_OBJECT_INITback to summary
public static final PostgresUtils.PGState PG_OBJECT_INIT
PG_OBJECT_NESTED_QUOTED_VALUEback to summary
public static final PostgresUtils.PGState PG_OBJECT_NESTED_QUOTED_VALUE
PG_OBJECT_NESTED_VALUEback to summary
public static final PostgresUtils.PGState PG_OBJECT_NESTED_VALUE
PG_OBJECT_QUOTED_VALUEback to summary
public static final PostgresUtils.PGState PG_OBJECT_QUOTED_VALUE
PG_OBJECT_UNQUOTED_VALUEback to summary
public static final PostgresUtils.PGState PG_OBJECT_UNQUOTED_VALUE

Constructor Detail

PGStateback to summary
private PGState()

Method Detail

valueOfback to summary
public static PostgresUtils.PGState valueOf(String name)
valuesback to summary
public static PostgresUtils.PGState[] values()