Re: JDBC and positioned updates

Поиск
Список
Период
Сортировка
От Hédi HACHENI
Тема Re: JDBC and positioned updates
Дата
Msg-id 567E493D.7050204@kopileft.com
обсуждение исходный текст
Ответ на Re: JDBC and positioned updates  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
Ответы Re: JDBC and positioned updates  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Vladimir Sitnikov
Дата:
Сообщение: Re: JDBC and positioned updates
Следующее
От: Vladimir Sitnikov
Дата:
Сообщение: Re: JDBC and positioned updates