Re: PHP PDO getting data from pgSQL stored function
"Jonah H. Harris" <[email protected]> Sun, 3 Nov 2013 11:06:17 -0500
| Newsgroups | gmane.comp.db.postgresql.php |
|---|---|
| Message-ID | <CADUqk8VG3sKPWAqczKeE1xk_zcho8_+BajrYu16tDrAMXzV=kQ@mail.gmail.com> |
--047d7b471e6abe30fd04ea47fa54 Content-Type: text/plain; charset=ISO-8859-1 On Sat, Nov 2, 2013 at 11:54 AM, Michael Schmidt <[email protected]>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/ --047d7b471e6abe30fd04ea47fa54 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">On Sat, Nov 2, 2013 at 11:54 AM, Michael Schmidt <span dir= =3D"ltr"><<a href=3D"mailto:[email protected]" target=3D"_blank">css.= [email protected]</a>></span> wrote:<br><div class=3D"gmail_extra"><div c= lass=3D"gmail_quote"> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex">i need to do a ugly select which i dont want= to place in my php code.<br> I use PDO all the time.<br></blockquote><div><br></div><div>All database ac= cess from our application is functionalized using either PL/pgSQL or SQL fu= nctions.</div><div>=A0</div><blockquote class=3D"gmail_quote" style=3D"marg= in:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> I want to return a structure which is the same as a table i have created.<b= r></blockquote><div><br></div><div>CREATE FUNCTION blah (IN param 1, ..., I= N param n, OUT param 1, ... OUT param n) RETURNS SETOF RECORD</div><div> <br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bord= er-left:1px #ccc solid;padding-left:1ex">Now my question, how can i return = that and access it with PHP PDO?<br> Should I use a cursor or shoul I use the return of the function (if it is p= ossible)?<br></blockquote><div><br></div><div>Just do a SELECT * FROM blah(= ...); as a normal PDO query.</div><div><br></div></div>-- <br>Jonah H. Harr= is<br> Blog: <a href=3D"http://www.oracle-internals.com/" target=3D"_blank">http:/= /www.oracle-internals.com/</a> </div></div> --047d7b471e6abe30fd04ea47fa54--