Best practices and utilities to parse the PGObject value - Mailing list pgsql-jdbc

From M Oznerol
Subject Best practices and utilities to parse the PGObject value
Date
Msg-id SNT123-W2323E32A8EB3160216B907CD370@phx.gbl
Whole thread Raw
List pgsql-jdbc
Hi.

If I read correctly from some forum posts and postgresql JDBC source code, it seems that there is no support in 9.1 for a UDT to java object mapping. From what I've seen, the jdbc driver returns a PGObject and my application will need to parse the string returned by PGObject.getValue().

I am wondering if there is already such a parser in the private APIs and if it could be made it into the public APIs list ?

Would it be possible to add the array delimiters '{' and '}' to the PGtokenizer when evaluating nesting ?

Is there a utility to "peel away" one layer of escaping from a string ? For example it seems that an array of bytea doubles the quotes and backslashes: a bytea in a PGObject is represented as 
"\\x706773716c2d6a646263"
while an array of bytea is represented as
"{""\\\\x706773716c"",""\\\\x6a646263""}".

My goal is to properly handle nested UDTs.

Is TimestampUtils the right class to parse dates and times within PGObjects ?

Are the standard java classes (Short, Integer, Long, Float, and Double) sufficient to parse numbers within a PGObject ?

Finally, much like it is possible to read an array using an inner ResultSet (two columns, the first being the index and the second being the value), is there a similar way to read a PGObject that I have completely missed ?

Thanks for your time.

pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: Regarding GSoc Application
Next
From: Atri Sharma
Date:
Subject: Regarding GSoc proposal