From ac3884e2a9aeb4db54a4be0ff4ee146bf895da9c Mon Sep 17 00:00:00 2001 From: Michael Meskes Date: Thu, 23 Mar 2000 07:53:48 +0000 Subject: [PATCH] *** empty log message *** --- src/interfaces/ecpg/ChangeLog | 4 ++ src/interfaces/ecpg/preproc/keywords.c | 3 +- src/interfaces/ecpg/preproc/preproc.y | 51 ++++++++++++++++++++++++-- 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog index 806c6e56e7..42d14534f8 100644 --- a/src/interfaces/ecpg/ChangeLog +++ b/src/interfaces/ecpg/ChangeLog @@ -871,5 +871,9 @@ Wed Mar 15 17:36:02 CET 2000 Sun Mar 19 11:03:13 CET 2000 - Fixed quoting bug in disconnect statement. + +Thu Mar 23 08:13:39 CET 2000 + + - Synced preproc.y and keyword.c. - Set library version to 3.1.0. - Set ecpg version to 2.7.0. diff --git a/src/interfaces/ecpg/preproc/keywords.c b/src/interfaces/ecpg/preproc/keywords.c index ebfeab61f1..891bc5129c 100644 --- a/src/interfaces/ecpg/preproc/keywords.c +++ b/src/interfaces/ecpg/preproc/keywords.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.24 2000/03/15 19:09:10 meskes Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.25 2000/03/23 07:53:48 meskes Exp $ * *------------------------------------------------------------------------- */ @@ -48,6 +48,7 @@ static ScanKeyword ScanKeywords[] = { {"begin", BEGIN_TRANS}, {"between", BETWEEN}, {"binary", BINARY}, + {"bit", BIT}, {"both", BOTH}, {"by", BY}, {"cache", CACHE}, diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y index 386097a48d..f921fe4081 100644 --- a/src/interfaces/ecpg/preproc/preproc.y +++ b/src/interfaces/ecpg/preproc/preproc.y @@ -223,7 +223,7 @@ make_name(void) * - Todd A. Brandys 1998-01-01? */ %token ABORT_TRANS, ACCESS, AFTER, AGGREGATE, ANALYZE, - BACKWARD, BEFORE, BINARY, + BACKWARD, BEFORE, BINARY, BIT CACHE, CLUSTER, COMMENT, COPY, CREATEDB, CREATEUSER, CYCLE, DATABASE, DELIMITERS, DO, EACH, ENCODING, EXCLUSIVE, EXPLAIN, EXTEND, @@ -326,7 +326,7 @@ make_name(void) %type CreatePLangStmt IntegerOnly TriggerFuncArgs TriggerFuncArg %type ViewStmt LoadStmt CreatedbStmt createdb_opt_encoding %type createdb_opt_location opt_encoding AlterTableStmt -%type DropdbStmt ClusterStmt grantee RevokeStmt table_expr +%type DropdbStmt ClusterStmt grantee RevokeStmt table_expr Bit bit %type GrantStmt privileges operation_commalist operation %type opt_cursor opt_lmode ConstraintsSetStmt comment_tg %type case_expr when_clause_list case_default case_arg when_clause @@ -2899,6 +2899,7 @@ Typename: SimpleTypename opt_array_bounds SimpleTypename: Generic { $$ = $1; } | Datetime { $$ = $1; } | Numeric { $$ = $1; } + | Bit { $$ = $1; } | Character { $$ = $1; } ; @@ -3059,6 +3060,35 @@ opt_decimal: '(' Iconst ',' Iconst ')' } ; +/* + * SQL92 bit-field data types + * The following implements BIT() and BIT VARYING(). + */ +Bit: bit '(' Iconst ')' + { + $$ = cat_str(4, $1, make_str("("), $3, make_str(")")); + if (atol($3) < 1) + { + sprintf(errortext,"length for type '%s' must be at least 1",$1); + mmerror(ET_ERROR, errortext); + } + else if (atol($3) > (MaxAttrSize *sizeof(char))) + { + sprintf(errortext, "length for type '%s' cannot exceed %ld", $1, + (MaxAttrSize * sizeof(char))); + } + } + | bit + { + $$ = $1; + } + ; + +bit: BIT opt_varying + { + $$ = cat2_str(make_str("bit"), $2); + } + /* * SQL92 character data types * The following implements CHAR() and VARCHAR(). @@ -3250,6 +3280,8 @@ a_expr: c_expr * If you add more explicitly-known operators, be sure to add them * also to b_expr and to the MathOp list above. */ + | '+' a_expr %prec UMINUS + { $$ = cat2_str(make_str("+"), $2); } | '-' a_expr %prec UMINUS { $$ = cat2_str(make_str("-"), $2); } | '%' a_expr @@ -3262,7 +3294,10 @@ a_expr: c_expr { $$ = cat2_str(make_str(":"), $2); } */ | ';' a_expr - { $$ = cat2_str(make_str(";"), $2); } + { $$ = cat2_str(make_str(";"), $2); + mmerror(ET_WARN, "The ';' operator is deprecated. Use ln(x) instead." + "\n\tThis operator will be removed in a future release."); + } | a_expr '%' { $$ = cat2_str($1, make_str("%")); } | a_expr '^' @@ -3380,7 +3415,10 @@ b_expr: c_expr { $$ = cat2_str(make_str(":"), $2); } */ | ';' b_expr - { $$ = cat2_str(make_str(";"), $2); } + { $$ = cat2_str(make_str(";"), $2); + mmerror(ET_WARN, "The ';' operator is deprecated. Use ln(x) instead." + "\n\tThis operator will be removed in a future release."); + } | b_expr '%' { $$ = cat2_str($1, make_str("%")); } | b_expr '^' @@ -3810,6 +3848,8 @@ TypeId: ColId { $$ = $1; } | numeric { $$ = $1; } + | bit + { $$ = $1; } | character { $$ = $1; } ; @@ -4884,6 +4924,7 @@ ECPGColId: /* to be used instead of ColId */ | EACH { $$ = make_str("each"); } | ENCODING { $$ = make_str("encoding"); } | EXCLUSIVE { $$ = make_str("exclusive"); } + | FORCE { $$ = make_str("force"); } | FORWARD { $$ = make_str("forward"); } | FUNCTION { $$ = make_str("function"); } | HANDLER { $$ = make_str("handler"); } @@ -4957,7 +4998,9 @@ ECPGColLabel: ECPGColId { $$ = $1; } | ABORT_TRANS { $$ = make_str("abort"); } | ANALYZE { $$ = make_str("analyze"); } | BINARY { $$ = make_str("binary"); } + | BIT { $$ = make_str("bit"); } | CASE { $$ = make_str("case"); } + | CHARACTER { $$ = make_str("character"); } | CLUSTER { $$ = make_str("cluster"); } | COALESCE { $$ = make_str("coalesce"); } | CONSTRAINT { $$ = make_str("constraint"); } -- 2.40.0