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
33d71e30
Commit
33d71e30
authored
Jan 07, 2000
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
5633e22e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
95 additions
and
58 deletions
+95
-58
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+5
-0
src/interfaces/ecpg/preproc/Makefile
src/interfaces/ecpg/preproc/Makefile
+1
-1
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/preproc/preproc.y
+85
-53
src/interfaces/ecpg/test/test1.pgc
src/interfaces/ecpg/test/test1.pgc
+1
-1
src/interfaces/ecpg/test/test3.pgc
src/interfaces/ecpg/test/test3.pgc
+3
-3
No files found.
src/interfaces/ecpg/ChangeLog
View file @
33d71e30
...
@@ -755,3 +755,8 @@ Thu Dec 23 13:25:05 CET 1999
...
@@ -755,3 +755,8 @@ Thu Dec 23 13:25:05 CET 1999
- Fixed command line parsing.
- Fixed command line parsing.
- Set ecpg version to 2.6.13.
- Set ecpg version to 2.6.13.
Thu Jan 6 09:52:27 CET 2000
- Synced preproc.y with gram.y.
- Made sure Bruce's additions also make it into my source tree.
- Set ecpg version to 2.6.14.
src/interfaces/ecpg/preproc/Makefile
View file @
33d71e30
...
@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
...
@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
MAJOR_VERSION
=
2
MAJOR_VERSION
=
2
MINOR_VERSION
=
6
MINOR_VERSION
=
6
PATCHLEVEL
=
1
3
PATCHLEVEL
=
1
4
CFLAGS
+=
-I
../include
-DMAJOR_VERSION
=
$(MAJOR_VERSION)
\
CFLAGS
+=
-I
../include
-DMAJOR_VERSION
=
$(MAJOR_VERSION)
\
-DMINOR_VERSION
=
$(MINOR_VERSION)
-DPATCHLEVEL
=
$(PATCHLEVEL)
\
-DMINOR_VERSION
=
$(MINOR_VERSION)
-DPATCHLEVEL
=
$(PATCHLEVEL)
\
...
...
src/interfaces/ecpg/preproc/preproc.y
View file @
33d71e30
...
@@ -27,7 +27,6 @@ static char *connection = NULL;
...
@@ -27,7 +27,6 @@ static char *connection = NULL;
static int QueryIsRule = 0, ForUpdateNotAllowed = 0, FoundInto = 0;
static int QueryIsRule = 0, ForUpdateNotAllowed = 0, FoundInto = 0;
static struct this_type actual_type[STRUCT_DEPTH];
static struct this_type actual_type[STRUCT_DEPTH];
static char *actual_storage[STRUCT_DEPTH];
static char *actual_storage[STRUCT_DEPTH];
static char *actual_startline[STRUCT_DEPTH];
/* temporarily store struct members while creating the data structure */
/* temporarily store struct members while creating the data structure */
struct ECPGstruct_member *struct_member_list[STRUCT_DEPTH] = { NULL };
struct ECPGstruct_member *struct_member_list[STRUCT_DEPTH] = { NULL };
...
@@ -70,7 +69,7 @@ void
...
@@ -70,7 +69,7 @@ void
output_line_number()
output_line_number()
{
{
if (input_filename)
if (input_filename)
fprintf(yyout, "\n#line %d \"%s\"\n", yylineno, input_filename);
fprintf(yyout, "\n#line %d \"%s\"\n", yylineno
+ 1
, input_filename);
}
}
static void
static void
...
@@ -480,20 +479,6 @@ make_name(void)
...
@@ -480,20 +479,6 @@ make_name(void)
return(name);
return(name);
}
}
static char *
hashline_number()
{
if (input_filename)
{
char* line = mm_alloc(strlen("\n#line %d \"%s\"\n") + 21 + strlen(input_filename));
sprintf(line, "\n#line %d \"%s\"\n", yylineno, input_filename);
return line;
}
return EMPTY;
}
static void
static void
output_statement(char * stmt, int mode)
output_statement(char * stmt, int mode)
{
{
...
@@ -772,7 +757,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
...
@@ -772,7 +757,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
%type <str> columnList DeleteStmt LockStmt UpdateStmt CursorStmt
%type <str> columnList DeleteStmt LockStmt UpdateStmt CursorStmt
%type <str> NotifyStmt columnElem copy_dirn UnlistenStmt copy_null
%type <str> NotifyStmt columnElem copy_dirn UnlistenStmt copy_null
%type <str> copy_delimiter ListenStmt CopyStmt copy_file_name opt_binary
%type <str> copy_delimiter ListenStmt CopyStmt copy_file_name opt_binary
%type <str> opt_with_copy FetchStmt
direction fetch_how_many
portal_name
%type <str> opt_with_copy FetchStmt
opt_direction fetch_how_many opt_
portal_name
%type <str> ClosePortalStmt DropStmt VacuumStmt opt_verbose
%type <str> ClosePortalStmt DropStmt VacuumStmt opt_verbose
%type <str> opt_analyze opt_va_list va_list ExplainStmt index_params
%type <str> opt_analyze opt_va_list va_list ExplainStmt index_params
%type <str> index_list func_index index_elem opt_type opt_class access_method_clause
%type <str> index_list func_index index_elem opt_type opt_class access_method_clause
...
@@ -803,11 +788,12 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
...
@@ -803,11 +788,12 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
%type <str> select_offset_value table_list using_expr join_expr
%type <str> select_offset_value table_list using_expr join_expr
%type <str> using_list from_expr table_expr join_clause join_type
%type <str> using_list from_expr table_expr join_clause join_type
%type <str> join_qual update_list join_clause join_clause_with_union
%type <str> join_qual update_list join_clause join_clause_with_union
%type <str> opt_level opt_lock lock_type
,
%type <str> opt_level opt_lock lock_type
users_in_new_group_clause
%type <str> OptConstrFromTable comment_op ConstraintAttributeSpec
%type <str> OptConstrFromTable comment_op ConstraintAttributeSpec
%type <str> constraints_set_list constraints_set_namelist comment_fn
%type <str> constraints_set_list constraints_set_namelist comment_fn
%type <str> constraints_set_mode comment_type comment_cl comment_ag
%type <str> constraints_set_mode comment_type comment_cl comment_ag
%type <str> ConstraintDeferrabilitySpec ConstraintTimeSpec
%type <str> ConstraintDeferrabilitySpec ConstraintTimeSpec
%type <str> CreateGroupStmt, AlterGroupStmt, DropGroupStmt
%type <str> ECPGWhenever ECPGConnect connection_target ECPGOpen
%type <str> ECPGWhenever ECPGConnect connection_target ECPGOpen
%type <str> indicator ECPGExecute ECPGPrepare ecpg_using
%type <str> indicator ECPGExecute ECPGPrepare ecpg_using
...
@@ -822,7 +808,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
...
@@ -822,7 +808,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
%type <str> enum_type civariableonly ECPGCursorStmt ECPGDeallocate
%type <str> enum_type civariableonly ECPGCursorStmt ECPGDeallocate
%type <str> ECPGFree ECPGDeclare ECPGVar sql_variable_declarations
%type <str> ECPGFree ECPGDeclare ECPGVar sql_variable_declarations
%type <str> sql_declaration sql_variable_list sql_variable opt_at
%type <str> sql_declaration sql_variable_list sql_variable opt_at
%type <str> struct_type s_struct declaration
declarations
variable_declarations
%type <str> struct_type s_struct declaration variable_declarations
%type <str> s_struct s_union union_type ECPGSetAutocommit on_off
%type <str> s_struct s_union union_type ECPGSetAutocommit on_off
%type <type_enum> simple_type varchar_type
%type <type_enum> simple_type varchar_type
...
@@ -851,12 +837,14 @@ statement: ecpgstart opt_at stmt ';' { connection = NULL; }
...
@@ -851,12 +837,14 @@ statement: ecpgstart opt_at stmt ';' { connection = NULL; }
opt_at: SQL_AT connection_target { connection = $2; }
opt_at: SQL_AT connection_target { connection = $2; }
stmt: AddAttrStmt { output_statement($1, 0); }
stmt: AddAttrStmt { output_statement($1, 0); }
| AlterGroupStmt { output_statement($1, 0); }
| AlterUserStmt { output_statement($1, 0); }
| AlterUserStmt { output_statement($1, 0); }
| ClosePortalStmt { output_statement($1, 0); }
| ClosePortalStmt { output_statement($1, 0); }
| CommentStmt { output_statement($1, 0); }
| CommentStmt { output_statement($1, 0); }
| CopyStmt { output_statement($1, 0); }
| CopyStmt { output_statement($1, 0); }
| CreateStmt { output_statement($1, 0); }
| CreateStmt { output_statement($1, 0); }
| CreateAsStmt { output_statement($1, 0); }
| CreateAsStmt { output_statement($1, 0); }
| CreateGroupStmt { output_statement($1, 0); }
| CreateSeqStmt { output_statement($1, 0); }
| CreateSeqStmt { output_statement($1, 0); }
| CreatePLangStmt { output_statement($1, 0); }
| CreatePLangStmt { output_statement($1, 0); }
| CreateTrigStmt { output_statement($1, 0); }
| CreateTrigStmt { output_statement($1, 0); }
...
@@ -865,6 +853,7 @@ stmt: AddAttrStmt { output_statement($1, 0); }
...
@@ -865,6 +853,7 @@ stmt: AddAttrStmt { output_statement($1, 0); }
| DefineStmt { output_statement($1, 0); }
| DefineStmt { output_statement($1, 0); }
| DropStmt { output_statement($1, 0); }
| DropStmt { output_statement($1, 0); }
| TruncateStmt { output_statement($1, 0); }
| TruncateStmt { output_statement($1, 0); }
| DropGroupStmt { output_statement($1, 0); }
| DropPLangStmt { output_statement($1, 0); }
| DropPLangStmt { output_statement($1, 0); }
| DropTrigStmt { output_statement($1, 0); }
| DropTrigStmt { output_statement($1, 0); }
| DropUserStmt { output_statement($1, 0); }
| DropUserStmt { output_statement($1, 0); }
...
@@ -1111,10 +1100,6 @@ user_group_list: user_group_list ',' UserId
...
@@ -1111,10 +1100,6 @@ user_group_list: user_group_list ',' UserId
user_group_clause: IN GROUP user_group_list
user_group_clause: IN GROUP user_group_list
{
{
/* the backend doesn't actually process this,
* so an warning message is probably fairer */
mmerror(ET_WARN, "IN GROUP is not implemented");
$$ = cat2_str(make_str("in group"), $3);
$$ = cat2_str(make_str("in group"), $3);
}
}
| /*EMPTY*/ { $$ = EMPTY; }
| /*EMPTY*/ { $$ = EMPTY; }
...
@@ -1124,6 +1109,63 @@ user_valid_clause: VALID UNTIL Sconst { $$ = cat2_str(make_str("valid until")
...
@@ -1124,6 +1109,63 @@ user_valid_clause: VALID UNTIL Sconst { $$ = cat2_str(make_str("valid until")
| /*EMPTY*/ { $$ = EMPTY; }
| /*EMPTY*/ { $$ = EMPTY; }
;
;
/*****************************************************************************
*
* Create a postresql group
*
*
****************************************************************************/
CreateGroupStmt: CREATE GROUP UserId
{
$$ = cat2_str(make_str("create group"), $3);
}
| CREATE GROUP UserId WITH sysid_clause users_in_new_group_clause
{
$$ = cat_str(5, make_str("create group"), $3, make_str("with"), $5, $6);
}
;
users_in_new_group_clause: USER user_group_list { $$ = cat2_str(make_str("user"), $2); }
| /* EMPTY */ { $$ = EMPTY; }
;
/*****************************************************************************
*
* Alter a postresql group
*
*
*****************************************************************************/
AlterGroupStmt: ALTER GROUP UserId WITH SYSID Iconst
{
$$ = cat_str(4, make_str("alter group"), $3, make_str("with sysid"), $6);
}
|
ALTER GROUP UserId ADD USER user_group_list
{
$$ = cat_str(4, make_str("alter group"), $3, make_str("add user"), $6);
}
|
ALTER GROUP UserId DROP USER user_group_list
{
$$ = cat_str(4, make_str("alter group"), $3, make_str("drop user"), $6);
}
;
/*****************************************************************************
*
* Drop a postresql group
*
*
*****************************************************************************/
DropGroupStmt: DROP GROUP UserId
{
$$ = cat2_str(make_str("drop group"), $3);
}
;
/*****************************************************************************
/*****************************************************************************
*
*
* Set PG internal variable
* Set PG internal variable
...
@@ -1885,36 +1927,20 @@ TruncateStmt: TRUNCATE TABLE relation_name
...
@@ -1885,36 +1927,20 @@ TruncateStmt: TRUNCATE TABLE relation_name
*
*
*****************************************************************************/
*****************************************************************************/
FetchStmt: FETCH
direction fetch_how_many
portal_name INTO into_list
FetchStmt: FETCH
opt_direction fetch_how_many opt_
portal_name INTO into_list
{
{
if (strcmp($2, "relative") == 0 && atol($3) == 0L)
if (strcmp($2, "relative") == 0 && atol($3) == 0L)
mmerror(ET_ERROR, "FETCH/RELATIVE at current position is not supported");
mmerror(ET_ERROR, "FETCH/RELATIVE at current position is not supported");
$$ = cat_str(4, make_str("fetch"), $2, $3, $4);
$$ = cat_str(4, make_str("fetch"), $2, $3, $4);
}
}
| FETCH fetch_how_many portal_name INTO into_list
| MOVE opt_direction fetch_how_many opt_portal_name
{
$$ = cat_str(3, make_str("fetch"), $2, $3);
}
| FETCH portal_name INTO into_list
{
{
$$ = cat_str(2, make_str("fetch"), $2);
$$ = cat_str(4, make_str("fetch"), $2, $3, $4);
}
| MOVE direction fetch_how_many portal_name
{
$$ = cat_str(4, make_str("move"), $2, $3, $4);
}
| MOVE fetch_how_many portal_name
{
$$ = cat_str(3, make_str("move"), $2, $3);
}
| MOVE portal_name
{
$$ = cat_str(2, make_str("move"), $2);
}
}
;
;
direction: FORWARD { $$ = make_str("forward"); }
opt_
direction: FORWARD { $$ = make_str("forward"); }
| BACKWARD { $$ = make_str("backward"); }
| BACKWARD { $$ = make_str("backward"); }
| RELATIVE { $$ = make_str("relative"); }
| RELATIVE { $$ = make_str("relative"); }
| ABSOLUTE
| ABSOLUTE
...
@@ -1922,6 +1948,7 @@ direction: FORWARD { $$ = make_str("forward"); }
...
@@ -1922,6 +1948,7 @@ direction: FORWARD { $$ = make_str("forward"); }
mmerror(ET_WARN, "FETCH/ABSOLUTE not supported, backend will use RELATIVE");
mmerror(ET_WARN, "FETCH/ABSOLUTE not supported, backend will use RELATIVE");
$$ = make_str("absolute");
$$ = make_str("absolute");
}
}
| /*EMPTY*/ { $$ = EMPTY; /* default */ }
;
;
fetch_how_many: Iconst { $$ = $1; }
fetch_how_many: Iconst { $$ = $1; }
...
@@ -1929,11 +1956,13 @@ fetch_how_many: Iconst { $$ = $1; }
...
@@ -1929,11 +1956,13 @@ fetch_how_many: Iconst { $$ = $1; }
| ALL { $$ = make_str("all"); }
| ALL { $$ = make_str("all"); }
| NEXT { $$ = make_str("next"); }
| NEXT { $$ = make_str("next"); }
| PRIOR { $$ = make_str("prior"); }
| PRIOR { $$ = make_str("prior"); }
| /*EMPTY*/ { $$ = EMPTY; /*default*/ }
;
;
portal_name:
IN name { $$ = cat2_str(make_str("in"), $2); }
opt_portal_name:
IN name { $$ = cat2_str(make_str("in"), $2); }
| FROM name { $$ = cat2_str(make_str("from"), $2); }
| FROM name { $$ = cat2_str(make_str("from"), $2); }
| name { $$ = cat2_str(make_str("in"), $1); }
/* | name { $$ = cat2_str(make_str("in"), $1); }*/
| /*EMPTY*/ { $$ = EMPTY; }
;
;
/*****************************************************************************
/*****************************************************************************
...
@@ -4503,6 +4532,7 @@ ECPGDeallocate: SQL_DEALLOCATE SQL_PREPARE ident { $$ = cat_str(3, make_str("ECP
...
@@ -4503,6 +4532,7 @@ ECPGDeallocate: SQL_DEALLOCATE SQL_PREPARE ident { $$ = cat_str(3, make_str("ECP
ECPGDeclaration: sql_startdeclare
ECPGDeclaration: sql_startdeclare
{
{
fputs("/* exec sql begin declare section */", yyout);
fputs("/* exec sql begin declare section */", yyout);
output_line_number();
}
}
variable_declarations sql_enddeclare
variable_declarations sql_enddeclare
{
{
...
@@ -4515,16 +4545,18 @@ sql_startdeclare : ecpgstart BEGIN_TRANS DECLARE SQL_SECTION ';' {}
...
@@ -4515,16 +4545,18 @@ sql_startdeclare : ecpgstart BEGIN_TRANS DECLARE SQL_SECTION ';' {}
sql_enddeclare: ecpgstart END_TRANS DECLARE SQL_SECTION ';' {}
sql_enddeclare: ecpgstart END_TRANS DECLARE SQL_SECTION ';' {}
variable_declarations: /* empty */ { $$ = EMPTY; }
variable_declarations: /* empty */
| declarations { $$ = $1; }
{
$$ = EMPTY;
declarations: declaration { $$ = $1; }
}
| declarations declaration { $$ = cat2_str($1, $2); }
| declaration variable_declarations
{
$$ = cat2_str($1, $2);
}
declaration: storage_clause
declaration: storage_clause
{
{
actual_storage[struct_level] = mm_strdup($1);
actual_storage[struct_level] = mm_strdup($1);
actual_startline[struct_level] = hashline_number();
}
}
type
type
{
{
...
@@ -4534,7 +4566,7 @@ declaration: storage_clause
...
@@ -4534,7 +4566,7 @@ declaration: storage_clause
}
}
variable_list ';'
variable_list ';'
{
{
$$ = cat_str(
5, actual_startline[struct_level]
, $1, $3.type_str, $5, make_str(";\n"));
$$ = cat_str(
4
, $1, $3.type_str, $5, make_str(";\n"));
}
}
storage_clause : S_EXTERN { $$ = make_str("extern"); }
storage_clause : S_EXTERN { $$ = make_str("extern"); }
...
@@ -5441,7 +5473,7 @@ c_stuff: c_anything { $$ = $1; }
...
@@ -5441,7 +5473,7 @@ c_stuff: c_anything { $$ = $1; }
}
}
c_list: c_term { $$ = $1; }
c_list: c_term { $$ = $1; }
| c_
list ',' c_term
{ $$ = cat_str(3, $1, make_str(","), $3); }
| c_
term ',' c_list
{ $$ = cat_str(3, $1, make_str(","), $3); }
c_term: c_stuff { $$ = $1; }
c_term: c_stuff { $$ = $1; }
| '{' c_list '}' { $$ = cat_str(3, make_str("{"), $2, make_str("}")); }
| '{' c_list '}' { $$ = cat_str(3, make_str("{"), $2, make_str("}")); }
...
...
src/interfaces/ecpg/test/test1.pgc
View file @
33d71e30
...
@@ -82,7 +82,7 @@ exec sql end declare section;
...
@@ -82,7 +82,7 @@ exec sql end declare section;
for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, name[i], i, amount[i],i, letter[i][0]);
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, name[i], i, amount[i],i, letter[i][0]);
exec sql at pm select
name, amount, letter
into :name, :amount, :letter from "Test";
exec sql at pm select
*
into :name, :amount, :letter from "Test";
for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
for (i=0, j=sqlca.sqlerrd[2]; i<j; i++)
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, name[i], i, amount[i],i, letter[i][0]);
printf("name[%d]=%8.8s\tamount[%d]=%d\tletter[%d]=%c\n", i, name[i], i, amount[i],i, letter[i][0]);
...
...
src/interfaces/ecpg/test/test3.pgc
View file @
33d71e30
...
@@ -19,7 +19,7 @@ exec sql begin declare section;
...
@@ -19,7 +19,7 @@ exec sql begin declare section;
int ind_children;
int ind_children;
str *married = NULL;
str *married = NULL;
char *wifesname="Petra";
char *wifesname="Petra";
char *query="select
name, born, age, married, children
from meskes where name = :var1";
char *query="select
*
from meskes where name = :var1";
exec sql end declare section;
exec sql end declare section;
exec sql declare cur cursor for
exec sql declare cur cursor for
...
@@ -41,8 +41,8 @@ exec sql end declare section;
...
@@ -41,8 +41,8 @@ exec sql end declare section;
exec sql insert into meskes(name, married, children) values (:wifesname, '19900404', 3);
exec sql insert into meskes(name, married, children) values (:wifesname, '19900404', 3);
exec sql insert into meskes(name, born, age, married, children) values ('Michael', 19660117, 33, '19900404', 3);
exec sql insert into meskes(name, born, age, married, children) values ('Michael', 19660117, 33, '19900404', 3);
exec sql insert into meskes(name, born, age) values ('Carsten', 19910103, 8);
exec sql insert into meskes(name, born, age) values ('Carsten', 19910103, 8);
exec sql insert into meskes(name, born, age) values ('Marc', 19930907,
5
);
exec sql insert into meskes(name, born, age) values ('Marc', 19930907,
6
);
exec sql insert into meskes(name, born, age) values ('Chris', 19970923,
1
);
exec sql insert into meskes(name, born, age) values ('Chris', 19970923,
2
);
strcpy(msg, "commit");
strcpy(msg, "commit");
exec sql commit;
exec sql commit;
...
...
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