From: | Yadnyesh Joshi <yadnyesh_joshi(at)yahoo(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Inserting arrays from C program |
Date: | 2006-10-17 03:48:29 |
Message-ID: | 20061017034829.17323.qmail@web53210.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2006-10-17 04:49:35 | Re: Using host variables -- segmentation fault |
Previous Message | me | 2006-10-17 03:23:02 | Re: pg_dump, pg_restore and UTF8: invalid byte sequence |