From: Steven Schlansker <stevenschlansker@gmail.com>
To: Dave Cramer <davecramer@gmail.com>
Cc: List <pgsql-jdbc@postgresql.org>
Subject: Re: SQLJSON
Date: Fri, 26 Jun 2015 10:01:47 -0700
Message-ID: <F9AA993B-8CF6-4DFE-B582-BD775DCC1583@gmail.com> (raw)
In-Reply-To: <CADK3HH+RBjfo7gp3k-DSZYiZ-qS1BcS-OjG3xAgJhJDHbkgo_Q@mail.gmail.com>
References: <CADK3HH+RBjfo7gp3k-DSZYiZ-qS1BcS-OjG3xAgJhJDHbkgo_Q@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>
On Jun 26, 2015, at 7:57 AM, Dave Cramer <davecramer@gmail.com> wrote:
> I'm looking for comments on how to implement a SQLJSON type in JDBC.
>
> As there is no getSQLJSON in the resultset interface this could only be used in getObject.
>
> Notionally it would model itself after SQLXML. https://docs.oracle.com/javase/7/docs/api/index.html?java/sql/SQLXML.html
I used JSON extensively in one of my projects, but have never used SQLXML. I'm having trouble understanding why the SQLXML interface adds any value to passing rs.getBinaryStream to your favorite JSON parser. Especially since you would have to use getObject, I am not seeing how:
rs.getObject("field", SQLJSON.class).mapToType(MyType.class)
is simpler than:
jacksonObjectMapper.readValue(rs.getBinaryStream("field"), MyType.class)
which already works today as far as I understand. Doubly so since nobody will agree on which JSON parsing library to use.
I'm sure I'm missing something?
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: stevenschlansker@gmail.com, davecramer@gmail.com
Subject: Re: SQLJSON
In-Reply-To: <F9AA993B-8CF6-4DFE-B582-BD775DCC1583@gmail.com>
References: <CADK3HH+RBjfo7gp3k-DSZYiZ-qS1BcS-OjG3xAgJhJDHbkgo_Q@mail.gmail.com> <F9AA993B-8CF6-4DFE-B582-BD775DCC1583@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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