Thread: array in a store procedure in C
Hi, i m developing a store procedure that accepts an array of rows, this is the simplified code:
http://pastebin.com/wC92Dh7f
Please note that i left out everything that is not related, in the function, to the problem at hand, only the code related to my problem is included.
The above does not allow me to access the members of the rows in the array, this is how i call this function:http://pastebin.com/wC92Dh7f
Please note that i left out everything that is not related, in the function, to the problem at hand, only the code related to my problem is included.
select ret,username,password from wtt_add_account('2802021','JPL123','1','3',ARRAY[row('1','25','10')::wtt_balance_info_t,row('2','50','15')::wtt_balance_info_t]);
CREATE TYPE wtt_balance_info_t AS (balanceid varchar(25),chgval varchar(25),servicestop varchar(25)) .
On Thu, Jan 29, 2015 at 11:45 PM, Juan Pablo L <jpablolorenzetti@gmail.com> wrote: > I would really appreciate if someone could give me guidelines how to > read/extract the rows from the array and then get each element from the > rows. thank you very much!! src/backend/utils/adt/array_userfuncs.c is a mine of information containing a set of C functions to operate on arrays. You may as well look at contrib/intarray for some inspiration. -- Michael
i will look there ... i have been looking in a lot of source files and can not find anything that helps but i will look in those specific files. Thanks a lot.
On Jan 29, 2015 9:09 PM, "Michael Paquier" <michael.paquier@gmail.com> wrote:
On Thu, Jan 29, 2015 at 11:45 PM, Juan Pablo L
<jpablolorenzetti@gmail.com> wrote:
> I would really appreciate if someone could give me guidelines how to
> read/extract the rows from the array and then get each element from the
> rows. thank you very much!!
src/backend/utils/adt/array_userfuncs.c is a mine of information
containing a set of C functions to operate on arrays. You may as well
look at contrib/intarray for some inspiration.
--
Michael
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
On 1/29/15 10:53 PM, Juan Pablo L wrote: > i will look there ... i have been looking in a lot of source files and > can not find anything that helps but i will look in those specific > files. Thanks a lot. You might find this shell script useful; it's meant to make it easy to grep the entire codebase for some term. Note that the recursive grep starts at the current directory, so make sure you're actually in the pgsql source code when you use it. cat ~/bin/pg_grep #!/bin/sh grep -r "$*" * | grep -iv TAGS: | grep -v 'Binary file' | grep -v '.deps/' -- Jim Nasby, Data Architect, Blue Treble Consulting Data in Trouble? Get it in Treble! http://BlueTreble.com
Thanks.
On Feb 2, 2015 8:58 PM, "Jim Nasby" <Jim.Nasby@bluetreble.com> wrote:
On 1/29/15 10:53 PM, Juan Pablo L wrote:i will look there ... i have been looking in a lot of source files and
can not find anything that helps but i will look in those specific
files. Thanks a lot.
You might find this shell script useful; it's meant to make it easy to grep the entire codebase for some term. Note that the recursive grep starts at the current directory, so make sure you're actually in the pgsql source code when you use it.
cat ~/bin/pg_grep
#!/bin/sh
grep -r "$*" * | grep -iv TAGS: | grep -v 'Binary file' | grep -v '.deps/'
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com
On Tuesday, February 03, 2015 3:58 AM, Jim Nasby wrote: > Note that the recursive grep starts at the current directory, so make sure you're actually in the pgsql source code whenyou use it. > cat ~/bin/pg_grep > #!/bin/sh > > grep -r "$*" * | grep -iv TAGS: | grep -v 'Binary file' | grep -v '.deps/' By the way, why not add a "cd" into the pgsql source tree to the script? That way you can't forget it when using the script...
On 2/3/15 7:03 AM, Holger.Friedrich-Fa-Trivadis@it.nrw.de wrote: > On Tuesday, February 03, 2015 3:58 AM, Jim Nasby wrote: >> Note that the recursive grep starts at the current directory, so make sure you're actually in the pgsql source code whenyou use it. > >> cat ~/bin/pg_grep >> #!/bin/sh >> >> grep -r "$*" * | grep -iv TAGS: | grep -v 'Binary file' | grep -v '.deps/' > > By the way, why not add a "cd" into the pgsql source tree to the script? That way you can't forget it when using the script... Because I have multiple checkouts, and I don't always use the full tree to search. It's a lot faster to only search the include directory, for example. -- Jim Nasby, Data Architect, Blue Treble Consulting Data in Trouble? Get it in Treble! http://BlueTreble.com