Skip site navigation (1) Skip section navigation (2)

Best practices and utilities to parse the PGObject value

From: M Oznerol <moznerol(at)hotmail(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Best practices and utilities to parse the PGObject value
Date: 2012-04-09 15:17:09
Message-ID: SNT123-W2323E32A8EB3160216B907CD370@phx.gbl (view raw or flat)
Thread:
Lists: 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

Next:From: Atri SharmaDate: 2012-04-09 15:38:06
Subject: Regarding GSoc proposal
Previous:From: Dave CramerDate: 2012-04-08 13:56:26
Subject: Re: [JDBC] Regarding GSoc Application

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group