Re: SQLJSON

From: Steven Schlansker <stevenschlansker(at)gmail(dot)com>
To: Dave Cramer <davecramer(at)gmail(dot)com>
Cc: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: SQLJSON
Date: 2015-06-26 17:29:17
Message-ID: C6608539-7F7D-49AB-B7D7-16034B9DED4A@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


On Jun 26, 2015, at 10:23 AM, Dave Cramer <davecramer(at)gmail(dot)com> wrote:

>
> On 26 June 2015 at 13:01, Steven Schlansker <stevenschlansker(at)gmail(dot)com> wrote:
>
> On Jun 26, 2015, at 7:57 AM, Dave Cramer <davecramer(at)gmail(dot)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?
>
>
> I don't think you are; as you rightly pointed out now we would have to add a json parser to the driver, which I'm reluctant to do
>

If this feature is developed, I think the JSON parser should be pluggable and optional if possible. Then users that do not want it do not need to drag in a large dependency.

That said, without a more convincing use case or a compelling API that we could easily add, I don't see this interface being "worth its weight" as an addition.

In response to

Responses

  • Re: SQLJSON at 2015-06-27 07:12:23 from Markus KARG
  • Re: SQLJSON at 2015-06-27 16:56:06 from Álvaro Hernández Tortosa

Browse pgsql-jdbc by date

  From Date Subject
Next Message Markus KARG 2015-06-27 07:12:23 Re: SQLJSON
Previous Message Dave Cramer 2015-06-26 17:23:59 Re: SQLJSON