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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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 Content-Type Size
ecpg-fix-cursor-mixed-case.patch text/x-patch 3.4 KB

Responses

Browse pgsql-hackers by date

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