Inserting arrays from C program

Поиск
Список
Период
Сортировка
От Yadnyesh Joshi
Тема Inserting arrays from C program
Дата
Msg-id 20061017034829.17323.qmail@web53210.mail.yahoo.com
обсуждение исходный текст
Список pgsql-novice
Hi,
Let's say we have a table arrin with only coloumn being pos int[]
To insert values into this table, a normal query would be
insert into arrin values ('{5,5,5,5}');
Bow, I have a C program which has an integer array say arr.
Now, I want to insert values from this arr array into the 'arrin' table.
One way to do that is create a string, say s, which will have '{<comma separated elements of arr>}'
and then use EXEC SQL INSERT INTO arrin VALUES (:s);
But, is there a better/direct way to insert array? I mean can I use integer array 'arr' as host variable?
something like EXEC SQL INSERT INTO arrin VALUES (:arr) ; ?
Thank you,
Yadnyesh.


Find out what India is talking about on - Yahoo! Answers India
Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it NOW

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

Предыдущее
От:
Дата:
Сообщение: Re: pg_dump, pg_restore and UTF8: invalid byte sequence
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Using host variables -- segmentation fault