From: | "Tim Nelson" <nelsonx(at)earthlink(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | ecpg - select * into structure problem |
Date: | 2001-12-10 17:07:26 |
Message-ID: | iZ5R7.1085$vK1.98901@newsread2.prod.itd.earthlink.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I am running 7.1.3 (ecpg 2.8.0) ....seems I need to reference each variable
into the structure for the fetch to succeed. I looked at the generated code
and it's missing the ECPGt_NO_INDICATOR lines in the call to ECPGdo.
Is this a bug? Thanks.
------------ code -------
EXEC SQL include sqlca;
main()
{
EXEC SQL BEGIN DECLARE SECTION;
struct {
char prfc_cd[21];
char prfc_entry[31];
} x;
EXEC SQL END DECLARE SECTION;
EXEC SQL CONNECT TO ecs;
printf("CONNECT = %d\n",sqlca.sqlcode);
EXEC SQL DECLARE c1 CURSOR FOR select * from pref_char;
printf("DECLARE = %d\n",sqlca.sqlcode);
EXEC SQL open c1;
printf("OPEN = %d\n",sqlca.sqlcode);
while (1) {
EXEC SQL fetch c1 into :x; /* this fails with -200 */
/* this works ...EXEC SQL fetch c1 into :x.prfc_cd,:x.prfc_entry; */
printf("FETCH %d\n",sqlca.sqlcode);
if (sqlca.sqlcode)
break;
printf("X.prfc_cd = %s X.prfc_entry = %s\n",x.prfc_cd,x.prfc_entry);
}
EXEC SQL DISCONNECT;
exit(0);
}
From | Date | Subject | |
---|---|---|---|
Next Message | Campano, Troy | 2001-12-10 17:10:33 | Re: Remote Access to pgsql DB ??? |
Previous Message | Thomas Lockhart | 2001-12-10 16:48:37 | Re: Inserting the current date |