Cursor names in the backend are not case-sensitve. This change makes sure that
ecpg also does not regard cursor names as case-sensitive. Thanks to Zoltan Boszormenyi for the patch.
This commit is contained in:
parent
0b81c7c417
commit
81624db39a
@ -1,4 +1,4 @@
|
|||||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.19 2010/03/31 08:45:18 meskes Exp $ */
|
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.20 2010/09/10 10:13:20 meskes Exp $ */
|
||||||
ECPG: stmtClosePortalStmt block
|
ECPG: stmtClosePortalStmt block
|
||||||
{
|
{
|
||||||
if (INFORMIX_MODE)
|
if (INFORMIX_MODE)
|
||||||
@ -302,10 +302,11 @@ ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectSt
|
|||||||
struct cursor *ptr, *this;
|
struct cursor *ptr, *this;
|
||||||
char *cursor_marker = $2[0] == ':' ? make_str("$0") : mm_strdup($2);
|
char *cursor_marker = $2[0] == ':' ? make_str("$0") : mm_strdup($2);
|
||||||
char *comment, *c1, *c2;
|
char *comment, *c1, *c2;
|
||||||
|
int (* strcmp_fn)(const char *, const char *) = ($2[0] == ':' ? strcmp : pg_strcasecmp);
|
||||||
|
|
||||||
for (ptr = cur; ptr != NULL; ptr = ptr->next)
|
for (ptr = cur; ptr != NULL; ptr = ptr->next)
|
||||||
{
|
{
|
||||||
if (strcmp($2, ptr->name) == 0)
|
if (strcmp_fn($2, ptr->name) == 0)
|
||||||
{
|
{
|
||||||
if ($2[0] == ':')
|
if ($2[0] == ':')
|
||||||
mmerror(PARSE_ERROR, ET_ERROR, "using variable \"%s\" in different declare statements is not supported", $2+1);
|
mmerror(PARSE_ERROR, ET_ERROR, "using variable \"%s\" in different declare statements is not supported", $2+1);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.16 2010/05/25 14:32:55 meskes Exp $ */
|
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.17 2010/09/10 10:13:20 meskes Exp $ */
|
||||||
|
|
||||||
/* Copyright comment */
|
/* Copyright comment */
|
||||||
%{
|
%{
|
||||||
@ -386,10 +386,11 @@ add_additional_variables(char *name, bool insert)
|
|||||||
{
|
{
|
||||||
struct cursor *ptr;
|
struct cursor *ptr;
|
||||||
struct arguments *p;
|
struct arguments *p;
|
||||||
|
int (* strcmp_fn)(const char *, const char *) = (name[0] == ':' ? strcmp : pg_strcasecmp);
|
||||||
|
|
||||||
for (ptr = cur; ptr != NULL; ptr=ptr->next)
|
for (ptr = cur; ptr != NULL; ptr=ptr->next)
|
||||||
{
|
{
|
||||||
if (strcmp(ptr->name, name) == 0)
|
if (strcmp_fn(ptr->name, name) == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.26 2010/05/25 17:28:20 meskes Exp $ */
|
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.27 2010/09/10 10:13:20 meskes Exp $ */
|
||||||
|
|
||||||
statements: /*EMPTY*/
|
statements: /*EMPTY*/
|
||||||
| statements statement
|
| statements statement
|
||||||
@ -289,13 +289,14 @@ ECPGCursorStmt: DECLARE cursor_name cursor_options CURSOR opt_hold FOR prepared
|
|||||||
{
|
{
|
||||||
struct cursor *ptr, *this;
|
struct cursor *ptr, *this;
|
||||||
char *cursor_marker = $2[0] == ':' ? make_str("$0") : mm_strdup($2);
|
char *cursor_marker = $2[0] == ':' ? make_str("$0") : mm_strdup($2);
|
||||||
|
int (* strcmp_fn)(const char *, const char *) = ($2[0] == ':' ? strcmp : pg_strcasecmp);
|
||||||
struct variable *thisquery = (struct variable *)mm_alloc(sizeof(struct variable));
|
struct variable *thisquery = (struct variable *)mm_alloc(sizeof(struct variable));
|
||||||
const char *con = connection ? connection : "NULL";
|
const char *con = connection ? connection : "NULL";
|
||||||
char *comment;
|
char *comment;
|
||||||
|
|
||||||
for (ptr = cur; ptr != NULL; ptr = ptr->next)
|
for (ptr = cur; ptr != NULL; ptr = ptr->next)
|
||||||
{
|
{
|
||||||
if (strcmp($2, ptr->name) == 0)
|
if (strcmp_fn($2, ptr->name) == 0)
|
||||||
{
|
{
|
||||||
/* re-definition is a bug */
|
/* re-definition is a bug */
|
||||||
if ($2[0] == ':')
|
if ($2[0] == ':')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user