Thread: Best practices and utilities to parse the PGObject value
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.