pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: rob stone <floriparob@gmail.com>
To: Bob Jones <r.a.n.d.o.m.d.e.v.4+postgres@gmail.com>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: cursor "x" does not exist
Date: Sun, 15 Apr 2018 22:15:23 +1000
Message-ID: <1523794523.3515.6.camel@gmail.com> (raw)
In-Reply-To: <CA+HuS5F_anOtn+jJjF1VPuWX_pkOiN_FC2vPDDgkJhFs-s8CZQ@mail.gmail.com>
References: <CA+HuS5F_anOtn+jJjF1VPuWX_pkOiN_FC2vPDDgkJhFs-s8CZQ@mail.gmail.com>

Hello Bob,

On Sat, 2018-04-14 at 15:44 +0100, Bob Jones wrote:
> Hello,
> 
> 
> 
> P.S. As a side-question, if anyone here has experience in using
> Postgres as a backend to PHP, are refcursors the way to go or should
> I
> be thinking of SETOF or other return styles ?
> 


If you have a business requirement along the lines of "display all
outstanding orders for a customer" it is best to create a view that
serves that purpose. Then all you need to code is a "select * from
v_outstanding_orders where customer_id = $1";
If there are any outstanding orders you can page through the
associative array returned by the query in order to display the
results.

HTH,
Rob






view thread (5+ messages)

Message-ID: <1523794523.3515.6.camel@gmail.com>
Permalink:  ../1523794523.3515.6.camel@gmail.com/
Also on:    postgresql.org/message-id/1523794523.3515.6.camel@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-general@postgresql.org
  Cc: floriparob@gmail.com, r.a.n.d.o.m.d.e.v.4+postgres@gmail.com
  Subject: Re: cursor "x" does not exist
  In-Reply-To: <1523794523.3515.6.camel@gmail.com>
  References: <CA+HuS5F_anOtn+jJjF1VPuWX_pkOiN_FC2vPDDgkJhFs-s8CZQ@mail.gmail.com> <1523794523.3515.6.camel@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