pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Schmidt <css.liquid@gmail.com>
To: Jonah H. Harris <jonah.harris@gmail.com>
Cc: pgsql-php@postgresql.org
Subject: Re: PHP PDO getting data from pgSQL stored function
Date: Fri, 08 Nov 2013 20:26:12 +0100
Message-ID: <527D3AD4.1090808@gmail.com> (raw)
In-Reply-To: <CADUqk8VG3sKPWAqczKeE1xk_zcho8_+BajrYu16tDrAMXzV=kQ@mail.gmail.com>
References: <5275203C.2090007@gmail.com>
	<CADUqk8VG3sKPWAqczKeE1xk_zcho8_+BajrYu16tDrAMXzV=kQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.liquid@gmail.com 
> <mailto:css.liquid@gmail.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/

view thread (5+ messages)

Message-ID: <527D3AD4.1090808@gmail.com>
Permalink:  ../527D3AD4.1090808@gmail.com/
Also on:    postgresql.org/message-id/527D3AD4.1090808@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: css.liquid@gmail.com, jonah.harris@gmail.com
  Subject: Re: PHP PDO getting data from pgSQL stored function
  In-Reply-To: <527D3AD4.1090808@gmail.com>
  References: <5275203C.2090007@gmail.com> <CADUqk8VG3sKPWAqczKeE1xk_zcho8_+BajrYu16tDrAMXzV=kQ@mail.gmail.com> <527D3AD4.1090808@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox