Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
6fb3c3f7
Commit
6fb3c3f7
authored
Oct 15, 1999
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
06d95d94
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99 additions
and
55 deletions
+99
-55
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+11
-0
src/interfaces/ecpg/TODO
src/interfaces/ecpg/TODO
+6
-1
src/interfaces/ecpg/preproc/Makefile
src/interfaces/ecpg/preproc/Makefile
+1
-1
src/interfaces/ecpg/preproc/keywords.c
src/interfaces/ecpg/preproc/keywords.c
+2
-1
src/interfaces/ecpg/preproc/pgc.l
src/interfaces/ecpg/preproc/pgc.l
+21
-11
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/preproc/preproc.y
+58
-41
No files found.
src/interfaces/ecpg/ChangeLog
View file @
6fb3c3f7
...
...
@@ -674,3 +674,14 @@ Thu Oct 7 15:12:58 CEST 1999
- Set ecpg version to 2.6.6
- Set library version to 3.0.4
Tue Oct 12 07:26:50 CEST 1999
- Simplified C part of parser.
Fri Oct 15 17:05:25 CEST 1999
- Synced preproc.y with gram.y.
- Synced pgc.l with scan.l.
- Synced keyword.c.
- Finished C parser changes, so initializers are correctly parsed.
- Set ecpg version to 2.6.7
src/interfaces/ecpg/TODO
View file @
6fb3c3f7
...
...
@@ -13,8 +13,13 @@ support for dynamic SQL with unknown number of variables with DESCRIPTORS
The line numbering is not exact.
What happens to the output variable during read if there was an
indicator-error?
Add a semantic check level, e.g. check if a table really exists.
Missing statements:
- exec s
lq
ifdef
- exec s
ql
ifdef
- exec sql allocate
- exec sql deallocate
- SQLSTATE
src/interfaces/ecpg/preproc/Makefile
View file @
6fb3c3f7
...
...
@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
MAJOR_VERSION
=
2
MINOR_VERSION
=
6
PATCHLEVEL
=
6
PATCHLEVEL
=
7
CFLAGS
+=
-I
../include
-DMAJOR_VERSION
=
$(MAJOR_VERSION)
\
-DMINOR_VERSION
=
$(MINOR_VERSION)
-DPATCHLEVEL
=
$(PATCHLEVEL)
\
...
...
src/interfaces/ecpg/preproc/keywords.c
View file @
6fb3c3f7
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.1
8 1999/10/08 11:05:02
meskes Exp $
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.1
9 1999/10/15 19:02:08
meskes Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -61,6 +61,7 @@ static ScanKeyword ScanKeywords[] = {
{
"coalesce"
,
COALESCE
},
{
"collate"
,
COLLATE
},
{
"column"
,
COLUMN
},
{
"comment"
,
COMMENT
},
{
"commit"
,
COMMIT
},
{
"committed"
,
COMMITTED
},
{
"constraint"
,
CONSTRAINT
},
...
...
src/interfaces/ecpg/preproc/pgc.l
View file @
6fb3c3f7
/* This is a modified version of src/backend/parser/scan.l */
%{
#include <ctype.h>
...
...
@@ -90,6 +91,10 @@ xhstop {quote}
xhinside [^']*
xhcat {quote}{space}*\n{space}*{quote}
/* C version of hex number
*/
xch 0[xX][0-9A-Fa-f]*
/* Extended quote
* xqdouble implements SQL92 embedded quote
* xqcat allows strings to cross input lines
...
...
@@ -150,10 +155,10 @@ real (((({digit}*\.{digit}+)|({digit}+\.{digit}*))([Ee][-+]?{digit}+)?)|({digi
param \${integer}
comment ("--"|"//").*
\n
comment ("--"|"//").*
ccomment "//".*\n
space [ \t\n\f]
space [ \t\n\
r\
f]
other .
/* some stuff needed for ecpg */
...
...
@@ -242,7 +247,6 @@ cppline {space}*#.*(\\{space}*\n)*\n*
}
<xq>{xqstop} {
BEGIN(SQL);
/* yylval.str = mm_strdup(scanstr(literal));*/
yylval.str = mm_strdup(literal);
return SCONST;
}
...
...
@@ -319,13 +323,6 @@ cppline {space}*#.*(\\{space}*\n)*\n*
if (*endptr != '\0' || errno == ERANGE)
{
errno = 0;
#if 0
yylval.dval = strtod(((char *)yytext),&endptr);
if (*endptr != '\0' || errno == ERANGE)
yyerror("ERROR: Bad integer input");
yyerror("WARNING: Integer input is out of range; promoted to float");
return FCONST;
#endif
yylval.str = mm_strdup((char*)yytext);
return SCONST;
}
...
...
@@ -414,6 +411,19 @@ cppline {space}*#.*(\\{space}*\n)*\n*
<SQL>{other} { return yytext[0]; }
<C>{exec}{space}*{sql} { BEGIN SQL; return SQL_START; }
<C>{ccomment} { /* ignore */ }
<C>{xch} {
char* endptr;
errno = 0;
yylval.ival = strtol((char *)yytext,&endptr,16);
if (*endptr != '\0' || errno == ERANGE)
{
errno = 0;
yylval.str = mm_strdup((char*)yytext);
return SCONST;
}
return ICONST;
}
<C>{cppline} {
yylval.str = mm_strdup((char*)yytext);
return(CPP_LINE);
...
...
@@ -470,7 +480,7 @@ cppline {space}*#.*(\\{space}*\n)*\n*
<C>\[ { return('['); }
<C>\] { return(']'); }
<C>\= { return('='); }
<C>{other}
{ return S_ANYTHING; }
<C>{other} { return S_ANYTHING; }
<C>{exec}{space}{sql}{space}{define} {BEGIN(def_ident);}
<def_ident>{space} {}
<def_ident>{identifier} {
...
...
src/interfaces/ecpg/preproc/preproc.y
View file @
6fb3c3f7
...
...
@@ -724,7 +724,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
*/
%token ABORT_TRANS, ACCESS, AFTER, AGGREGATE, ANALYZE,
BACKWARD, BEFORE, BINARY,
CACHE, CLUSTER, COPY, CREATEDB, CREATEUSER, CYCLE,
CACHE, CLUSTER, CO
MMENT, CO
PY, CREATEDB, CREATEUSER, CYCLE,
DATABASE, DELIMITERS, DO,
EACH, ENCODING, EXCLUSIVE, EXPLAIN, EXTEND,
FORWARD, FUNCTION, HANDLER,
...
...
@@ -785,7 +785,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
%type <str> update_target_el opt_id relation_name database_name
%type <str> access_method attr_name class index_name name func_name
%type <str> file_name AexprConst ParamNo TypeId
%type <str> in_expr_nodes a_expr b_expr TruncateStmt
%type <str> in_expr_nodes a_expr b_expr TruncateStmt
CommentStmt
%type <str> opt_indirection expr_list extract_list extract_arg
%type <str> position_list substr_list substr_from
%type <str> trim_list in_expr substr_for attr attrs
...
...
@@ -839,15 +839,15 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
%type <str> constraints_set_mode
%type <str> ECPGWhenever ECPGConnect connection_target ECPGOpen opt_using
%type <str> indicator ECPGExecute ecpg_expr
dotext
ECPGPrepare
%type <str> storage_clause opt_initializer
vartext
c_anything blockstart
%type <str> blockend variable_list variable
var_anything do_anything
%type <str> indicator ECPGExecute ecpg_expr ECPGPrepare
%type <str> storage_clause opt_initializer c_anything blockstart
%type <str> blockend variable_list variable
c_thing c_term
%type <str> opt_pointer cvariable ECPGDisconnect dis_name
%type <str> stmt symbol opt_symbol ECPGRelease execstring server_name
%type <str> connection_object opt_server opt_port c_
thing
opt_reference
%type <str> connection_object opt_server opt_port c_
stuff
opt_reference
%type <str> user_name opt_user char_variable ora_user ident
%type <str> db_prefix server opt_options opt_connection_name
%type <str> ECPGSetConnection c
_line cpp_line s_enum ECPGTypedef
%type <str> db_prefix server opt_options opt_connection_name
c_list
%type <str> ECPGSetConnection c
pp_line s_enum ECPGTypedef c_args
%type <str> enum_type civariableonly ECPGCursorStmt ECPGDeallocate
%type <str> ECPGFree ECPGDeclare ECPGVar sql_variable_declarations
%type <str> sql_declaration sql_variable_list sql_variable opt_at
...
...
@@ -882,6 +882,7 @@ opt_at: SQL_AT connection_target { connection = $2; }
stmt: AddAttrStmt { output_statement($1, 0); }
| AlterUserStmt { output_statement($1, 0); }
| ClosePortalStmt { output_statement($1, 0); }
| CommentStmt { output_statement($1, 0); }
| CopyStmt { output_statement($1, 0); }
| CreateStmt { output_statement($1, 0); }
| CreateAsStmt { output_statement($1, 0); }
...
...
@@ -1892,7 +1893,23 @@ opt_portal_name: IN name { $$ = cat2_str(make1_str("in"), $2); }
| /*EMPTY*/ { $$ = make1_str(""); }
;
/*****************************************************************************
*
* QUERY:
* comment on [ table <relname> | column <relname>.<attribu
* is 'text'
*
*****************************************************************************/
CommentStmt: COMMENT ON COLUMN relation_name '.' attr_name IS Sconst
{
cat2_str(cat5_str(make1_str("comment on column"), $4, make1_str(","), $6, make1_str("is")), $8);
}
| COMMENT ON TABLE relation_name IS Sconst
{
cat4_str(make1_str("comment on table"), $4, make1_str("is"), $6);
}
;
/*****************************************************************************
*
* QUERY:
...
...
@@ -4195,6 +4212,7 @@ ColId: ident { $$ = $1; }
| BACKWARD { $$ = make1_str("backward"); }
| BEFORE { $$ = make1_str("before"); }
| CACHE { $$ = make1_str("cache"); }
| COMMENT { $$ = make1_str("comment"); }
| COMMITTED { $$ = make1_str("committed"); }
| CONSTRAINTS { $$ = make1_str("constraints"); }
| CREATEDB { $$ = make1_str("createdb"); }
...
...
@@ -4265,6 +4283,7 @@ ColId: ident { $$ = $1; }
| TIMEZONE_HOUR { $$ = make1_str("timezone_hour"); }
| TIMEZONE_MINUTE { $$ = make1_str("timezone_minute"); }
| TRIGGER { $$ = make1_str("trigger"); }
| TRUNCATE { $$ = make1_str("truncate"); }
| TRUSTED { $$ = make1_str("trusted"); }
| TYPE_P { $$ = make1_str("type"); }
| VALID { $$ = make1_str("valid"); }
...
...
@@ -4673,8 +4692,7 @@ type: simple_type
{
$$.type_str = $1;
$$.type_enum = ECPGt_int;
$$.type_dimension = -1;
$$.type_dimension = -1;
$$.type_index = -1;
}
| symbol
...
...
@@ -4689,7 +4707,7 @@ type: simple_type
struct_member_list[struct_level] = ECPGstruct_member_dup(this->struct_member_list);
}
enum_type: s_enum '{' c_li
ne
'}'
enum_type: s_enum '{' c_li
st
'}'
{
$$ = cat4_str($1, make1_str("{"), $3, make1_str("}"));
}
...
...
@@ -4828,7 +4846,7 @@ variable: opt_pointer symbol opt_array_bounds opt_initializer
}
opt_initializer: /* empty */ { $$ = make1_str(""); }
| '='
vartext
{ $$ = make2_str(make1_str("="), $2); }
| '='
c_term
{ $$ = make2_str(make1_str("="), $2); }
opt_pointer: /* empty */ { $$ = make1_str(""); }
| '*' { $$ = make1_str("*"); }
...
...
@@ -5367,7 +5385,7 @@ action : SQL_CONTINUE {
$<action>$.command = strdup($3);
$<action>$.str = cat2_str(make1_str("goto "), $3);
}
| DO name '('
dotext
')' {
| DO name '('
c_args
')' {
$<action>$.code = W_DO;
$<action>$.command = make4_str($2, make1_str("("), $4, make1_str(")"));
$<action>$.str = cat2_str(make1_str("do"), mm_strdup($<action>$.command));
...
...
@@ -5377,7 +5395,7 @@ action : SQL_CONTINUE {
$<action>$.command = NULL;
$<action>$.str = make1_str("break");
}
| SQL_CALL name '('
dotext
')' {
| SQL_CALL name '('
c_args
')' {
$<action>$.code = W_DO;
$<action>$.command = make4_str($2, make1_str("("), $4, make1_str(")"));
$<action>$.str = cat2_str(make1_str("call"), mm_strdup($<action>$.command));
...
...
@@ -5726,11 +5744,8 @@ into_list : coutputvariable | into_list ',' coutputvariable;
ecpgstart: SQL_START { reset_variables();}
dotext: /* empty */ { $$ = make1_str(""); }
| dotext do_anything { $$ = make2_str($1, $2); }
vartext: var_anything { $$ = $1; }
| vartext var_anything { $$ = make2_str($1, $2); }
c_args: /* empty */ { $$ = make1_str(""); }
| c_list { $$ = $1; }
coutputvariable : cvariable indicator {
add_variable(&argsresult, find_variable($1), ($2 == NULL) ? &no_indicator : find_variable($2));
...
...
@@ -5754,6 +5769,7 @@ indicator: /* empty */ { $$ = NULL; }
ident: IDENT { $$ = $1; }
| CSTRING { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); };
/*
* C stuff
*/
...
...
@@ -5762,13 +5778,27 @@ symbol: IDENT { $$ = $1; }
cpp_line: CPP_LINE { $$ = $1; }
c_line: c_anything { $$ = $1; }
| c_line c_anything
{
$$ = make2_str($1, $2);
}
c_stuff: c_anything { $$ = $1; }
| c_stuff c_anything
{
$$ = cat2_str($1, $2);
}
| c_stuff '(' c_stuff ')'
{
$$ = cat4_str($1, make1_str("("), $3, make1_str(")"));
}
c_list: c_term { $$ = $1; }
| c_term ',' c_list { $$ = make3_str($1, make1_str(","), $3); }
c_term: c_stuff { $$ = $1; }
| '{' c_list '}' { $$ = make3_str(make1_str("{"), $2, make1_str("}")); }
c_thing: c_anything | ';' { $$ = make1_str(";"); }
c_thing: c_anything { $$ = $1; }
| '(' { $$ = make1_str("("); }
| ')' { $$ = make1_str(")"); }
| ',' { $$ = make1_str(","); }
| ';' { $$ = make1_str(";"); }
c_anything: IDENT { $$ = $1; }
| CSTRING { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
...
...
@@ -5800,22 +5830,9 @@ c_anything: IDENT { $$ = $1; }
| S_ANYTHING { $$ = make_name(); }
| '[' { $$ = make1_str("["); }
| ']' { $$ = make1_str("]"); }
| '(' { $$ = make1_str("("); }
| ')' { $$ = make1_str(")"); }
/*
| '(' { $$ = make1_str("("); }
| ')' { $$ = make1_str(")"); }
*/
| '=' { $$ = make1_str("="); }
| ',' { $$ = make1_str(","); }
do_anything: IDENT { $$ = $1; }
| CSTRING { $$ = make3_str(make1_str("\""), $1, make1_str("\""));}
| Iconst { $$ = $1; }
| Fconst { $$ = $1; }
| ',' { $$ = make1_str(","); }
var_anything: IDENT { $$ = $1; }
| CSTRING { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
| Iconst { $$ = $1; }
| Fconst { $$ = $1; }
| '{' c_line '}' { $$ = make3_str(make1_str("{"), $2, make1_str("}")); }
blockstart : '{' {
braces_open++;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment