pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus KARG <markus@headcrashing.eu>
To: 'List' <pgsql-jdbc@postgresql.org>
Subject: Re: SQLJSON
Date: Sat, 27 Jun 2015 09:12:23 +0200
Message-ID: <000f01d0b0a8$9d73ca30$d85b5e90$@eu> (raw)
In-Reply-To: <C6608539-7F7D-49AB-B7D7-16034B9DED4A@gmail.com>
References: <CADK3HH+RBjfo7gp3k-DSZYiZ-qS1BcS-OjG3xAgJhJDHbkgo_Q@mail.gmail.com>
	<F9AA993B-8CF6-4DFE-B582-BD775DCC1583@gmail.com>
	<CADK3HHLHxztk8gBYYxg4yTkRx=pPJbyT-3mxOqPX6W3aa3tXTg@mail.gmail.com>
	<C6608539-7F7D-49AB-B7D7-16034B9DED4A@gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

Please read this regarding pluggability:
https://json-processing-spec.java.net/nonav/releases/1.0/fcs/javadocs/javax/
json/spi/JsonProvider.html.

Please read this regarding inability to agree on a standard:
https://jcp.org/en/jsr/results?id=5486.

The merits of adding a SQLJSON type to JDBC would be that in case an RDBMS
might have some kind of special support for high-performance object-tree
transmission in the network protocol (like lazy lookup and delayed
transmission of child objects for example, or using binary transmission
instead of JSONP plain-text), the driver could make use of that knowledge
and work in the fastest and memory-saving way. That benefits are impossible
to gain when using a character stream, as that requires to explicitly
inflate to a full JSONP representation in-memory just to parse that string
in turn in a second step.

whether or not to support JSON is not up to the implementors of drivers, but
up to the JDBC specification vendor. I doubt that with JSONP being a
mandatory part of Java EE they will leave room for not providing JSONP in
JDBC. We might be reluctant for now, but I believe that JDBC5 will enforce
it.

Regards
-Markus

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Steven Schlansker
Sent: Freitag, 26. Juni 2015 19:29
To: Dave Cramer
Cc: List
Subject: Re: [JDBC] SQLJSON


On Jun 26, 2015, at 10:23 AM, Dave Cramer <davecramer@gmail.com> wrote:

> 
> On 26 June 2015 at 13:01, Steven Schlansker <stevenschlansker@gmail.com>
wrote:
> 
> 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?
> 
> 
> 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.



--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes
to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



view thread (103+ messages)  latest in thread

Message-ID: <000f01d0b0a8$9d73ca30$d85b5e90$@eu>
Permalink:  ../000f01d0b0a8$9d73ca30$d85b5e90$@eu/
Also on:    postgresql.org/message-id/000f01d0b0a8$9d73ca30$d85b5e90$@eu

 · 

reply

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: markus@headcrashing.eu
  Subject: Re: SQLJSON
  In-Reply-To: <000f01d0b0a8$9d73ca30$d85b5e90$@eu>
  References: <CADK3HH+RBjfo7gp3k-DSZYiZ-qS1BcS-OjG3xAgJhJDHbkgo_Q@mail.gmail.com> <F9AA993B-8CF6-4DFE-B582-BD775DCC1583@gmail.com> <CADK3HHLHxztk8gBYYxg4yTkRx=pPJbyT-3mxOqPX6W3aa3tXTg@mail.gmail.com> <C6608539-7F7D-49AB-B7D7-16034B9DED4A@gmail.com> <000f01d0b0a8$9d73ca30$d85b5e90$@eu>

* 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