Re: Query preparation

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: Query preparation
Дата
Msg-id Pine.BSO.4.64.0904201744220.12014@leary.csoft.net
обсуждение исходный текст
Ответ на Re: Query preparation  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Список pgsql-jdbc

On Thu, 16 Apr 2009, Heikki Linnakangas wrote:

> Here's the patch. Describe message is only sent in the first invocation
> of a query. The Field[] array constructed from the RowDescription
> message is saved in the SimpleQuery object for reuse.
>

Applied with minor revisions.  When sending a Describe Statement message
you'll also get a Row Description message back, so we need to add the
query to the pendingDescribePortalQueue there as well.  Doing this always
avoids some of the other special casing you tried to put in to handle
describe statement (which didn't work if you see the new unit test I
added).

While looking at this code it reminded me that we're also sending Describe
Statement too often and I've fixed that to only do it when necessary.
Previously the following code would describe the statement for every
execution.

PreparedStatement ps = conn.prepareStatement("SELECT ?::int");
for (int i=0; i<100; i++) {
     ps.setObject(1, new Integer(i), Types.OTHER);
     ResultSet rs = ps.executeQuery();
}

Also the JDBC coding style guidelines require four space indentation
rather than tabs, so you'll see some additional changes from that.

Kris Jurka

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

Предыдущее
От: "John Lister"
Дата:
Сообщение: Re: Unit tests and ordering
Следующее
От: "j.random.programmer"
Дата:
Сообщение: Bug with duplicate column names via JDBC MetaData (ORDINAL_POSITION)