From: | Michael Schmidt <css(dot)liquid(at)gmail(dot)com> |
---|---|
To: | "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com> |
Cc: | pgsql-php(at)postgresql(dot)org |
Subject: | Re: PHP PDO getting data from pgSQL stored function |
Date: | 2013-11-08 19:26:12 |
Message-ID: | 527D3AD4.1090808@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
Hi,
sorry for the late response.
I did it with the solution posted by Jonah.
It is not necessary for me to return a table(...) because i want to
return the structure which is already defined in my database so i can
use SETOF RECORD as return type. So i use the real table to define the
return of my function.
PDO select works just like a normal select on a table.
Thank you.
Am 03.11.2013 17:06, schrieb Jonah H. Harris:
> On Sat, Nov 2, 2013 at 11:54 AM, Michael Schmidt <css(dot)liquid(at)gmail(dot)com
> <mailto:css(dot)liquid(at)gmail(dot)com>> wrote:
>
> i need to do a ugly select which i dont want to place in my php code.
> I use PDO all the time.
>
>
> All database access from our application is functionalized using
> either PL/pgSQL or SQL functions.
>
> I want to return a structure which is the same as a table i have
> created.
>
>
> CREATE FUNCTION blah (IN param 1, ..., IN param n, OUT param 1, ...
> OUT param n) RETURNS SETOF RECORD
>
> Now my question, how can i return that and access it with PHP PDO?
> Should I use a cursor or shoul I use the return of the function
> (if it is possible)?
>
>
> Just do a SELECT * FROM blah(...); as a normal PDO query.
>
> --
> Jonah H. Harris
> Blog: http://www.oracle-internals.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Ross | 2013-11-21 16:43:45 | Open source project using php PostgreSQL functions? |
Previous Message | Daniel Carrero | 2013-11-05 11:47:45 | Re: Refcursor with php |