Re: JDBC and positioned updates - Mailing list pgsql-jdbc

From Hédi HACHENI
Subject Re: JDBC and positioned updates
Date
Msg-id 567E493D.7050204@kopileft.com
Whole thread Raw
In response to Re: JDBC and positioned updates  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
Responses Re: JDBC and positioned updates
List pgsql-jdbc
Hi,

We cannot use the updatable result set technique since we support multiple databases so we want to use the AINSI syntax with the CURRENT OF cursor_name.

We tried to implement the java.sql.Statement#setCursorName(String) and the  java.sql.ResultSet#getCursorName() methods so that we can set the cursor name of an SQL statement. But, it seems to be more complicated than that we expected since the database server always says  "cursor "name" does not exist"

What we did is to change a little bit the implementation of the org.postgresql.core.v3.QueryExecutorImpl in a way that we can define a cursor name for an SQL statement. We tried to inject this in the org.postgresql.core.v3.Portal class but we did not succeed.

Any ideas ?

Best regards

On 12/25/2015 04:38 PM, Vladimir Sitnikov wrote:
1) Have you considered using "updatable ResultSet"?

Here's a sample:
https://github.com/pgjdbc/pgjdbc/blob/32f513370306529005cb36d968f8e415f4a88aec/pgjdbc/src/test/java/org/postgresql/test/jdbc2/UpdateableResultTest.java#L301-L303

2) >   WHERE CURRENT OF cursor_name

ResultSet implementation fetches result rows in batches, thus "current
of" at the database side might point to a slightly different row than
ResultSet at the java side.

3) You do not expect high throughput of that kind of API, do you?
Updatable ResultSet is not using batching, so each update would result
in a database roundtrip.

Vladimir

pgsql-jdbc by date:

Previous
From: Vladimir Sitnikov
Date:
Subject: Re: JDBC and positioned updates
Next
From: Vladimir Sitnikov
Date:
Subject: Re: JDBC and positioned updates