ECPG fix for mixed case cursor names - Mailing list pgsql-hackers

From Boszormenyi Zoltan
Subject ECPG fix for mixed case cursor names
Date
Msg-id 4C74FEE1.2070104@cybertec.at
Whole thread Raw
Responses Re: ECPG fix for mixed case cursor names
Re: ECPG fix for mixed case cursor names
List pgsql-hackers
Hi,

PostgreSQL allows in plain SQL to declare a cursor
e.g. in all lower case and fetch from is in all upper case.
We need to allow this from ECPG, too, but strictly when
the cursor name is not in a variable. Otherwise this code
below doesn't notice the cursor's double declaration
and complains using an undeclared cursor:

======================================
#include <stdio.h>

#include <sqlda.h>

int main(void)
{
    EXEC SQL BEGIN DECLARE SECTION;
    char    *connstr = "zozo@localhost:5555";
    EXEC SQL END DECLARE SECTION;
    sqlda_t    *sqlda;

    EXEC SQL CONNECT TO :connstr;

    EXEC SQL DECLARE mycur CURSOR FOR SELECT * FROM t1;

    EXEC SQL DECLARE MYCUR CURSOR FOR SELECT * FROM t1;

    EXEC SQL OPEN mYCur;

    EXEC SQL FETCH ALL FROM mYcUr INTO DESCRIPTOR sqlda;

    EXEC SQL CLOSE MyCuR;

    EXEC SQL DISCONNECT ALL;

    return 0;
}
======================================

Patch is attached.

Best regards,
Zoltán Böszörményi


Attachment

pgsql-hackers by date:

Previous
From: Max Bowsher
Date:
Subject: Re: git: uh-oh
Next
From: Oleg Bartunov
Date:
Subject: Re: No documentation for filtering dictionary feature?