Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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

pgsql-hackers by date

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

pgsql-interfaces by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group