pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Patch: Add support for hstore extension - and map it to/from java.util.Map
4+ messages / 4 participants
[nested] [flat]

* Patch: Add support for hstore extension - and map it to/from java.util.Map
@ 2012-05-10 09:17 Mikko Tiihonen <mikko.tiihonen@nitorcreations.com>
  2012-05-15 10:47 ` Re: Patch: Add support for hstore extension - and map it to/from java.util.Map Dave Cramer <pg@fastcrypt.com>
  2012-05-21 08:18 ` Re: Patch: Add support for hstore extension - and map it to/from java.util.Map Craig Ringer <ringerc@ringerc.id.au>
  0 siblings, 2 replies; 4+ messages in thread

From: Mikko Tiihonen @ 2012-05-10 09:17 UTC (permalink / raw)
  To: pgsql-jdbc

Hi,

Here is a patch to enable initial support for hstore in the jdbc driver.

With the patch using ResultSet.getObject() on a hstore column and it returns a HashMap<String, String>
Similarly a Statement.setObject(Map<Object,Object> will send the data to backend using hstore format.

The patch supports both text and binary transfer modes. However the current patch does not automatically enable the faster binary transfer more, but instead 
user has to currently add binaryTransferEnable=<hstore-oid> to connection parameters.

I'm still pondering how to enable the binary transfers automatically without the overhead of fetching the hstore oid on each connection startup.
- can it be cached to some static cache based on connection url+login information?
- if not then a way to lazy evaluate it needs to be implemented

-Mikko

Attachments:

  Add-support-for-mapping-java.util.Map-hstore.patch (text/x-patch, 0B) download

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Patch: Add support for hstore extension - and map it to/from java.util.Map
  2012-05-10 09:17 Patch: Add support for hstore extension - and map it to/from java.util.Map Mikko Tiihonen <mikko.tiihonen@nitorcreations.com>
@ 2012-05-15 10:47 ` Dave Cramer <pg@fastcrypt.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Dave Cramer @ 2012-05-15 10:47 UTC (permalink / raw)
  To: Mikko Tiihonen <mikko.tiihonen@nitorcreations.com>; +Cc: pgsql-jdbc

Mikko,

I have applied this patch to master, thanks!

Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca


On Thu, May 10, 2012 at 5:17 AM, Mikko Tiihonen
<mikko.tiihonen@nitorcreations.com> wrote:
> Hi,
>
> Here is a patch to enable initial support for hstore in the jdbc driver.
>
> With the patch using ResultSet.getObject() on a hstore column and it returns
> a HashMap<String, String>
> Similarly a Statement.setObject(Map<Object,Object> will send the data to
> backend using hstore format.
>
> The patch supports both text and binary transfer modes. However the current
> patch does not automatically enable the faster binary transfer more, but
> instead user has to currently add binaryTransferEnable=<hstore-oid> to
> connection parameters.
>
> I'm still pondering how to enable the binary transfers automatically without
> the overhead of fetching the hstore oid on each connection startup.
> - can it be cached to some static cache based on connection url+login
> information?
> - if not then a way to lazy evaluate it needs to be implemented
>
> -Mikko
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
>



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Patch: Add support for hstore extension - and map it to/from java.util.Map
  2012-05-10 09:17 Patch: Add support for hstore extension - and map it to/from java.util.Map Mikko Tiihonen <mikko.tiihonen@nitorcreations.com>
@ 2012-05-21 08:18 ` Craig Ringer <ringerc@ringerc.id.au>
  2012-06-01 20:55   ` Re: Patch: Add support for hstore extension - and map it to/from java.util.Map Shijun Kong <skong@investoranalytics.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Craig Ringer @ 2012-05-21 08:18 UTC (permalink / raw)
  To: Mikko Tiihonen <mikko.tiihonen@nitorcreations.com>; +Cc: pgsql-jdbc

On 05/10/2012 05:17 PM, Mikko Tiihonen wrote:
> Hi,
>
> Here is a patch to enable initial support for hstore in the jdbc driver.
>
> With the patch using ResultSet.getObject() on a hstore column and it 
> returns a HashMap<String, String>
> Similarly a Statement.setObject(Map<Object,Object> will send the data 
> to backend using hstore format.

That's absolutely brilliant, thankyou!

Of course, now there's a `json' type that folks will probably use much 
of the time instead, not least because it should be easier to work with 
from JDBC. I doubt it'll be as efficient and fast as hstore for 
single-level key/value info though.

--
Craig Ringer



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Patch: Add support for hstore extension - and map it to/from java.util.Map
  2012-05-10 09:17 Patch: Add support for hstore extension - and map it to/from java.util.Map Mikko Tiihonen <mikko.tiihonen@nitorcreations.com>
  2012-05-21 08:18 ` Re: Patch: Add support for hstore extension - and map it to/from java.util.Map Craig Ringer <ringerc@ringerc.id.au>
@ 2012-06-01 20:55   ` Shijun Kong <skong@investoranalytics.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Shijun Kong @ 2012-06-01 20:55 UTC (permalink / raw)
  To: Craig Ringer <ringerc@ringerc.id.au>; Mikko Tiihonen <mikko.tiihonen@nitorcreations.com>; +Cc: pgsql-jdbc

Is it path for 9.1 or 9.2?


-Shijun


On 5/21/12 4:18 AM, "Craig Ringer" <ringerc@ringerc.id.au> wrote:

>On 05/10/2012 05:17 PM, Mikko Tiihonen wrote:
>> Hi,
>>
>> Here is a patch to enable initial support for hstore in the jdbc driver.
>>
>> With the patch using ResultSet.getObject() on a hstore column and it
>> returns a HashMap<String, String>
>> Similarly a Statement.setObject(Map<Object,Object> will send the data
>> to backend using hstore format.
>
>That's absolutely brilliant, thankyou!
>
>Of course, now there's a `json' type that folks will probably use much
>of the time instead, not least because it should be easier to work with
>from JDBC. I doubt it'll be as efficient and fast as hstore for
>single-level key/value info though.
>
>--
>Craig Ringer
>
>-- 
>Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
>To make changes to your subscription:
>http://www.postgresql.org/mailpref/pgsql-jdbc




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2012-06-01 20:55 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-05-10 09:17 Patch: Add support for hstore extension - and map it to/from java.util.Map Mikko Tiihonen <mikko.tiihonen@nitorcreations.com>
2012-05-15 10:47 ` Dave Cramer <pg@fastcrypt.com>
2012-05-21 08:18 ` Craig Ringer <ringerc@ringerc.id.au>
2012-06-01 20:55   ` Shijun Kong <skong@investoranalytics.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox