Re: JDBC gripe list (the autocommit subthread)

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: JDBC gripe list (the autocommit subthread)
Дата
Msg-id AANLkTi=eWSrsEJJJcXRcmO31=u2r8DBOgBoguaX_scbT@mail.gmail.com
обсуждение исходный текст
Ответ на Re: JDBC gripe list (the autocommit subthread)  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Список pgsql-jdbc
On 1 April 2011 12:06, Kevin Grittner <Kevin.Grittner@wicourts.gov> wrote:
> Oliver Jowett <oliver@opencloud.com> wrote:
>
>> (b) the current behavior is consistent with how multiple statement
>> execution works elsewhere in the driver, where if you execute
>> "SELECT a; SELECT b" as a statement with autocommit=true then the
>> two queries run in a single transaction;
>
> I did not know that.  Is that required by spec?

Depending on how you read the javadoc, yes:

---
void setAutoCommit(boolean autoCommit)
                   throws SQLException
[...]
The commit occurs when the statement completes. The time when the
statement completes depends on the type of SQL Statement:
[...]
For CallableStatement objects or for statements that return multiple
results, the statement is complete when all of the associated result
sets have been closed, and all update counts and output parameters
have been retrieved.
---

I don't think we strictly follow that - as the commit is driven by the
server, we may commit before all resultsets are closed, in general -
but the intent is the same, a single JDBC statement that does multiple
things executes in one transaction, not several.

It's also consistent with how the v2 protocol works.

> It definitely doesn't happen in psql:

psql does things differently, but psql is not a JDBC driver..

Oliver

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: JDBC gripe list (the autocommit subthread)
Следующее
От: "A.M."
Дата:
Сообщение: Re: JDBC gripe list (the autocommit subthread)