Thread: Inserting arrays from C program

Inserting arrays from C program

From
Yadnyesh Joshi
Date:
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