aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/preproc
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2000-03-07 15:11:03 +0000
committerMichael Meskes <meskes@postgresql.org>2000-03-07 15:11:03 +0000
commit5a197810c09da06a772c235a6bba68290745d74c (patch)
treedd0053c6d2c99e6f9dc980a350623b30f3ae9496 /src/interfaces/ecpg/preproc
parentad3db67e5311590d42b8c5fce2a8ee2116678923 (diff)
downloadpostgresql-5a197810c09da06a772c235a6bba68290745d74c.tar.gz
postgresql-5a197810c09da06a772c235a6bba68290745d74c.zip
*** empty log message ***
Diffstat (limited to 'src/interfaces/ecpg/preproc')
-rw-r--r--src/interfaces/ecpg/preproc/ecpg.c2
-rw-r--r--src/interfaces/ecpg/preproc/extern.h2
-rw-r--r--src/interfaces/ecpg/preproc/output.c8
-rw-r--r--src/interfaces/ecpg/preproc/preproc.y104
-rw-r--r--src/interfaces/ecpg/preproc/variable.c1
5 files changed, 59 insertions, 58 deletions
diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c
index 1c14fbbc0c2..ceb06fb744e 100644
--- a/src/interfaces/ecpg/preproc/ecpg.c
+++ b/src/interfaces/ecpg/preproc/ecpg.c
@@ -249,7 +249,7 @@ main(int argc, char *const argv[])
lex_init();
/* we need two includes */
- fprintf(yyout, "/* Processed by ecpg (%d.%d.%d) */\n/* These two include files are added by the preprocessor */\n#include <ecpgtype.h>\n#include <ecpglib.h>\n#line 1 \"%s\"\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL, input_filename);
+ fprintf(yyout, "/* Processed by ecpg (%d.%d.%d) */\n/* These three include files are added by the preprocessor */\n#include <ecpgtype.h>\n#include <ecpglib.h>\n#include <ecpgerrno.h>\n#line 1 \"%s\"\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL, input_filename);
/* and parse the source */
yyparse();
diff --git a/src/interfaces/ecpg/preproc/extern.h b/src/interfaces/ecpg/preproc/extern.h
index 1134e42c7ee..f79c3b43a0c 100644
--- a/src/interfaces/ecpg/preproc/extern.h
+++ b/src/interfaces/ecpg/preproc/extern.h
@@ -39,7 +39,7 @@ extern const char *get_dtype(enum ECPGdtype);
extern void lex_init(void);
extern char *make_str(const char *);
extern void output_line_number(void);
-extern void output_statement(char *, int, char *, char *, struct arguments *, struct arguments *);
+extern void output_statement(char *, int, char *, char *);
extern void output_simple_statement(char *);
extern char *hashline_number(void);
extern int yyparse(void);
diff --git a/src/interfaces/ecpg/preproc/output.c b/src/interfaces/ecpg/preproc/output.c
index d67f9eae5af..760751affd3 100644
--- a/src/interfaces/ecpg/preproc/output.c
+++ b/src/interfaces/ecpg/preproc/output.c
@@ -94,8 +94,7 @@ hashline_number(void)
}
void
-output_statement(char * stmt, int mode, char *descriptor,
- char *con, struct arguments *insert, struct arguments *result)
+output_statement(char * stmt, int mode, char *descriptor, char *con)
{
int i, j = strlen(stmt);
@@ -118,10 +117,11 @@ output_statement(char * stmt, int mode, char *descriptor,
fputs("\", ", yyout);
/* dump variables to C file */
- dump_variables(insert, 1);
+ dump_variables(argsinsert, 1);
fputs("ECPGt_EOIT, ", yyout);
- dump_variables(result, 1);
+ dump_variables(argsresult, 1);
fputs("ECPGt_EORT);", yyout);
+ reset_variables();
}
else
fputs("\");", yyout);
diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y
index 88591f831bc..e21a67b0800 100644
--- a/src/interfaces/ecpg/preproc/preproc.y
+++ b/src/interfaces/ecpg/preproc/preproc.y
@@ -392,64 +392,64 @@ statement: ecpgstart opt_at stmt ';' { connection = NULL; }
opt_at: SQL_AT connection_target { connection = $2; }
-stmt: AlterTableStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | AlterGroupStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | AlterUserStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | ClosePortalStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | CommentStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | CopyStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | CreateStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | CreateAsStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | CreateGroupStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | CreateSeqStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | CreatePLangStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | CreateTrigStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | CreateUserStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | ClusterStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | DefineStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | DropStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | TruncateStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | DropGroupStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | DropPLangStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | DropTrigStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | DropUserStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | ExtendStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | ExplainStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | FetchStmt { output_statement($1, 1, NULL, connection, argsinsert, argsresult); }
- | GrantStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | IndexStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | ListenStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | UnlistenStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | LockStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | ProcedureStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | ReindexStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | RemoveAggrStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | RemoveOperStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | RemoveFuncStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | RemoveStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | RenameStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | RevokeStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
+stmt: AlterTableStmt { output_statement($1, 0, NULL, connection); }
+ | AlterGroupStmt { output_statement($1, 0, NULL, connection); }
+ | AlterUserStmt { output_statement($1, 0, NULL, connection); }
+ | ClosePortalStmt { output_statement($1, 0, NULL, connection); }
+ | CommentStmt { output_statement($1, 0, NULL, connection); }
+ | CopyStmt { output_statement($1, 0, NULL, connection); }
+ | CreateStmt { output_statement($1, 0, NULL, connection); }
+ | CreateAsStmt { output_statement($1, 0, NULL, connection); }
+ | CreateGroupStmt { output_statement($1, 0, NULL, connection); }
+ | CreateSeqStmt { output_statement($1, 0, NULL, connection); }
+ | CreatePLangStmt { output_statement($1, 0, NULL, connection); }
+ | CreateTrigStmt { output_statement($1, 0, NULL, connection); }
+ | CreateUserStmt { output_statement($1, 0, NULL, connection); }
+ | ClusterStmt { output_statement($1, 0, NULL, connection); }
+ | DefineStmt { output_statement($1, 0, NULL, connection); }
+ | DropStmt { output_statement($1, 0, NULL, connection); }
+ | TruncateStmt { output_statement($1, 0, NULL, connection); }
+ | DropGroupStmt { output_statement($1, 0, NULL, connection); }
+ | DropPLangStmt { output_statement($1, 0, NULL, connection); }
+ | DropTrigStmt { output_statement($1, 0, NULL, connection); }
+ | DropUserStmt { output_statement($1, 0, NULL, connection); }
+ | ExtendStmt { output_statement($1, 0, NULL, connection); }
+ | ExplainStmt { output_statement($1, 0, NULL, connection); }
+ | FetchStmt { output_statement($1, 1, NULL, connection); }
+ | GrantStmt { output_statement($1, 0, NULL, connection); }
+ | IndexStmt { output_statement($1, 0, NULL, connection); }
+ | ListenStmt { output_statement($1, 0, NULL, connection); }
+ | UnlistenStmt { output_statement($1, 0, NULL, connection); }
+ | LockStmt { output_statement($1, 0, NULL, connection); }
+ | ProcedureStmt { output_statement($1, 0, NULL, connection); }
+ | ReindexStmt { output_statement($1, 0, NULL, connection); }
+ | RemoveAggrStmt { output_statement($1, 0, NULL, connection); }
+ | RemoveOperStmt { output_statement($1, 0, NULL, connection); }
+ | RemoveFuncStmt { output_statement($1, 0, NULL, connection); }
+ | RemoveStmt { output_statement($1, 0, NULL, connection); }
+ | RenameStmt { output_statement($1, 0, NULL, connection); }
+ | RevokeStmt { output_statement($1, 0, NULL, connection); }
| OptimizableStmt {
if (strncmp($1, "/* " , sizeof("/* ")-1) == 0)
output_simple_statement($1);
else
- output_statement($1, 1, NULL, connection, argsinsert, argsresult);
+ output_statement($1, 1, NULL, connection);
}
- | RuleStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
+ | RuleStmt { output_statement($1, 0, NULL, connection); }
| TransactionStmt {
fprintf(yyout, "{ ECPGtrans(__LINE__, %s, \"%s\");", connection ? connection : "NULL", $1);
whenever_action(2);
free($1);
}
- | ViewStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | LoadStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | CreatedbStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | DropdbStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | VacuumStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | VariableSetStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | VariableShowStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | VariableResetStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | ConstraintsSetStmt { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
+ | ViewStmt { output_statement($1, 0, NULL, connection); }
+ | LoadStmt { output_statement($1, 0, NULL, connection); }
+ | CreatedbStmt { output_statement($1, 0, NULL, connection); }
+ | DropdbStmt { output_statement($1, 0, NULL, connection); }
+ | VacuumStmt { output_statement($1, 0, NULL, connection); }
+ | VariableSetStmt { output_statement($1, 0, NULL, connection); }
+ | VariableShowStmt { output_statement($1, 0, NULL, connection); }
+ | VariableResetStmt { output_statement($1, 0, NULL, connection); }
+ | ConstraintsSetStmt { output_statement($1, 0, NULL, connection); }
| ECPGAllocateDescr { fprintf(yyout,"ECPGallocate_desc(__LINE__, \"%s\");",$1);
whenever_action(0);
free($1);
@@ -489,8 +489,8 @@ stmt: AlterTableStmt { output_statement($1, 0, NULL, connection, argsinsert,
whenever_action(2);
free($1);
}
- | ECPGExecute { output_statement($1, 0, NULL, connection, argsinsert, argsresult); }
- | ECPGFetchDescStmt { output_statement($1.str, 1, $1.name, connection, argsinsert, argsresult); }
+ | ECPGExecute { output_statement($1, 0, NULL, connection); }
+ | ECPGFetchDescStmt { output_statement($1.str, 1, $1.name, connection); }
| ECPGFree {
fprintf(yyout, "{ ECPGdeallocate(__LINE__, \"%s\");", $1);
@@ -531,7 +531,9 @@ stmt: AlterTableStmt { output_statement($1, 0, NULL, connection, argsinsert,
else
argsinsert = ptr->argsinsert;
- output_statement(ptr->command, 0, NULL, ptr->connection, argsinsert, ptr->argsresult);
+ argsresult = ptr->argsresult;
+
+ output_statement(ptr->command, 0, NULL, ptr->connection);
}
| ECPGPrepare {
if (connection)
diff --git a/src/interfaces/ecpg/preproc/variable.c b/src/interfaces/ecpg/preproc/variable.c
index 10b8af6cf95..98cf32576d7 100644
--- a/src/interfaces/ecpg/preproc/variable.c
+++ b/src/interfaces/ecpg/preproc/variable.c
@@ -189,7 +189,6 @@ reset_variables(void)
argsresult = NULL;
}
-
/* Add a variable to a request. */
void
add_variable(struct arguments ** list, struct variable * var, struct variable * ind)