Commit 77145ac8 authored by Michael Meskes's avatar Michael Meskes

- Synced gram.y and preproc.y.

        - Synced keyword.c.
        - Added several small patches from Christof.
parent 97cfb9d6
...@@ -1023,5 +1023,11 @@ Thu Nov 9 14:40:18 CET 2000 ...@@ -1023,5 +1023,11 @@ Thu Nov 9 14:40:18 CET 2000
Sat Nov 18 16:28:11 CET 2000 Sat Nov 18 16:28:11 CET 2000
- Synced gram.y and preproc.y. - Synced gram.y and preproc.y.
Mon Dec 18 12:27:52 CET 2000
- Synced gram.y and preproc.y.
- Synced keyword.c.
- Added several small patches from Christof.
- Set ecpg version to 2.8.0. - Set ecpg version to 2.8.0.
- Set library version to 3.2.0. - Set library version to 3.2.0.
...@@ -3,19 +3,21 @@ ...@@ -3,19 +3,21 @@
* definitions into ecpg programs * definitions into ecpg programs
*/ */
#include <stdio.h>
#ifndef __BEOS__ #ifndef __BEOS__
#ifndef __cplusplus #ifndef __cplusplus
#ifndef bool #ifndef bool
#define bool char #define bool char
#endif /* ndef bool */ #endif /* ndef bool */
#endif /* not C++ */
#ifndef true #ifndef true
#define true ((bool) 1) #define true ((bool) 1)
#endif #endif /* ndef true */
#ifndef false #ifndef false
#define bool char #define false ((bool) 0)
#endif /* ndef bool */ #endif /* ndef false */
#endif /* not C++ */
#else /* __BEOS__ */ #else /* __BEOS__ */
#include <SupportDefs.h> #include <SupportDefs.h>
#endif /* __BEOS__ */ #endif /* __BEOS__ */
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
* This is a typically recursive definition. A structure of typed list elements * This is a typically recursive definition. A structure of typed list elements
* would probably work fine: * would probably work fine:
*/ */
#include <stdio.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {
......
...@@ -236,12 +236,16 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -236,12 +236,16 @@ get_data(PGresult *results, int act_tuple, int act_field, int lineno,
{ {
if (pval[0] == 'f' && pval[1] == '\0') if (pval[0] == 'f' && pval[1] == '\0')
{ {
((char *) var)[act_tuple] = false; if (offset==sizeof(char)) ((char *) var)[act_tuple] = false;
else if (offset==sizeof(int)) ((int *) var)[act_tuple] = false;
else ECPGraise(lineno, ECPG_CONVERT_BOOL, "different size");
break; break;
} }
else if (pval[0] == 't' && pval[1] == '\0') else if (pval[0] == 't' && pval[1] == '\0')
{ {
((char *) var)[act_tuple] = true; if (offset==sizeof(char)) ((char *) var)[act_tuple] = true;
else if (offset==sizeof(int)) ((int *) var)[act_tuple] = true;
else ECPGraise(lineno, ECPG_CONVERT_BOOL, "different size");
break; break;
} }
else if (pval[0] == '\0' && PQgetisnull(results, act_tuple, act_field)) else if (pval[0] == '\0' && PQgetisnull(results, act_tuple, act_field))
......
...@@ -251,7 +251,6 @@ next_insert(char *text) ...@@ -251,7 +251,6 @@ next_insert(char *text)
char *ptr = text; char *ptr = text;
bool string = false; bool string = false;
printf("%s\n", text);
for (; *ptr != '\0' && (*ptr != '?' || string); ptr++) for (; *ptr != '\0' && (*ptr != '?' || string); ptr++)
{ {
if (*ptr == '\\') /* escape character */ if (*ptr == '\\') /* escape character */
...@@ -261,7 +260,6 @@ printf("%s\n", text); ...@@ -261,7 +260,6 @@ printf("%s\n", text);
string = string ? false : true; string = string ? false : true;
} }
printf("%s\n", ptr);
return (*ptr == '\0') ? NULL : ptr; return (*ptr == '\0') ? NULL : ptr;
} }
...@@ -1007,7 +1005,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...) ...@@ -1007,7 +1005,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
* *
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de> * Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
* *
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.14 2000/11/20 15:56:14 petere Exp $ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.15 2000/12/18 11:33:54 meskes Exp $
*/ */
PGconn *ECPG_internal_get_connection(char *name); PGconn *ECPG_internal_get_connection(char *name);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.33 2000/12/15 23:36:20 momjian Exp $ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.34 2000/12/18 11:33:55 meskes Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -245,6 +245,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -245,6 +245,7 @@ static ScanKeyword ScanKeywords[] = {
{"sysid", SYSID}, {"sysid", SYSID},
{"table", TABLE}, {"table", TABLE},
{"temp", TEMP}, {"temp", TEMP},
{"template", TEMPLATE},
{"temporary", TEMPORARY}, {"temporary", TEMPORARY},
{"then", THEN}, {"then", THEN},
{"time", TIME}, {"time", TIME},
......
...@@ -344,7 +344,7 @@ make_name(void) ...@@ -344,7 +344,7 @@ make_name(void)
%type <str> constraints_set_mode comment_type comment_cl comment_ag %type <str> constraints_set_mode comment_type comment_cl comment_ag
%type <str> CreateGroupStmt AlterGroupStmt DropGroupStmt key_delete %type <str> CreateGroupStmt AlterGroupStmt DropGroupStmt key_delete
%type <str> opt_force key_update CreateSchemaStmt PosIntStringConst %type <str> opt_force key_update CreateSchemaStmt PosIntStringConst
%type <str> SessionList SessionClause SetSessionStmt IntConst PosIntConst %type <str> IntConst PosIntConst
%type <str> select_limit opt_for_update_clause CheckPointStmt %type <str> select_limit opt_for_update_clause CheckPointStmt
%type <str> ECPGWhenever ECPGConnect connection_target ECPGOpen %type <str> ECPGWhenever ECPGConnect connection_target ECPGOpen
...@@ -444,7 +444,6 @@ stmt: AlterSchemaStmt { output_statement($1, 0, NULL, connection); } ...@@ -444,7 +444,6 @@ stmt: AlterSchemaStmt { output_statement($1, 0, NULL, connection); }
output_statement($1, 1, NULL, connection); output_statement($1, 1, NULL, connection);
} }
| RuleStmt { output_statement($1, 0, NULL, connection); } | RuleStmt { output_statement($1, 0, NULL, connection); }
| SetSessionStmt { output_statement($1, 0, NULL, connection); }
| TransactionStmt { | TransactionStmt {
fprintf(yyout, "{ ECPGtrans(__LINE__, %s, \"%s\");", connection ? connection : "NULL", $1); fprintf(yyout, "{ ECPGtrans(__LINE__, %s, \"%s\");", connection ? connection : "NULL", $1);
whenever_action(2); whenever_action(2);
...@@ -776,43 +775,6 @@ DropSchemaStmt: DROP SCHEMA UserId ...@@ -776,43 +775,6 @@ DropSchemaStmt: DROP SCHEMA UserId
} }
; ;
/*****************************************************************************
*
* Manipulate a postgresql session
*
*
*****************************************************************************/
SetSessionStmt: SET SESSION CHARACTERISTICS AS SessionList
{
$$ = cat2_str(make_str("set session characteristics as"), $5);
}
;
SessionList: SessionList ',' SessionClause
{
$$ = cat_str(3, $1, make_str(","), $3);
}
| SessionClause
{
$$ = $1;
}
;
SessionClause: TRANSACTION COMMIT opt_boolean
{
$$ = cat2_str(make_str("transaction commit"), $3);
}
| TIME ZONE zone_value
{
$$ = cat2_str(make_str("time zone"), $3);
}
| TRANSACTION ISOLATION LEVEL opt_level
{
$$ = cat2_str(make_str("transaction isolation level"), $4);
}
;
/***************************************************************************** /*****************************************************************************
* *
* Set PG internal variable * Set PG internal variable
...@@ -838,6 +800,10 @@ VariableSetStmt: SET ColId TO var_value ...@@ -838,6 +800,10 @@ VariableSetStmt: SET ColId TO var_value
{ {
$$ = cat2_str(make_str("set transaction isolation level"), $5); $$ = cat2_str(make_str("set transaction isolation level"), $5);
} }
| SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL opt_level
{
$$ = cat2_str(make_str("set session characteristics as transaction isolation level"), $8);
}
| SET NAMES opt_encoding | SET NAMES opt_encoding
{ {
$$ = cat2_str(make_str("set names"), $3); $$ = cat2_str(make_str("set names"), $3);
...@@ -3599,26 +3565,36 @@ position_list: b_expr IN b_expr ...@@ -3599,26 +3565,36 @@ position_list: b_expr IN b_expr
{ $$ = EMPTY; } { $$ = EMPTY; }
; ;
substr_list: expr_list substr_from substr_for substr_list: a_expr substr_from substr_for
{ {
$$ = cat_str(3, $1, $2, $3); $$ = cat_str(3, $1, $2, $3);
} }
| a_expr substr_for substr_from
{
$$ = cat_str(3, $1, $2, $3);
}
| a_expr substr_from
{
$$ = cat2_str($1, $2);
}
| a_expr substr_for
{
$$ = cat2_str($1, $2);
}
| expr_list
{
$$ = $1;
}
| /* EMPTY */ | /* EMPTY */
{ $$ = EMPTY; } { $$ = EMPTY; }
; ;
substr_from: FROM expr_list substr_from: FROM a_expr
{ $$ = cat2_str(make_str("from"), $2); } { $$ = cat2_str(make_str("from"), $2); }
| /* EMPTY */
{
$$ = EMPTY;
}
; ;
substr_for: FOR expr_list substr_for: FOR a_expr
{ $$ = cat2_str(make_str("for"), $2); } { $$ = cat2_str(make_str("for"), $2); }
| /* EMPTY */
{ $$ = EMPTY; }
; ;
trim_list: a_expr FROM expr_list trim_list: a_expr FROM expr_list
...@@ -3783,6 +3759,7 @@ relation_name: SpecialRuleRelation ...@@ -3783,6 +3759,7 @@ relation_name: SpecialRuleRelation
} }
; ;
name: ColId { $$ = $1; };
database_name: ColId { $$ = $1; }; database_name: ColId { $$ = $1; };
access_method: ColId { $$ = $1; }; access_method: ColId { $$ = $1; };
attr_name: ColId { $$ = $1; }; attr_name: ColId { $$ = $1; };
...@@ -3793,8 +3770,17 @@ index_name: ColId { $$ = $1; }; ...@@ -3793,8 +3770,17 @@ index_name: ColId { $$ = $1; };
* Include date/time keywords as SQL92 extension. * Include date/time keywords as SQL92 extension.
* Include TYPE as a SQL92 unreserved keyword. - thomas 1997-10-05 * Include TYPE as a SQL92 unreserved keyword. - thomas 1997-10-05
*/ */
name: ColId { $$ = $1; }; func_name: ColId { $$ = $1; };
func_name: ColId { $$ = $1; }; | BETWEEN { $$ = make_str("between");}
| ILIKE { $$ = make_str("ilike");}
| IN { $$ = make_str("in");}
| IS { $$ = make_str("is");}
| ISNULL { $$ = make_str("isnull");}
| LIKE { $$ = make_str("like");}
| NOTNULL { $$ = make_str("notnull");}
| OVERLAPS { $$ = make_str("overlaps");}
;
file_name: StringConst { $$ = $1; }; file_name: StringConst { $$ = $1; };
...@@ -4967,12 +4953,6 @@ opt_symbol: symbol { $$ = $1; } ...@@ -4967,12 +4953,6 @@ opt_symbol: symbol { $$ = $1; }
symbol: ColLabel { $$ = $1; }; symbol: ColLabel { $$ = $1; };
/* Any tokens which show up as operators will screw up the parsing if
* allowed as identifiers, but are acceptable as ColLabels:
* BETWEEN, IN, IS, ISNULL, NOTNULL, OVERLAPS
* Thanks to Tom Lane for pointing this out. - thomas 2000-03-29
*/
/* Parser tokens to be used as identifiers. /* Parser tokens to be used as identifiers.
* Tokens involving data types should appear in ColId only, * Tokens involving data types should appear in ColId only,
* since they will conflict with real TypeName productions. * since they will conflict with real TypeName productions.
...@@ -4991,6 +4971,7 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); } ...@@ -4991,6 +4971,7 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); }
| CACHE { $$ = make_str("cache"); } | CACHE { $$ = make_str("cache"); }
| CASCADE { $$ = make_str("cascade"); } | CASCADE { $$ = make_str("cascade"); }
| CHAIN { $$ = make_str("chain"); } | CHAIN { $$ = make_str("chain"); }
| CHARACTERISTICS { $$ = make_str("characteristics"); }
| CHECKPOINT { $$ = make_str("checkpoint"); } | CHECKPOINT { $$ = make_str("checkpoint"); }
| CLOSE { $$ = make_str("close"); } | CLOSE { $$ = make_str("close"); }
| COMMENT { $$ = make_str("comment"); } | COMMENT { $$ = make_str("comment"); }
...@@ -5017,7 +4998,6 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); } ...@@ -5017,7 +4998,6 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); }
| FUNCTION { $$ = make_str("function"); } | FUNCTION { $$ = make_str("function"); }
| GRANT { $$ = make_str("grant"); } | GRANT { $$ = make_str("grant"); }
| HANDLER { $$ = make_str("handler"); } | HANDLER { $$ = make_str("handler"); }
| ILIKE { $$ = make_str("ilike"); }
| IMMEDIATE { $$ = make_str("immediate"); } | IMMEDIATE { $$ = make_str("immediate"); }
| INCREMENT { $$ = make_str("increment"); } | INCREMENT { $$ = make_str("increment"); }
| INDEX { $$ = make_str("index"); } | INDEX { $$ = make_str("index"); }
...@@ -5030,7 +5010,6 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); } ...@@ -5030,7 +5010,6 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); }
| LANGUAGE { $$ = make_str("language"); } | LANGUAGE { $$ = make_str("language"); }
| LANCOMPILER { $$ = make_str("lancompiler"); } | LANCOMPILER { $$ = make_str("lancompiler"); }
| LEVEL { $$ = make_str("level"); } | LEVEL { $$ = make_str("level"); }
| LIKE { $$ = make_str("like"); }
| LOCATION { $$ = make_str("location"); } | LOCATION { $$ = make_str("location"); }
| MATCH { $$ = make_str("match"); } | MATCH { $$ = make_str("match"); }
| MAXVALUE { $$ = make_str("maxvalue"); } | MAXVALUE { $$ = make_str("maxvalue"); }
...@@ -5165,6 +5144,7 @@ ECPGColLabel: ECPGColId { $$ = $1; } ...@@ -5165,6 +5144,7 @@ ECPGColLabel: ECPGColId { $$ = $1; }
| GLOBAL { $$ = make_str("global"); } | GLOBAL { $$ = make_str("global"); }
| GROUP { $$ = make_str("group"); } | GROUP { $$ = make_str("group"); }
| HAVING { $$ = make_str("having"); } | HAVING { $$ = make_str("having"); }
| ILIKE { $$ = make_str("ilike"); }
| INITIALLY { $$ = make_str("initially"); } | INITIALLY { $$ = make_str("initially"); }
| INNER_P { $$ = make_str("inner"); } | INNER_P { $$ = make_str("inner"); }
| INTERSECT { $$ = make_str("intersect"); } | INTERSECT { $$ = make_str("intersect"); }
...@@ -5173,6 +5153,8 @@ ECPGColLabel: ECPGColId { $$ = $1; } ...@@ -5173,6 +5153,8 @@ ECPGColLabel: ECPGColId { $$ = $1; }
| JOIN { $$ = make_str("join"); } | JOIN { $$ = make_str("join"); }
| LEADING { $$ = make_str("leading"); } | LEADING { $$ = make_str("leading"); }
| LEFT { $$ = make_str("left"); } | LEFT { $$ = make_str("left"); }
| LIKE { $$ = make_str("like"); }
| LIMIT { $$ = make_str("limit"); }
| LISTEN { $$ = make_str("listen"); } | LISTEN { $$ = make_str("listen"); }
| LOAD { $$ = make_str("load"); } | LOAD { $$ = make_str("load"); }
| LOCK_P { $$ = make_str("lock"); } | LOCK_P { $$ = make_str("lock"); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment