Passing cursor between functions in embedded SQL

From: alla(at)sergey(dot)com (Alla)
To: pgsql-general(at)postgresql(dot)org(dot)pgsql-sql(at)postgresql(dot)org
Subject: Passing cursor between functions in embedded SQL
Date: 2001-06-18 18:34:00
Message-ID: 9275d56e.0106181034.51a22104@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message The Hermit Hacker 2001-06-18 18:51:01 Re: Better Archives?
Previous Message The Hermit Hacker 2001-06-18 18:26:41 Re: LEFT JOIN ...