Skip to content

Commit 77145ac

Browse files
author
Michael Meskes
committed
- Synced gram.y and preproc.y.
- Synced keyword.c. - Added several small patches from Christof.
1 parent 97cfb9d commit 77145ac

File tree

7 files changed

+61
-70
lines changed

7 files changed

+61
-70
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,5 +1023,11 @@ Thu Nov 9 14:40:18 CET 2000
10231023
Sat Nov 18 16:28:11 CET 2000
10241024

10251025
- Synced gram.y and preproc.y.
1026+
1027+
Mon Dec 18 12:27:52 CET 2000
1028+
1029+
- Synced gram.y and preproc.y.
1030+
- Synced keyword.c.
1031+
- Added several small patches from Christof.
10261032
- Set ecpg version to 2.8.0.
10271033
- Set library version to 3.2.0.

src/interfaces/ecpg/include/ecpglib.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,21 @@
33
* definitions into ecpg programs
44
*/
55

6+
#include <stdio.h>
7+
68
#ifndef __BEOS__
79
#ifndef __cplusplus
810
#ifndef bool
911
#define bool char
1012
#endif /* ndef bool */
11-
#endif /* not C++ */
1213

1314
#ifndef true
1415
#define true ((bool) 1)
15-
#endif
16+
#endif /* ndef true */
1617
#ifndef false
17-
#define bool char
18-
#endif /* ndef bool */
18+
#define false ((bool) 0)
19+
#endif /* ndef false */
20+
#endif /* not C++ */
1921
#else /* __BEOS__ */
2022
#include <SupportDefs.h>
2123
#endif /* __BEOS__ */

src/interfaces/ecpg/include/ecpgtype.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
* This is a typically recursive definition. A structure of typed list elements
2828
* would probably work fine:
2929
*/
30-
#include <stdio.h>
31-
3230
#ifdef __cplusplus
3331
extern "C"
3432
{

src/interfaces/ecpg/lib/data.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,16 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
236236
{
237237
if (pval[0] == 'f' && pval[1] == '\0')
238238
{
239-
((char *) var)[act_tuple] = false;
239+
if (offset==sizeof(char)) ((char *) var)[act_tuple] = false;
240+
else if (offset==sizeof(int)) ((int *) var)[act_tuple] = false;
241+
else ECPGraise(lineno, ECPG_CONVERT_BOOL, "different size");
240242
break;
241243
}
242244
else if (pval[0] == 't' && pval[1] == '\0')
243245
{
244-
((char *) var)[act_tuple] = true;
246+
if (offset==sizeof(char)) ((char *) var)[act_tuple] = true;
247+
else if (offset==sizeof(int)) ((int *) var)[act_tuple] = true;
248+
else ECPGraise(lineno, ECPG_CONVERT_BOOL, "different size");
245249
break;
246250
}
247251
else if (pval[0] == '\0' && PQgetisnull(results, act_tuple, act_field))

src/interfaces/ecpg/lib/execute.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ next_insert(char *text)
251251
char *ptr = text;
252252
bool string = false;
253253

254-
printf("%s\n", text);
255254
for (; *ptr != '\0' && (*ptr != '?' || string); ptr++)
256255
{
257256
if (*ptr == '\\') /* escape character */
@@ -261,7 +260,6 @@ printf("%s\n", text);
261260
string = string ? false : true;
262261
}
263262

264-
printf("%s\n", ptr);
265263
return (*ptr == '\0') ? NULL : ptr;
266264
}
267265

@@ -1007,7 +1005,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
10071005
*
10081006
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
10091007
*
1010-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.14 2000/11/20 15:56:14 petere Exp $
1008+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.15 2000/12/18 11:33:54 meskes Exp $
10111009
*/
10121010

10131011
PGconn *ECPG_internal_get_connection(char *name);

src/interfaces/ecpg/preproc/keywords.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.33 2000/12/15 23:36:20 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.34 2000/12/18 11:33:55 meskes Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -245,6 +245,7 @@ static ScanKeyword ScanKeywords[] = {
245245
{"sysid", SYSID},
246246
{"table", TABLE},
247247
{"temp", TEMP},
248+
{"template", TEMPLATE},
248249
{"temporary", TEMPORARY},
249250
{"then", THEN},
250251
{"time", TIME},

src/interfaces/ecpg/preproc/preproc.y

Lines changed: 40 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ make_name(void)
344344
%type <str> constraints_set_mode comment_type comment_cl comment_ag
345345
%type <str> CreateGroupStmt AlterGroupStmt DropGroupStmt key_delete
346346
%type <str> opt_force key_update CreateSchemaStmt PosIntStringConst
347-
%type <str> SessionList SessionClause SetSessionStmt IntConst PosIntConst
347+
%type <str> IntConst PosIntConst
348348
%type <str> select_limit opt_for_update_clause CheckPointStmt
349349

350350
%type <str> ECPGWhenever ECPGConnect connection_target ECPGOpen
@@ -444,7 +444,6 @@ stmt: AlterSchemaStmt { output_statement($1, 0, NULL, connection); }
444444
output_statement($1, 1, NULL, connection);
445445
}
446446
| RuleStmt { output_statement($1, 0, NULL, connection); }
447-
| SetSessionStmt { output_statement($1, 0, NULL, connection); }
448447
| TransactionStmt {
449448
fprintf(yyout, "{ ECPGtrans(__LINE__, %s, \"%s\");", connection ? connection : "NULL", $1);
450449
whenever_action(2);
@@ -776,43 +775,6 @@ DropSchemaStmt: DROP SCHEMA UserId
776775
}
777776
;
778777

779-
/*****************************************************************************
780-
*
781-
* Manipulate a postgresql session
782-
*
783-
*
784-
*****************************************************************************/
785-
786-
SetSessionStmt: SET SESSION CHARACTERISTICS AS SessionList
787-
{
788-
$$ = cat2_str(make_str("set session characteristics as"), $5);
789-
}
790-
;
791-
792-
SessionList: SessionList ',' SessionClause
793-
{
794-
$$ = cat_str(3, $1, make_str(","), $3);
795-
}
796-
| SessionClause
797-
{
798-
$$ = $1;
799-
}
800-
;
801-
802-
SessionClause: TRANSACTION COMMIT opt_boolean
803-
{
804-
$$ = cat2_str(make_str("transaction commit"), $3);
805-
}
806-
| TIME ZONE zone_value
807-
{
808-
$$ = cat2_str(make_str("time zone"), $3);
809-
}
810-
| TRANSACTION ISOLATION LEVEL opt_level
811-
{
812-
$$ = cat2_str(make_str("transaction isolation level"), $4);
813-
}
814-
;
815-
816778
/*****************************************************************************
817779
*
818780
* Set PG internal variable
@@ -838,6 +800,10 @@ VariableSetStmt: SET ColId TO var_value
838800
{
839801
$$ = cat2_str(make_str("set transaction isolation level"), $5);
840802
}
803+
| SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL opt_level
804+
{
805+
$$ = cat2_str(make_str("set session characteristics as transaction isolation level"), $8);
806+
}
841807
| SET NAMES opt_encoding
842808
{
843809
$$ = cat2_str(make_str("set names"), $3);
@@ -3599,26 +3565,36 @@ position_list: b_expr IN b_expr
35993565
{ $$ = EMPTY; }
36003566
;
36013567

3602-
substr_list: expr_list substr_from substr_for
3568+
substr_list: a_expr substr_from substr_for
36033569
{
36043570
$$ = cat_str(3, $1, $2, $3);
36053571
}
3572+
| a_expr substr_for substr_from
3573+
{
3574+
$$ = cat_str(3, $1, $2, $3);
3575+
}
3576+
| a_expr substr_from
3577+
{
3578+
$$ = cat2_str($1, $2);
3579+
}
3580+
| a_expr substr_for
3581+
{
3582+
$$ = cat2_str($1, $2);
3583+
}
3584+
| expr_list
3585+
{
3586+
$$ = $1;
3587+
}
36063588
| /* EMPTY */
36073589
{ $$ = EMPTY; }
36083590
;
36093591

3610-
substr_from: FROM expr_list
3592+
substr_from: FROM a_expr
36113593
{ $$ = cat2_str(make_str("from"), $2); }
3612-
| /* EMPTY */
3613-
{
3614-
$$ = EMPTY;
3615-
}
36163594
;
36173595

3618-
substr_for: FOR expr_list
3596+
substr_for: FOR a_expr
36193597
{ $$ = cat2_str(make_str("for"), $2); }
3620-
| /* EMPTY */
3621-
{ $$ = EMPTY; }
36223598
;
36233599

36243600
trim_list: a_expr FROM expr_list
@@ -3783,6 +3759,7 @@ relation_name: SpecialRuleRelation
37833759
}
37843760
;
37853761

3762+
name: ColId { $$ = $1; };
37863763
database_name: ColId { $$ = $1; };
37873764
access_method: ColId { $$ = $1; };
37883765
attr_name: ColId { $$ = $1; };
@@ -3793,8 +3770,17 @@ index_name: ColId { $$ = $1; };
37933770
* Include date/time keywords as SQL92 extension.
37943771
* Include TYPE as a SQL92 unreserved keyword. - thomas 1997-10-05
37953772
*/
3796-
name: ColId { $$ = $1; };
3797-
func_name: ColId { $$ = $1; };
3773+
func_name: ColId { $$ = $1; };
3774+
| BETWEEN { $$ = make_str("between");}
3775+
| ILIKE { $$ = make_str("ilike");}
3776+
| IN { $$ = make_str("in");}
3777+
| IS { $$ = make_str("is");}
3778+
| ISNULL { $$ = make_str("isnull");}
3779+
| LIKE { $$ = make_str("like");}
3780+
| NOTNULL { $$ = make_str("notnull");}
3781+
| OVERLAPS { $$ = make_str("overlaps");}
3782+
;
3783+
37983784

37993785
file_name: StringConst { $$ = $1; };
38003786

@@ -4967,12 +4953,6 @@ opt_symbol: symbol { $$ = $1; }
49674953

49684954
symbol: ColLabel { $$ = $1; };
49694955

4970-
/* Any tokens which show up as operators will screw up the parsing if
4971-
* allowed as identifiers, but are acceptable as ColLabels:
4972-
* BETWEEN, IN, IS, ISNULL, NOTNULL, OVERLAPS
4973-
* Thanks to Tom Lane for pointing this out. - thomas 2000-03-29
4974-
*/
4975-
49764956
/* Parser tokens to be used as identifiers.
49774957
* Tokens involving data types should appear in ColId only,
49784958
* since they will conflict with real TypeName productions.
@@ -4991,6 +4971,7 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); }
49914971
| CACHE { $$ = make_str("cache"); }
49924972
| CASCADE { $$ = make_str("cascade"); }
49934973
| CHAIN { $$ = make_str("chain"); }
4974+
| CHARACTERISTICS { $$ = make_str("characteristics"); }
49944975
| CHECKPOINT { $$ = make_str("checkpoint"); }
49954976
| CLOSE { $$ = make_str("close"); }
49964977
| COMMENT { $$ = make_str("comment"); }
@@ -5017,7 +4998,6 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); }
50174998
| FUNCTION { $$ = make_str("function"); }
50184999
| GRANT { $$ = make_str("grant"); }
50195000
| HANDLER { $$ = make_str("handler"); }
5020-
| ILIKE { $$ = make_str("ilike"); }
50215001
| IMMEDIATE { $$ = make_str("immediate"); }
50225002
| INCREMENT { $$ = make_str("increment"); }
50235003
| INDEX { $$ = make_str("index"); }
@@ -5030,7 +5010,6 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); }
50305010
| LANGUAGE { $$ = make_str("language"); }
50315011
| LANCOMPILER { $$ = make_str("lancompiler"); }
50325012
| LEVEL { $$ = make_str("level"); }
5033-
| LIKE { $$ = make_str("like"); }
50345013
| LOCATION { $$ = make_str("location"); }
50355014
| MATCH { $$ = make_str("match"); }
50365015
| MAXVALUE { $$ = make_str("maxvalue"); }
@@ -5165,6 +5144,7 @@ ECPGColLabel: ECPGColId { $$ = $1; }
51655144
| GLOBAL { $$ = make_str("global"); }
51665145
| GROUP { $$ = make_str("group"); }
51675146
| HAVING { $$ = make_str("having"); }
5147+
| ILIKE { $$ = make_str("ilike"); }
51685148
| INITIALLY { $$ = make_str("initially"); }
51695149
| INNER_P { $$ = make_str("inner"); }
51705150
| INTERSECT { $$ = make_str("intersect"); }
@@ -5173,6 +5153,8 @@ ECPGColLabel: ECPGColId { $$ = $1; }
51735153
| JOIN { $$ = make_str("join"); }
51745154
| LEADING { $$ = make_str("leading"); }
51755155
| LEFT { $$ = make_str("left"); }
5156+
| LIKE { $$ = make_str("like"); }
5157+
| LIMIT { $$ = make_str("limit"); }
51765158
| LISTEN { $$ = make_str("listen"); }
51775159
| LOAD { $$ = make_str("load"); }
51785160
| LOCK_P { $$ = make_str("lock"); }

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