Skip site navigation (1) Skip section navigation (2)

ECPG fix for mixed case cursor names

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Michael Meskes <meskes(at)postgresql(dot)org>
Cc: Hans-Juergen Schoenig <hs(at)cybertec(dot)at>
Subject: ECPG fix for mixed case cursor names
Date: 2010-08-25 11:30:41
Message-ID: 4C74FEE1.2070104@cybertec.at (view raw or flat)
Thread:
Lists: 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(at)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: ecpg-fix-cursor-mixed-case.patch
Description: text/x-patch (3.4 KB)

Responses

pgsql-hackers by date

Next:From: Oleg BartunovDate: 2010-08-25 11:34:49
Subject: Re: No documentation for filtering dictionary feature?
Previous:From: Max BowsherDate: 2010-08-25 11:27:55
Subject: Re: git: uh-oh

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group