Обсуждение: ecpg - select * into structure problem
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);
}
On Mon, Dec 10, 2001 at 05:07:26PM +0000, Tim Nelson wrote: > 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. Yes, but it's fixed in current CVS aka ecpg 2.9.0. Michael -- Michael Meskes Michael@Fam-Meskes.De Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!
Mike Smialek wrote:
>
> Configuration:
> Windows 2000 Server
> cygwin 2.78.2.9
> PostgreSQL 7.1.3
> psqlODBC 7.1.8
> pgAdmin II 1.1.66
>
> Bug:
> Capital letters cannot be used in column names used in foreign key
> constraints
>
> All Smalls succeeds:
[snip]
> Capitalizing just the foreign column name fails with what seems to be
an
> incorrect error:
> -- Table: significance
> CREATE TABLE "significance" (
> "Significanceid" int4 NOT NULL,
> "desc" varchar(255),
> CONSTRAINT "pk_significance" PRIMARY KEY ("Significanceid"));
>
> -- Table: primaryword
> CREATE TABLE "primaryword" (
> "exerciseid" int4 NOT NULL,
> "significanceid" int4 NOT NULL,
> CONSTRAINT "pk_primaryword" PRIMARY KEY ("exerciseid"),
> CONSTRAINT "fk_primaryword_significance" FOREIGN KEY
> (significanceid) REFERENCES "significance" (Significanceid) );
You aren't double quoting the column name Significanceid
in the foreign key contraint clauses. Why ?
regards,
Hiroshi Inoue
That is DDL returned from pgAdminII. The quotes appear to be optional if
you are using all lower case. With the Quotes, the mixed case works.
Thanks,
MS