Re: executeBatch() issue with new driver?

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: executeBatch() issue with new driver?
Дата
Msg-id 4187F9D7.3060308@opencloud.com
обсуждение исходный текст
Ответ на Re: executeBatch() issue with new driver?  (Alan Stange <stange@rentec.com>)
Список pgsql-jdbc
Alan Stange wrote:

> What about this case:
>
> Connection conn = ...
> Statement st = conn.createStatement();
> st.execute("insert a; insert b; insert c; insert d;");
>
> Is the 8.0 driver busting this up into 4 trips to the database?!

No, but it must split that query string into 4 individual queries (a V3
extended-query-protocol requirement). So it will send:

   Parse("insert a")
   Bind(...)
   Execute(...)
   Parse("insert b")
   Bind(...)
   Execute(...)
   Parse("insert c")
   Bind(...)
   Execute(...)
   Parse("insert d")
   Bind(...)
   Execute(...)
   Sync

Then it starts reading responses from the server.

The driver does exactly the same thing if you do:

   st.addBatch("insert a");
   st.addBatch("insert b");
   st.addBatch("insert c");
   st.addBatch("insert d");
   st.executeBatch();

If you're interested in the gory protocol details, take a look at
http://www.postgresql.org/docs/7.4/static/protocol-flow.html#AEN52666

-O

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

Предыдущее
От: Aaron Mulder
Дата:
Сообщение: Re: 1300 to 3100 lines of code for XA support
Следующее
От: Alan Stange
Дата:
Сообщение: Re: executeBatch() issue with new driver?