From: | "Stergios Zissakis" <szis(at)intranet(dot)gr> |
---|---|
To: | <pgsql-interfaces(at)postgresql(dot)org> |
Subject: | ECPG mass retrieval? |
Date: | 2004-03-29 13:13:22 |
Message-ID: | NGBBJHBHDKPNOODGDMMAKELNCGAA.szis@intranet.gr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
Hi there,
It is possible to do bulk retrievals using ECPG?
What I mean is that I want to be able to delcare a host array variable, of
size 100 for example, and get
to retrive my data in batches of 100 rows.
To be more specific the following piece of code, using a cursor, results in
the databse being accessed at every fetch statement degrading performance:
sprintf(stmt, "select * from test where number between %d and %d and
string = \'%s\'", lower, upper, context);
EXEC SQL PREPARE S FROM :stmt;
EXEC SQL AT :ctx DECLARE curs CURSOR FOR S;
EXEC SQL AT :ctx OPEN curs;
EXEC SQL WHENEVER NOT FOUND DO break;
while( true )
{
EXEC SQL AT :ctx FETCH NEXT FROM curs INTO :num, :str;
}
What alternatives do I have to fetch things in bulk?
Thanks for your help.
Regards,
Stergios Zissakis
From | Date | Subject | |
---|---|---|---|
Next Message | Edmund Bacon | 2004-03-29 14:50:55 | Re: ECPG mass retrieval? |
Previous Message | Kris Jurka | 2004-03-28 05:13:15 | Re: Portable interfaces ... |