pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: alla@sergey.com
To: pgsql-general@postgresql.org.pgsql-sql
Subject: Passing cursor between functions in embedded SQL
Date: 18 Jun 2001 11:34:00 -0700
Message-ID: <9275d56e.0106181034.51a22104@posting.google.com> (raw)

Did anybody try to do something like this?

int
open_cursor(...)
{
   EXEC SQL DECLARE cur CURSOR FOR ...

   EXEC SQL OPEN cur;

  return cur1;  /* how can I do that???? */
}

int
fetch_cursor(... cur)
{
   EXEC SQL FETCH cur;

   return some data;
}

That's how it's going to look in the calling program:

  cur := open_cursor;

  while (not found)
  {
     fetch_cursor(cur);
     do some processing with the data
  }
    

My point is I don't want to declare huge arrays or linked lists and
keep all the fetched data in the memory. I want to fetch a row,
process it and move on to the next one.

May be there is another approach to do this? Please help

Thanks

Alla Gribov



view thread (2+ messages)  latest in thread

Message-ID: <9275d56e.0106181034.51a22104@posting.google.com>
Permalink:  ../9275d56e.0106181034.51a22104@posting.google.com/
Also on:    postgresql.org/message-id/9275d56e.0106181034.51a22104@posting.google.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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: alla@sergey.com, pgsql-general@postgresql.org.pgsql-sql
  Subject: Re: Passing cursor between functions in embedded SQL
  In-Reply-To: <9275d56e.0106181034.51a22104@posting.google.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