Anyone run across this issue before?
I created a postgresql stored procedure that returns the rows corresponding to its defined query. (Note that 'tpipes' is a type that I defined consisting of the columns i wish returned)
CREATE OR REPLACE FUNCTION get_tpipe_by_member_asc(bigint, character varying, bigint, bigint)
RETURNS SETOF tpipes AS
'select id,tpipe_title,tpipe_cat,tpipe_cow from t_tpipes where member_id = $1 order by $2 asc offset $3 limit $4;'
LANGUAGE 'sql' VOLATILE;
when performing the stored procedure manually at the pgsql db command line (select * from get_tpipe_by_member_asc(...)), the results return correctly sorted. However when attempting to call the stored procedure within php, the rows are returned unsorted as if the return rows are somehow being altered before being made available in the return php variable (in the case below, $tpipes_array:
1. $tpipes_array = pg_query_params ($conn, "SELECT * from get_tpipe_by_member_".$tpipe_asc."($1,$2,$3,$4)", array ($member_id,$tpipe_sort_key,$tpipe_offset,$tpipe_l imit));
2. $tpipes_array=pg_query($conn,"select id,tpipe_title,tpipe_cat,tpipe_cow from t_pipes where member_id = ".$member_id." order by ".$tpipe_sort_key." ".$tpipe_asc." offset ".$tpipe_offset." limit ".$tpipe_limit);
Note #1 is the line used to call the stored procedure, which results in the unsorted rows.
In #2, we are calling the query explicitly (avoiding stored procedure all together) and this results in correctly ordered rows. How is this possible? Anyone have any thoughts?
thed00d@nesornet