Commit 53f93cbb authored by Michael Meskes's avatar Michael Meskes

Updated parser file to the one generated by the latest version of...

Updated parser file to the one generated by the latest version of parse.[awk|pl] from the latest version of gram.y
Some small corrections to test suite.
parent cd583703
/* header */ /* header */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.382 2008/11/11 11:41:23 meskes Exp $ */ /* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.383 2008/11/13 11:54:39 meskes Exp $ */
/* Copyright comment */ /* Copyright comment */
%{ %{
...@@ -390,6 +390,7 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu ...@@ -390,6 +390,7 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu
struct prep prep; struct prep prep;
} }
/* tokens */ /* tokens */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.383 2008/11/13 11:54:39 meskes Exp $ */
/* special embedded SQL token */ /* special embedded SQL token */
%token SQL_ALLOCATE SQL_AUTOCOMMIT SQL_BOOL SQL_BREAK %token SQL_ALLOCATE SQL_AUTOCOMMIT SQL_BOOL SQL_BREAK
SQL_CALL SQL_CARDINALITY SQL_CONNECT SQL_CALL SQL_CARDINALITY SQL_CONNECT
...@@ -512,8 +513,6 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu ...@@ -512,8 +513,6 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu
%type <str> SeqOptElem %type <str> SeqOptElem
%type <str> opt_by %type <str> opt_by
%type <str> NumericOnly %type <str> NumericOnly
%type <str> FloatOnly
%type <str> IntegerOnly
%type <str> CreatePLangStmt %type <str> CreatePLangStmt
%type <str> opt_trusted %type <str> opt_trusted
%type <str> handler_name %type <str> handler_name
...@@ -838,6 +837,7 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu ...@@ -838,6 +837,7 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu
%type <str> file_name %type <str> file_name
%type <str> func_name %type <str> func_name
%type <str> AexprConst %type <str> AexprConst
%type <str> Iconst
%type <str> RoleId %type <str> RoleId
%type <str> SignedIconst %type <str> SignedIconst
%type <str> ColId %type <str> ColId
...@@ -847,6 +847,7 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu ...@@ -847,6 +847,7 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu
%type <str> reserved_keyword %type <str> reserved_keyword
%type <str> SpecialRuleRelation %type <str> SpecialRuleRelation
/* ecpgtype */ /* ecpgtype */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.383 2008/11/13 11:54:39 meskes Exp $ */
%type <str> ECPGAllocateDescr %type <str> ECPGAllocateDescr
%type <str> ECPGCKeywords %type <str> ECPGCKeywords
%type <str> ECPGColId %type <str> ECPGColId
...@@ -893,7 +894,6 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu ...@@ -893,7 +894,6 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu
%type <str> char_variable %type <str> char_variable
%type <str> civar %type <str> civar
%type <str> civarind %type <str> civarind
%type <str> ColId_or_real_sconst
%type <str> ColLabel %type <str> ColLabel
%type <str> connect_options %type <str> connect_options
%type <str> connection_object %type <str> connection_object
...@@ -906,13 +906,10 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu ...@@ -906,13 +906,10 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu
%type <str> dis_name %type <str> dis_name
%type <str> ecpg_bconst %type <str> ecpg_bconst
%type <str> ecpg_fconst %type <str> ecpg_fconst
%type <str> ecpg_iconst
%type <str> ecpg_ident %type <str> ecpg_ident
%type <str> ecpg_interval %type <str> ecpg_interval
%type <str> ecpg_into %type <str> ecpg_into
%type <str> ecpg_param %type <str> ecpg_param
%type <str> ecpg_real_iconst
%type <str> ecpg_real_sconst
%type <str> ecpg_sconst %type <str> ecpg_sconst
%type <str> ecpg_using %type <str> ecpg_using
%type <str> ecpg_xconst %type <str> ecpg_xconst
...@@ -1600,7 +1597,7 @@ prog: statements; ...@@ -1600,7 +1597,7 @@ prog: statements;
{ {
$$ = cat_str(2,make_str("user"),$2); $$ = cat_str(2,make_str("user"),$2);
} }
| SYSID ecpg_iconst | SYSID Iconst
{ {
$$ = cat_str(2,make_str("sysid"),$2); $$ = cat_str(2,make_str("sysid"),$2);
} }
...@@ -1899,7 +1896,7 @@ ECPGColId ...@@ -1899,7 +1896,7 @@ ECPGColId
{ {
$$ = $1; $$ = $1;
} }
| ColId_or_real_sconst | ColId_or_Sconst
{ {
$$ = $1; $$ = $1;
} }
...@@ -1957,7 +1954,7 @@ ECPGColId ...@@ -1957,7 +1954,7 @@ ECPGColId
zone_value: zone_value:
ecpg_real_sconst ecpg_sconst
{ {
$$ = $1; $$ = $1;
} }
...@@ -1969,7 +1966,7 @@ ecpg_real_sconst ...@@ -1969,7 +1966,7 @@ ecpg_real_sconst
{ {
$$ = cat_str(3,$1,$2,$3); $$ = cat_str(3,$1,$2,$3);
} }
| ConstInterval '(' ecpg_iconst ')' ecpg_sconst opt_interval | ConstInterval '(' Iconst ')' ecpg_sconst opt_interval
{ {
$$ = cat_str(6,$1,make_str("("),$3,make_str(")"),$5,$6); $$ = cat_str(6,$1,make_str("("),$3,make_str(")"),$5,$6);
} }
...@@ -2185,7 +2182,7 @@ SHOW var_name ecpg_into ...@@ -2185,7 +2182,7 @@ SHOW var_name ecpg_into
{ {
$$ = cat_str(4,make_str("alter"),$2,$3,make_str("set not null")); $$ = cat_str(4,make_str("alter"),$2,$3,make_str("set not null"));
} }
| ALTER opt_column ColId SET STATISTICS IntegerOnly | ALTER opt_column ColId SET STATISTICS SignedIconst
{ {
$$ = cat_str(5,make_str("alter"),$2,$3,make_str("set statistics"),$6); $$ = cat_str(5,make_str("alter"),$2,$3,make_str("set statistics"),$6);
} }
...@@ -3085,18 +3082,6 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\ ...@@ -3085,18 +3082,6 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\
NumericOnly: NumericOnly:
FloatOnly
{
$$ = $1;
}
| IntegerOnly
{
$$ = $1;
}
;
FloatOnly:
ecpg_fconst ecpg_fconst
{ {
$$ = $1; $$ = $1;
...@@ -3105,14 +3090,13 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\ ...@@ -3105,14 +3090,13 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\
{ {
$$ = cat_str(2,make_str("-"),$2); $$ = cat_str(2,make_str("-"),$2);
} }
; | SignedIconst
IntegerOnly:
SignedIconst
{ {
$$ = $1; $$ = $1;
} }
;
; ;
...@@ -3337,7 +3321,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\ ...@@ -3337,7 +3321,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\
TriggerFuncArg: TriggerFuncArg:
ecpg_iconst Iconst
{ {
$$ = $1; $$ = $1;
} }
...@@ -3345,7 +3329,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\ ...@@ -3345,7 +3329,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\
{ {
$$ = $1; $$ = $1;
} }
| ecpg_real_sconst | ecpg_sconst
{ {
$$ = $1; $$ = $1;
} }
...@@ -3555,7 +3539,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\ ...@@ -3555,7 +3539,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\
{ {
$$ = $1; $$ = $1;
} }
| ecpg_real_sconst | ecpg_sconst
{ {
$$ = $1; $$ = $1;
} }
...@@ -3635,19 +3619,19 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\ ...@@ -3635,19 +3619,19 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\
opclass_item: opclass_item:
OPERATOR ecpg_iconst any_operator opt_recheck OPERATOR Iconst any_operator opt_recheck
{ {
$$ = cat_str(4,make_str("operator"),$2,$3,$4); $$ = cat_str(4,make_str("operator"),$2,$3,$4);
} }
| OPERATOR ecpg_iconst any_operator oper_argtypes opt_recheck | OPERATOR Iconst any_operator oper_argtypes opt_recheck
{ {
$$ = cat_str(5,make_str("operator"),$2,$3,$4,$5); $$ = cat_str(5,make_str("operator"),$2,$3,$4,$5);
} }
| FUNCTION ecpg_iconst func_name func_args | FUNCTION Iconst func_name func_args
{ {
$$ = cat_str(4,make_str("function"),$2,$3,$4); $$ = cat_str(4,make_str("function"),$2,$3,$4);
} }
| FUNCTION ecpg_iconst '(' type_list ')' func_name func_args | FUNCTION Iconst '(' type_list ')' func_name func_args
{ {
$$ = cat_str(7,make_str("function"),$2,make_str("("),$4,make_str(")"),$6,$7); $$ = cat_str(7,make_str("function"),$2,make_str("("),$4,make_str(")"),$6,$7);
} }
...@@ -3725,11 +3709,11 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\ ...@@ -3725,11 +3709,11 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\
opclass_drop: opclass_drop:
OPERATOR ecpg_iconst '(' type_list ')' OPERATOR Iconst '(' type_list ')'
{ {
$$ = cat_str(5,make_str("operator"),$2,make_str("("),$4,make_str(")")); $$ = cat_str(5,make_str("operator"),$2,make_str("("),$4,make_str(")"));
} }
| FUNCTION ecpg_iconst '(' type_list ')' | FUNCTION Iconst '(' type_list ')'
{ {
$$ = cat_str(5,make_str("function"),$2,make_str("("),$4,make_str(")")); $$ = cat_str(5,make_str("function"),$2,make_str("("),$4,make_str(")"));
} }
...@@ -5495,11 +5479,11 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\ ...@@ -5495,11 +5479,11 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\
{ {
$$ = cat_str(3,make_str("template"),$2,make_str("default")); $$ = cat_str(3,make_str("template"),$2,make_str("default"));
} }
| ENCODING opt_equal ecpg_real_sconst | ENCODING opt_equal ecpg_sconst
{ {
$$ = cat_str(3,make_str("encoding"),$2,$3); $$ = cat_str(3,make_str("encoding"),$2,$3);
} }
| ENCODING opt_equal ecpg_iconst | ENCODING opt_equal Iconst
{ {
$$ = cat_str(3,make_str("encoding"),$2,$3); $$ = cat_str(3,make_str("encoding"),$2,$3);
} }
...@@ -6933,11 +6917,11 @@ EXECUTE prepared_name execute_param_clause execute_rest ...@@ -6933,11 +6917,11 @@ EXECUTE prepared_name execute_param_clause execute_rest
{ $$ = cat2_str($1, $2.str); } { $$ = cat2_str($1, $2.str); }
| SETOF SimpleTypename opt_array_bounds | SETOF SimpleTypename opt_array_bounds
{ $$ = $$ = cat_str(3, make_str("setof"), $2, $3.str); } { $$ = $$ = cat_str(3, make_str("setof"), $2, $3.str); }
| SimpleTypename ARRAY '[' ecpg_iconst ']' | SimpleTypename ARRAY '[' Iconst ']'
{ {
$$ = cat_str(4,$1,make_str("array ["),$4,make_str("]")); $$ = cat_str(4,$1,make_str("array ["),$4,make_str("]"));
} }
| SETOF SimpleTypename ARRAY '[' ecpg_iconst ']' | SETOF SimpleTypename ARRAY '[' Iconst ']'
{ {
$$ = cat_str(5,make_str("setof"),$2,make_str("array ["),$5,make_str("]")); $$ = cat_str(5,make_str("setof"),$2,make_str("array ["),$5,make_str("]"));
} }
...@@ -7007,7 +6991,7 @@ EXECUTE prepared_name execute_param_clause execute_rest ...@@ -7007,7 +6991,7 @@ EXECUTE prepared_name execute_param_clause execute_rest
{ {
$$ = cat_str(2,$1,$2); $$ = cat_str(2,$1,$2);
} }
| ConstInterval '(' ecpg_iconst ')' opt_interval | ConstInterval '(' Iconst ')' opt_interval
{ {
$$ = cat_str(5,$1,make_str("("),$3,make_str(")"),$5); $$ = cat_str(5,$1,make_str("("),$3,make_str(")"),$5);
} }
...@@ -7106,7 +7090,7 @@ EXECUTE prepared_name execute_param_clause execute_rest ...@@ -7106,7 +7090,7 @@ EXECUTE prepared_name execute_param_clause execute_rest
opt_float: opt_float:
'(' ecpg_iconst ')' '(' Iconst ')'
{ {
$$ = cat_str(3,make_str("("),$2,make_str(")")); $$ = cat_str(3,make_str("("),$2,make_str(")"));
} }
...@@ -7181,7 +7165,7 @@ EXECUTE prepared_name execute_param_clause execute_rest ...@@ -7181,7 +7165,7 @@ EXECUTE prepared_name execute_param_clause execute_rest
CharacterWithLength: CharacterWithLength:
character '(' ecpg_iconst ')' opt_charset character '(' Iconst ')' opt_charset
{ {
$$ = cat_str(5,$1,make_str("("),$3,make_str(")"),$5); $$ = cat_str(5,$1,make_str("("),$3,make_str(")"),$5);
} }
...@@ -7247,7 +7231,7 @@ EXECUTE prepared_name execute_param_clause execute_rest ...@@ -7247,7 +7231,7 @@ EXECUTE prepared_name execute_param_clause execute_rest
ConstDatetime: ConstDatetime:
TIMESTAMP '(' ecpg_iconst ')' opt_timezone TIMESTAMP '(' Iconst ')' opt_timezone
{ {
$$ = cat_str(4,make_str("timestamp ("),$3,make_str(")"),$5); $$ = cat_str(4,make_str("timestamp ("),$3,make_str(")"),$5);
} }
...@@ -7255,7 +7239,7 @@ EXECUTE prepared_name execute_param_clause execute_rest ...@@ -7255,7 +7239,7 @@ EXECUTE prepared_name execute_param_clause execute_rest
{ {
$$ = cat_str(2,make_str("timestamp"),$2); $$ = cat_str(2,make_str("timestamp"),$2);
} }
| TIME '(' ecpg_iconst ')' opt_timezone | TIME '(' Iconst ')' opt_timezone
{ {
$$ = cat_str(4,make_str("time ("),$3,make_str(")"),$5); $$ = cat_str(4,make_str("time ("),$3,make_str(")"),$5);
} }
...@@ -7353,7 +7337,7 @@ EXECUTE prepared_name execute_param_clause execute_rest ...@@ -7353,7 +7337,7 @@ EXECUTE prepared_name execute_param_clause execute_rest
{ {
$$ = make_str("second"); $$ = make_str("second");
} }
| SECOND_P '(' ecpg_iconst ')' | SECOND_P '(' Iconst ')'
{ {
$$ = cat_str(3,make_str("second ("),$3,make_str(")")); $$ = cat_str(3,make_str("second ("),$3,make_str(")"));
} }
...@@ -7774,7 +7758,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\ ...@@ -7774,7 +7758,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\
{ {
$$ = make_str("current_time"); $$ = make_str("current_time");
} }
| CURRENT_TIME '(' ecpg_iconst ')' | CURRENT_TIME '(' Iconst ')'
{ {
$$ = cat_str(3,make_str("current_time ("),$3,make_str(")")); $$ = cat_str(3,make_str("current_time ("),$3,make_str(")"));
} }
...@@ -7782,7 +7766,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\ ...@@ -7782,7 +7766,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\
{ {
$$ = make_str("current_timestamp"); $$ = make_str("current_timestamp");
} }
| CURRENT_TIMESTAMP '(' ecpg_iconst ')' | CURRENT_TIMESTAMP '(' Iconst ')'
{ {
$$ = cat_str(3,make_str("current_timestamp ("),$3,make_str(")")); $$ = cat_str(3,make_str("current_timestamp ("),$3,make_str(")"));
} }
...@@ -7790,7 +7774,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\ ...@@ -7790,7 +7774,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\
{ {
$$ = make_str("localtime"); $$ = make_str("localtime");
} }
| LOCALTIME '(' ecpg_iconst ')' | LOCALTIME '(' Iconst ')'
{ {
$$ = cat_str(3,make_str("localtime ("),$3,make_str(")")); $$ = cat_str(3,make_str("localtime ("),$3,make_str(")"));
} }
...@@ -7798,7 +7782,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\ ...@@ -7798,7 +7782,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\
{ {
$$ = make_str("localtimestamp"); $$ = make_str("localtimestamp");
} }
| LOCALTIMESTAMP '(' ecpg_iconst ')' | LOCALTIMESTAMP '(' Iconst ')'
{ {
$$ = cat_str(3,make_str("localtimestamp ("),$3,make_str(")")); $$ = cat_str(3,make_str("localtimestamp ("),$3,make_str(")"));
} }
...@@ -8645,7 +8629,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\ ...@@ -8645,7 +8629,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\
AexprConst: AexprConst:
ecpg_iconst Iconst
{ {
$$ = $1; $$ = $1;
} }
...@@ -8653,7 +8637,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\ ...@@ -8653,7 +8637,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\
{ {
$$ = $1; $$ = $1;
} }
| ecpg_real_sconst | ecpg_sconst
{ {
$$ = $1; $$ = $1;
} }
...@@ -8681,7 +8665,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\ ...@@ -8681,7 +8665,7 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\
{ {
$$ = cat_str(3,$1,$2,$3); $$ = cat_str(3,$1,$2,$3);
} }
| ConstInterval '(' ecpg_iconst ')' ecpg_sconst opt_interval | ConstInterval '(' Iconst ')' ecpg_sconst opt_interval
{ {
$$ = cat_str(6,$1,make_str("("),$3,make_str(")"),$5,$6); $$ = cat_str(6,$1,make_str("("),$3,make_str(")"),$5,$6);
} }
...@@ -8697,10 +8681,17 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\ ...@@ -8697,10 +8681,17 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\
{ {
$$ = make_str("null"); $$ = make_str("null");
} }
| civar { $$ = $1; }
| civarind { $$ = $1; } | civarind { $$ = $1; }
; ;
Iconst:
ICONST
{ $$ = make_name(); }
;
RoleId: RoleId:
ColId ColId
{ {
...@@ -8710,12 +8701,19 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\ ...@@ -8710,12 +8701,19 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\
SignedIconst: SignedIconst:
ecpg_iconst Iconst
{ {
$$ = $1; $$ = $1;
} }
| '+' ecpg_real_iconst { $$ = cat_str(2, make_str("+"), $2); } | civar { $$ = $1; }
| '-' ecpg_real_iconst { $$ = cat_str(2, make_str("-"), $2); } | '+' Iconst
{
$$ = cat_str(2,make_str("+"),$2);
}
| '-' Iconst
{
$$ = cat_str(2,make_str("-"),$2);
}
; ;
...@@ -9442,11 +9440,11 @@ connection_target: opt_database_name opt_server opt_port ...@@ -9442,11 +9440,11 @@ connection_target: opt_database_name opt_server opt_port
{ {
$$ = $1; $$ = $1;
} }
| ecpg_real_sconst | ecpg_sconst
{ {
/* We can only process double quoted strings not single quotes ones, /* We can only process double quoted strings not single quotes ones,
* so we change the quotes. * so we change the quotes.
* Note, that the rule for ecpg_real_sconst adds these single quotes. */ * Note, that the rule for ecpg_sconst adds these single quotes. */
$1[0] = '\"'; $1[0] = '\"';
$1[strlen($1)-1] = '\"'; $1[strlen($1)-1] = '\"';
$$ = $1; $$ = $1;
...@@ -9487,7 +9485,7 @@ server_name: ColId { $$ = $1; } ...@@ -9487,7 +9485,7 @@ server_name: ColId { $$ = $1; }
| IP { $$ = make_name(); } | IP { $$ = make_name(); }
; ;
opt_port: ':' ecpg_iconst { $$ = make2_str(make_str(":"), $2); } opt_port: ':' Iconst { $$ = make2_str(make_str(":"), $2); }
| /*EMPTY*/ { $$ = EMPTY; } | /*EMPTY*/ { $$ = EMPTY; }
; ;
...@@ -9520,22 +9518,22 @@ user_name: RoleId ...@@ -9520,22 +9518,22 @@ user_name: RoleId
{ {
if ($1[0] == '\"') if ($1[0] == '\"')
$$ = $1; $$ = $1;
else if ($1[1] == '$') /* variable */ else
{ $$ = make3_str(make_str("\""), $1, make_str("\""));
enum ECPGttype type = argsinsert->variable->type->type; }
| civar
{
enum ECPGttype type = argsinsert->variable->type->type;
/* if array see what's inside */ /* if array see what's inside */
if (type == ECPGt_array) if (type == ECPGt_array)
type = argsinsert->variable->type->u.element->type; type = argsinsert->variable->type->u.element->type;
/* handle varchars */ /* handle varchars */
if (type == ECPGt_varchar) if (type == ECPGt_varchar)
$$ = make2_str(mm_strdup(argsinsert->variable->name), make_str(".arr")); $$ = make2_str(mm_strdup(argsinsert->variable->name), make_str(".arr"));
else
$$ = mm_strdup(argsinsert->variable->name);
}
else else
$$ = make3_str(make_str("\""), $1, make_str("\"")); $$ = mm_strdup(argsinsert->variable->name);
} }
; ;
...@@ -9601,10 +9599,12 @@ connect_options: ColId opt_opt_value ...@@ -9601,10 +9599,12 @@ connect_options: ColId opt_opt_value
opt_opt_value: /*EMPTY*/ opt_opt_value: /*EMPTY*/
{ $$ = EMPTY; } { $$ = EMPTY; }
| '=' ecpg_iconst | '=' Iconst
{ $$ = make2_str(make_str("="), $2); } { $$ = make2_str(make_str("="), $2); }
| '=' ecpg_ident | '=' ecpg_ident
{ $$ = make2_str(make_str("="), $2); } { $$ = make2_str(make_str("="), $2); }
| '=' civar
{ $$ = make2_str(make_str("="), $2); }
; ;
prepared_name: name { prepared_name: name {
...@@ -9773,7 +9773,7 @@ var_declaration: storage_declaration ...@@ -9773,7 +9773,7 @@ var_declaration: storage_declaration
} }
; ;
opt_bit_field: ':' ecpg_iconst { $$ =cat2_str(make_str(":"), $2); } opt_bit_field: ':' Iconst { $$ =cat2_str(make_str(":"), $2); }
| /* EMPTY */ { $$ = EMPTY; } | /* EMPTY */ { $$ = EMPTY; }
; ;
...@@ -10326,9 +10326,9 @@ UsingValue: UsingConst ...@@ -10326,9 +10326,9 @@ UsingValue: UsingConst
| civarind { $$ = EMPTY; } | civarind { $$ = EMPTY; }
; ;
UsingConst: ecpg_real_iconst { $$ = $1; } UsingConst: Iconst { $$ = $1; }
| ecpg_fconst { $$ = $1; } | ecpg_fconst { $$ = $1; }
| ecpg_real_sconst { $$ = $1; } | ecpg_sconst { $$ = $1; }
| ecpg_bconst { $$ = $1; } | ecpg_bconst { $$ = $1; }
| ecpg_xconst { $$ = $1; } | ecpg_xconst { $$ = $1; }
; ;
...@@ -10421,7 +10421,7 @@ ECPGSetDescHeaderItem: desc_header_item '=' IntConstVar ...@@ -10421,7 +10421,7 @@ ECPGSetDescHeaderItem: desc_header_item '=' IntConstVar
} }
; ;
IntConstVar: ecpg_real_iconst IntConstVar: Iconst
{ {
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3); char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
...@@ -10482,7 +10482,7 @@ AllConstVar: ecpg_fconst ...@@ -10482,7 +10482,7 @@ AllConstVar: ecpg_fconst
new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0); new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
$$ = var; $$ = var;
} }
| '-' ecpg_real_iconst | '-' Iconst
{ {
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3); char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
char *var = cat2_str(make_str("-"), $2); char *var = cat2_str(make_str("-"), $2);
...@@ -10491,7 +10491,7 @@ AllConstVar: ecpg_fconst ...@@ -10491,7 +10491,7 @@ AllConstVar: ecpg_fconst
new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0); new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
$$ = var; $$ = var;
} }
| ecpg_real_sconst | ecpg_sconst
{ {
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3); char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
char *var = $1 + 1; char *var = $1 + 1;
...@@ -11157,14 +11157,7 @@ ecpg_bconst: BCONST { $$ = make_name(); } ; ...@@ -11157,14 +11157,7 @@ ecpg_bconst: BCONST { $$ = make_name(); } ;
ecpg_fconst: FCONST { $$ = make_name(); } ; ecpg_fconst: FCONST { $$ = make_name(); } ;
ecpg_real_iconst: ecpg_sconst:
ICONST { $$ = make_name(); } ;
ecpg_iconst: ecpg_real_iconst { $$ = $1; }
| civar { $$ = $1; }
;
ecpg_real_sconst:
SCONST SCONST
{ {
/* could have been input as '' or $$ */ /* could have been input as '' or $$ */
...@@ -11199,10 +11192,6 @@ ecpg_real_sconst: ...@@ -11199,10 +11192,6 @@ ecpg_real_sconst:
| DOLCONST { $$ = $1; } | DOLCONST { $$ = $1; }
; ;
ecpg_sconst: ecpg_real_sconst { $$ = $1; }
| civar { $$ = $1; }
;
ecpg_xconst: XCONST { $$ = make_name(); } ; ecpg_xconst: XCONST { $$ = make_name(); } ;
ecpg_ident: IDENT { $$ = make_name(); } ecpg_ident: IDENT { $$ = make_name(); }
...@@ -11210,10 +11199,6 @@ ecpg_ident: IDENT { $$ = make_name(); } ...@@ -11210,10 +11199,6 @@ ecpg_ident: IDENT { $$ = make_name(); }
| UIDENT { $$ = $1; } | UIDENT { $$ = $1; }
; ;
ColId_or_real_sconst: ColId { $$ = $1; }
| ecpg_real_sconst { $$ = $1; }
;
quoted_ident_stringvar: name quoted_ident_stringvar: name
{ $$ = make3_str(make_str("\""), $1, make_str("\"")); } { $$ = make3_str(make_str("\""), $1, make_str("\"")); }
| char_variable | char_variable
...@@ -11251,9 +11236,9 @@ c_thing: c_anything { $$ = $1; } ...@@ -11251,9 +11236,9 @@ c_thing: c_anything { $$ = $1; }
; ;
c_anything: ecpg_ident { $$ = $1; } c_anything: ecpg_ident { $$ = $1; }
| ecpg_real_iconst { $$ = $1; } | Iconst { $$ = $1; }
| ecpg_fconst { $$ = $1; } | ecpg_fconst { $$ = $1; }
| ecpg_real_sconst { $$ = $1; } | ecpg_sconst { $$ = $1; }
| '*' { $$ = make_str("*"); } | '*' { $$ = make_str("*"); }
| '+' { $$ = make_str("+"); } | '+' { $$ = make_str("+"); }
| '-' { $$ = make_str("-"); } | '-' { $$ = make_str("-"); }
...@@ -11314,14 +11299,14 @@ DeallocateStmt: DEALLOCATE prepared_name { $$ = $2; } ...@@ -11314,14 +11299,14 @@ DeallocateStmt: DEALLOCATE prepared_name { $$ = $2; }
| DEALLOCATE PREPARE ALL { $$ = make_str("all"); } | DEALLOCATE PREPARE ALL { $$ = make_str("all"); }
; ;
Iresult: ecpg_iconst { $$ = $1; } Iresult: Iconst { $$ = $1; }
| '(' Iresult ')' { $$ = cat_str(3, make_str("("), $2, make_str(")")); } | '(' Iresult ')' { $$ = cat_str(3, make_str("("), $2, make_str(")")); }
| Iresult '+' Iresult { $$ = cat_str(3, $1, make_str("+"), $3); } | Iresult '+' Iresult { $$ = cat_str(3, $1, make_str("+"), $3); }
| Iresult '-' Iresult { $$ = cat_str(3, $1, make_str("-"), $3); } | Iresult '-' Iresult { $$ = cat_str(3, $1, make_str("-"), $3); }
| Iresult '*' Iresult { $$ = cat_str(3, $1, make_str("*"), $3); } | Iresult '*' Iresult { $$ = cat_str(3, $1, make_str("*"), $3); }
| Iresult '/' Iresult { $$ = cat_str(3, $1, make_str("/"), $3); } | Iresult '/' Iresult { $$ = cat_str(3, $1, make_str("/"), $3); }
| Iresult '%' Iresult { $$ = cat_str(3, $1, make_str("%"), $3); } | Iresult '%' Iresult { $$ = cat_str(3, $1, make_str("%"), $3); }
| ecpg_real_sconst { $$ = $1; } | ecpg_sconst { $$ = $1; }
| ColId { $$ = $1; } | ColId { $$ = $1; }
; ;
......
...@@ -26,10 +26,10 @@ main(void) ...@@ -26,10 +26,10 @@ main(void)
#line 16 "test1.pgc" #line 16 "test1.pgc"
char db [ 200 ] ; char db [ 200 ] ;
#line 17 "test1.pgc" #line 17 "test1.pgc"
char pw [ 200 ] ; char pw [ 200 ] ;
/* exec sql end declare section */ /* exec sql end declare section */
#line 18 "test1.pgc" #line 18 "test1.pgc"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT> [NO_PID]: ECPGconnect: opening database connectdb on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 23: query: alter user connectuser encrypted password 'connectpw'; with 0 parameter(s) on connection main [NO_PID]: ecpg_execute on line 23: query: alter user connectuser encrypted password 'connectpw'; with 0 parameter(s) on connection main
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 23: using PQexec [NO_PID]: ecpg_execute on line 23: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
......
...@@ -98,62 +98,52 @@ struct sqlca_t *ECPGget_sqlca(void); ...@@ -98,62 +98,52 @@ struct sqlca_t *ECPGget_sqlca(void);
int int
main () main ()
{ {
/*
EXEC SQL BEGIN DECLARE SECTION;
char *fname = "/tmp/foo";
EXEC SQL END DECLARE SECTION;
*/
ECPGdebug (1, stderr); ECPGdebug (1, stderr);
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0);
#line 19 "copystdout.pgc" #line 13 "copystdout.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 19 "copystdout.pgc" #line 13 "copystdout.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table foo ( a int , b varchar ) ", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table foo ( a int , b varchar ) ", ECPGt_EOIT, ECPGt_EORT);
#line 20 "copystdout.pgc" #line 14 "copystdout.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 20 "copystdout.pgc" #line 14 "copystdout.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into foo values ( 5 , 'abc' ) ", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into foo values ( 5 , 'abc' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 21 "copystdout.pgc" #line 15 "copystdout.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 21 "copystdout.pgc" #line 15 "copystdout.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into foo values ( 6 , 'def' ) ", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into foo values ( 6 , 'def' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 22 "copystdout.pgc" #line 16 "copystdout.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 22 "copystdout.pgc" #line 16 "copystdout.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into foo values ( 7 , 'ghi' ) ", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into foo values ( 7 , 'ghi' ) ", ECPGt_EOIT, ECPGt_EORT);
#line 23 "copystdout.pgc" #line 17 "copystdout.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 23 "copystdout.pgc" #line 17 "copystdout.pgc"
/* produces expected file "/tmp/foo" */
/* EXEC SQL COPY foo TO:fname WITH DELIMITER ','; */
/* printf ("copy to /tmp/foo : sqlca.sqlcode = %ld", sqlca.sqlcode); */
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "copy foo to stdout with delimiter ','", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "copy foo to stdout with delimiter ','", ECPGt_EOIT, ECPGt_EORT);
#line 29 "copystdout.pgc" #line 19 "copystdout.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 29 "copystdout.pgc" #line 19 "copystdout.pgc"
printf ("copy to STDOUT : sqlca.sqlcode = %ld\n", sqlca.sqlcode); printf ("copy to STDOUT : sqlca.sqlcode = %ld\n", sqlca.sqlcode);
{ ECPGdisconnect(__LINE__, "CURRENT"); { ECPGdisconnect(__LINE__, "CURRENT");
#line 32 "copystdout.pgc" #line 22 "copystdout.pgc"
if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();}
#line 32 "copystdout.pgc" #line 22 "copystdout.pgc"
return 0; return 0;
......
...@@ -2,37 +2,37 @@ ...@@ -2,37 +2,37 @@
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT> [NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 20: query: create table foo ( a int , b varchar ) ; with 0 parameter(s) on connection regress1 [NO_PID]: ecpg_execute on line 14: query: create table foo ( a int , b varchar ) ; with 0 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 20: using PQexec [NO_PID]: ecpg_execute on line 14: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 20: OK: CREATE TABLE [NO_PID]: ecpg_execute on line 14: OK: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 21: query: insert into foo values ( 5 , 'abc' ) ; with 0 parameter(s) on connection regress1 [NO_PID]: ecpg_execute on line 15: query: insert into foo values ( 5 , 'abc' ) ; with 0 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 21: using PQexec [NO_PID]: ecpg_execute on line 15: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 21: OK: INSERT 0 1 [NO_PID]: ecpg_execute on line 15: OK: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 22: query: insert into foo values ( 6 , 'def' ) ; with 0 parameter(s) on connection regress1 [NO_PID]: ecpg_execute on line 16: query: insert into foo values ( 6 , 'def' ) ; with 0 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 22: using PQexec [NO_PID]: ecpg_execute on line 16: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 22: OK: INSERT 0 1 [NO_PID]: ecpg_execute on line 16: OK: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 23: query: insert into foo values ( 7 , 'ghi' ) ; with 0 parameter(s) on connection regress1 [NO_PID]: ecpg_execute on line 17: query: insert into foo values ( 7 , 'ghi' ) ; with 0 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 23: using PQexec [NO_PID]: ecpg_execute on line 17: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 23: OK: INSERT 0 1 [NO_PID]: ecpg_execute on line 17: OK: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 29: query: copy foo to stdout with delimiter ','; with 0 parameter(s) on connection regress1 [NO_PID]: ecpg_execute on line 19: query: copy foo to stdout with delimiter ','; with 0 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 29: using PQexec [NO_PID]: ecpg_execute on line 19: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 29: COPY OUT data transfer in progress [NO_PID]: ecpg_execute on line 19: COPY OUT data transfer in progress
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 29: got PGRES_COMMAND_OK after PGRES_COPY_OUT [NO_PID]: ecpg_execute on line 19: got PGRES_COMMAND_OK after PGRES_COPY_OUT
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection regress1 closed [NO_PID]: ecpg_finish: connection regress1 closed
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
...@@ -8,12 +8,6 @@ EXEC SQL WHENEVER SQLERROR sqlprint; ...@@ -8,12 +8,6 @@ EXEC SQL WHENEVER SQLERROR sqlprint;
int int
main () main ()
{ {
/*
EXEC SQL BEGIN DECLARE SECTION;
char *fname = "/tmp/foo";
EXEC SQL END DECLARE SECTION;
*/
ECPGdebug (1, stderr); ECPGdebug (1, stderr);
EXEC SQL CONNECT TO REGRESSDB1; EXEC SQL CONNECT TO REGRESSDB1;
...@@ -22,10 +16,6 @@ main () ...@@ -22,10 +16,6 @@ main ()
EXEC SQL INSERT INTO foo VALUES (6, 'def'); EXEC SQL INSERT INTO foo VALUES (6, 'def');
EXEC SQL INSERT INTO foo VALUES (7, 'ghi'); EXEC SQL INSERT INTO foo VALUES (7, 'ghi');
/* produces expected file "/tmp/foo" */
/* EXEC SQL COPY foo TO:fname WITH DELIMITER ','; */
/* printf ("copy to /tmp/foo : sqlca.sqlcode = %ld", sqlca.sqlcode); */
EXEC SQL COPY foo TO STDOUT WITH DELIMITER ','; EXEC SQL COPY foo TO STDOUT WITH DELIMITER ',';
printf ("copy to STDOUT : sqlca.sqlcode = %ld\n", sqlca.sqlcode); printf ("copy to STDOUT : sqlca.sqlcode = %ld\n", sqlca.sqlcode);
......
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