Skip to content

Commit 5106aff

Browse files
author
Michael Meskes
committed
Added special handling of CONNECTION variable that is used by ECPG instead of given to the backend.
1 parent 9322a04 commit 5106aff

File tree

3 files changed

+33
-13
lines changed

3 files changed

+33
-13
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1957,6 +1957,11 @@ Wed Nov 30 12:49:13 CET 2005
19571957
- Made several variables "const char *" instead of "char *" as
19581958
proposed by Qingqing Zhou <zhouqq@cs.toronto.edu>.
19591959
- Replaced all strdup() calls by ECPGstrdup().
1960+
1961+
Fri Dec 2 16:00:10 CET 2005
1962+
1963+
- Added special handling of CONNECTION variable that is used by ECPG
1964+
instead of given to the backend.
19601965
- Set ecpg library version to 5.2.
19611966
- Set ecpg version to 4.2.1.
19621967

src/interfaces/ecpg/preproc/ecpg_keywords.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* lexical token lookup for reserved words in postgres embedded SQL
55
*
66
* IDENTIFICATION
7-
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg_keywords.c,v 1.31 2005/10/15 02:49:47 momjian Exp $
7+
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg_keywords.c,v 1.32 2005/12/02 15:03:57 meskes Exp $
88
*
99
*-------------------------------------------------------------------------
1010
*/
@@ -31,7 +31,6 @@ static ScanKeyword ScanKeywords[] = {
3131
{"call", SQL_CALL},
3232
{"cardinality", SQL_CARDINALITY},
3333
{"connect", SQL_CONNECT},
34-
{"connection", SQL_CONNECTION},
3534
{"continue", SQL_CONTINUE},
3635
{"count", SQL_COUNT},
3736
{"current", SQL_CURRENT},

src/interfaces/ecpg/preproc/preproc.y

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.312 2005/11/27 01:22:23 tgl Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.313 2005/12/02 15:03:57 meskes Exp $ */
22

33
/* Copyright comment */
44
%{
@@ -324,7 +324,7 @@ add_additional_variables(char *name, bool insert)
324324

325325
/* special embedded SQL token */
326326
%token SQL_ALLOCATE SQL_AUTOCOMMIT SQL_BOOL SQL_BREAK
327-
SQL_CALL SQL_CARDINALITY SQL_CONNECT SQL_CONNECTION
327+
SQL_CALL SQL_CARDINALITY SQL_CONNECT
328328
SQL_CONTINUE SQL_COUNT SQL_CURRENT SQL_DATA
329329
SQL_DATETIME_INTERVAL_CODE
330330
SQL_DATETIME_INTERVAL_PRECISION SQL_DESCRIBE
@@ -506,7 +506,7 @@ add_additional_variables(char *name, bool insert)
506506
%type <str> opt_instead event RuleActionList opt_using CreateAssertStmt
507507
%type <str> RuleActionStmtOrEmpty RuleActionMulti func_as reindex_type
508508
%type <str> RuleStmt opt_column oper_argtypes NumConst var_name
509-
%type <str> MathOp RemoveFuncStmt aggr_argtype
509+
%type <str> MathOp RemoveFuncStmt aggr_argtype ECPGunreserved_con
510510
%type <str> RemoveAggrStmt opt_procedural select_no_parens CreateCastStmt
511511
%type <str> RemoveOperStmt RenameStmt all_Op opt_trusted opt_lancompiler
512512
%type <str> VariableSetStmt var_value zone_value VariableShowStmt
@@ -537,7 +537,7 @@ add_additional_variables(char *name, bool insert)
537537
%type <str> CreateGroupStmt AlterGroupStmt DropGroupStmt key_delete
538538
%type <str> opt_force key_update CreateSchemaStmt PosIntStringConst
539539
%type <str> IntConst PosIntConst grantee_list func_type opt_or_replace
540-
%type <str> select_limit CheckPointStmt
540+
%type <str> select_limit CheckPointStmt ECPGColId
541541
%type <str> OptSchemaName OptSchemaEltList schema_stmt opt_drop_behavior
542542
%type <str> handler_name any_name_list any_name opt_as insert_column_list
543543
%type <str> columnref function_name insert_target_el AllConstVar
@@ -1117,7 +1117,7 @@ set_rest: var_name TO var_list_or_default
11171117
{ $$ = make_str("session authorization default"); }
11181118
;
11191119

1120-
var_name: ColId { $$ = $1; }
1120+
var_name: ECPGColId { $$ = $1; }
11211121
| var_name '.' ColId { $$ = cat_str(3, $1, make_str("."), $3); }
11221122
;
11231123

@@ -5649,9 +5649,9 @@ on_off: ON { $$ = make_str("on"); }
56495649
* set the actual connection, this needs a differnet handling as the other
56505650
* set commands
56515651
*/
5652-
ECPGSetConnection: SET SQL_CONNECTION TO connection_object { $$ = $4; }
5653-
| SET SQL_CONNECTION '=' connection_object { $$ = $4; }
5654-
| SET SQL_CONNECTION connection_object { $$ = $3; }
5652+
ECPGSetConnection: SET CONNECTION TO connection_object { $$ = $4; }
5653+
| SET CONNECTION '=' connection_object { $$ = $4; }
5654+
| SET CONNECTION connection_object { $$ = $3; }
56555655
;
56565656

56575657
/*
@@ -5936,6 +5936,14 @@ symbol: ColLabel { $$ = $1; }
59365936
* is chosen in part to make keywords acceptable as names wherever possible.
59375937
*/
59385938

5939+
ECPGColId:ident { $$ = $1; }
5940+
| ECPGunreserved_interval { $$ = $1; }
5941+
| ECPGunreserved_con { $$ = $1; }
5942+
| col_name_keyword { $$ = $1; }
5943+
| ECPGKeywords { $$ = $1; }
5944+
| ECPGCKeywords { $$ = $1; }
5945+
| CHAR_P { $$ = make_str("char"); }
5946+
;
59395947
/* Column identifier --- names that can be column, table, etc names.
59405948
*/
59415949
ColId: ident { $$ = $1; }
@@ -6016,15 +6024,23 @@ ECPGCKeywords: S_AUTO { $$ = make_str("auto"); }
60166024
*/
60176025
unreserved_keyword: ECPGunreserved_interval | ECPGunreserved;
60186026

6019-
ECPGunreserved_interval: DAY_P { $$ = make_str("day"); }
6027+
ECPGunreserved_interval: DAY_P { $$ = make_str("day"); }
60206028
| HOUR_P { $$ = make_str("hour"); }
60216029
| MINUTE_P { $$ = make_str("minute"); }
60226030
| MONTH_P { $$ = make_str("month"); }
60236031
| SECOND_P { $$ = make_str("second"); }
60246032
| YEAR_P { $$ = make_str("year"); }
60256033
;
60266034

6027-
ECPGunreserved: ABORT_P { $$ = make_str("abort"); }
6035+
/* The following symbol must be excluded from var_name but still included in ColId
6036+
to enable ecpg special postgresql variables with this name:
6037+
CONNECTION
6038+
*/
6039+
ECPGunreserved: ECPGunreserved_con { $$ = $1; }
6040+
| CONNECTION { $$ = make_str("connection"); }
6041+
;
6042+
6043+
ECPGunreserved_con: ABORT_P { $$ = make_str("abort"); }
60286044
| ABSOLUTE_P { $$ = make_str("absolute"); }
60296045
| ACCESS { $$ = make_str("access"); }
60306046
| ACTION { $$ = make_str("action"); }
@@ -6052,7 +6068,7 @@ ECPGunreserved: ABORT_P { $$ = make_str("abort"); }
60526068
| COMMENT { $$ = make_str("comment"); }
60536069
| COMMIT { $$ = make_str("commit"); }
60546070
| COMMITTED { $$ = make_str("committed"); }
6055-
| CONNECTION { $$ = make_str("connection"); }
6071+
/* | CONNECTION { $$ = make_str("connection"); }*/
60566072
| CONSTRAINTS { $$ = make_str("constraints"); }
60576073
| CONVERSION_P { $$ = make_str("conversion"); }
60586074
| COPY { $$ = make_str("copy"); }

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy