ecpg incompatibility with DB2 - Mailing list pgsql-bugs

From John Summerfield
Subject ecpg incompatibility with DB2
Date
Msg-id Pine.LNX.4.33.0109092049330.29206-100000@possum.os2.ami.com.au
Whole thread Raw
List pgsql-bugs
This is explicity allowed in db2:
     void f3(int i)
     {
     EXEC SQL BEGIN DECLARE SECTION;
       char host_var_3[25];
     EXEC SQL END DECLARE SECTION;
     EXEC SQL SELECT COL2 INTO :host_var_3 FROM TBL2;
     }
     void f4(int i)
     {
     char host_var_3[25];
     EXEC SQL INSERT INTO TBL2 VALUES (:host_var_3);
     }


In db2 host variable definitions are global. You can have more than one
corresponding host variable with the proviso that they are of the same
type and size.

In ecpg I tried to use this definition:
exec sql begin declare section;

    char           date[9];
    long           time;
    char           ASXcode[7];
    int            thigh;
    int            tlow;
    int            tclose;
    int            topen;
    int            tvolume;
    unsigned long long tvalue;
exec sql end declare section;



function ()
    char           date[9];
{
  exec sql ... :date ...;
}


which is required in DB2 (in order to use the same host variable name) but
ecpg does not allow.

The construct that ecpg requires is not legal in DB2.

pgsql-bugs by date:

Previous
From: John Summerfield
Date:
Subject: Re: Logging problems in PostgreSQL 7.2devel
Next
From: "Serg Matskov"
Date:
Subject: Trouble in SELECT query