Proper COPY implementation for 8.x

Поиск
Список
Период
Сортировка
От Kalle Hallivuori
Тема Proper COPY implementation for 8.x
Дата
Msg-id c637d8bb0706150530w30fd5a1cwdf8310df8e32c795@mail.gmail.com
обсуждение исходный текст
Список pgsql-jdbc
Hello again everybody.

Attached is a patch against postgresql-jdbc-8.2-505.src I confirmed to
apply, compile and test cleanly (though those tests are still very
minimal, I've succesfully run some millions of rows through this with
the application I'm developing). It contains thread-safe single-shot
COPY calls for streams and byte arrays. Interfaces for rolling your
own data consumers and providers are included. Documentation is
adequate.

Usage is straightforward:

 int rowCount = ((PGConnection)con).getCopyAPI().copyIntoDB("COPY
footable TO STDOUT", System.out);

Backend is also quite straightforward:

synchronized int QueryExecutorImpl.copy(String sql, CopydataProvider
provider, CopydataConsumer consumer)
- issues given SQL statement
- receives handshake
- passes copy data between database and exchanger (either provider or
consumer depending on direction)
- handles state and status changes gracefully (where possible,
exceptions are delayed until connection is back in shape)

One FIXME remains for now: what to do with Notifications after reading them?

It's a sunny Friday here, I hope the same for you. And I hope this
patch (or a version for 8.3dev branch I can provide upon request) gets
accepted to the official version, so that my optimizations based on it
will be accepted here at my work :)

--
Kalle Hallivuori +358-41-5053073 http://korpiq.iki.fi/

Вложения

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

Предыдущее
От: "Kalle Hallivuori"
Дата:
Сообщение: Re: FYI: porting Copy API to 8.x
Следующее
От: Luca Ferrari
Дата:
Сообщение: a simple example of XA (not working)