Re: simple example of copying data from a c/c++ array into postgres

Поиск
Список
Период
Сортировка
От Jeroen Vermeulen
Тема Re: simple example of copying data from a c/c++ array into postgres
Дата
Msg-id 493EA271.8010209@xs4all.nl
обсуждение исходный текст
Ответ на simple example of copying data from a c/c++ array into postgres  ("Whit Armstrong" <armstrong.whit@gmail.com>)
Ответы Re: simple example of copying data from a c/c++ array into postgres  ("Haszlakiewicz, Eric" <EHASZLA@transunion.com>)
Re: simple example of copying data from a c/c++ array into postgres  ("Whit Armstrong" <armstrong.whit@gmail.com>)
Список pgsql-interfaces
Whit Armstrong wrote:
> would someone mind showing me an example of making an insert from binary 
> data to postgres?

Not an example, but have a look at the COPY command:

http://www.postgresql.org/docs/8.3/interactive/sql-copy.html

COPY FROM stdin lets you insert data in bulk, without having to issue a 
new INSERT for every row.  There are some handy libpq functions for 
feeding data into this mechanism:

http://www.postgresql.org/docs/8.3/interactive/libpq-copy.html

The "binary" part of what you're asking for is also possible, but 
probably doesn't buy you all that much.  Chances are you'd need to do 
some conversions anyway, and it introduces all sorts of maintenance risk 
for an optimization that's not likely to matter as much as disk flushes, 
network transfers etc.


Jeroen


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

Предыдущее
От: "Whit Armstrong"
Дата:
Сообщение: simple example of copying data from a c/c++ array into postgres
Следующее
От: "Haszlakiewicz, Eric"
Дата:
Сообщение: Re: simple example of copying data from a c/c++ array into postgres