ECPG: FETCH ALL|n FROM cursor - Memory allocation?

From: Lee Kindness <lkindness(at)csl(dot)co(dot)uk>
To: PostgreSQL Interfaces <pgsql-interfaces(at)postgresql(dot)org>
Cc: Lee Kindness <lkindness(at)csl(dot)co(dot)uk>, Mark Aves <maves(at)csl(dot)co(dot)uk>, Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: ECPG: FETCH ALL|n FROM cursor - Memory allocation?
Date: 2002-04-25 11:42:00
Message-ID: 15559.60296.332310.657745@kelvin.csl.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces

Assuming the following fetch statement in embedded SQL/C:

EXEC SQL FETCH ALL IN selectFromTable_cur INTO
:array1,
:array2;

is memory automatically allocated (by experimentation I guess so)?
Should the input pointers be NULL initialised? How should the memory
be freed?

Assuming the following fetch statement:

while( 1 )
{
EXEC SQL FETCH 1000 IN selectFromTable_cur INTO
:array1,
:array2;
if( (sqlca.sqlcode < 0) || (sqlca.sqlcode != 0) )
break;
}

is memory automatically allocated (by experimentation I guess so)?
Should the input pointers be NULL initialised before each fetch, or
only before the first one? How should the memory be freed?

Any pointers to useful documentation?

Thanks, Lee Kindness.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sander Steffann 2002-04-25 12:05:43 Re: Vote totals for SET in aborted transaction
Previous Message Curt Sampson 2002-04-25 10:47:13 Re: Sequential Scan Read-Ahead

Browse pgsql-interfaces by date

  From Date Subject
Next Message Michael Meskes 2002-04-25 13:07:13 Re: ECPG: FETCH ALL|n FROM cursor - Memory allocation?
Previous Message Yuemin Zhang 2002-04-24 20:07:29 ecpg error code -601