diff options
author | Michael Meskes <meskes@postgresql.org> | 2019-02-16 10:55:17 +0100 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2019-02-16 11:05:54 +0100 |
commit | bd7c95f0c1a38becffceb3ea7234d57167f6d4bf (patch) | |
tree | 8ab862d314ec1e241ef0b90fc42edf3f6f5e4be8 /src/interfaces/ecpg/ecpglib/ecpglib_extern.h | |
parent | 02a6a54ecd6632f974b1b4eebfb2373363431084 (diff) |
Add DECLARE STATEMENT support to ECPG.
DECLARE STATEMENT is a statement that lets users declare an identifier
pointing at a connection. This identifier will be used in other embedded
dynamic SQL statement such as PREPARE, EXECUTE, DECLARE CURSOR and so on.
When connecting to a non-default connection, the AT clause can be used in
a DECLARE STATEMENT once and is no longer needed in every dynamic SQL
statement. This makes ECPG applications easier and more efficient. Moreover,
writing code without designating connection explicitly improves portability.
Authors: Ideriha-san ("Ideriha, Takeshi" <ideriha.takeshi@jp.fujitsu.com>)
Kuroda-san ("Kuroda, Hayato" <kuroda.hayato@jp.fujitsu.com>)
Discussion: https://postgr.es/m4E72940DA2BF16479384A86D54D0988A565669DF@G01JPEXMBKW04
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/ecpglib_extern.h')
-rw-r--r-- | src/interfaces/ecpg/ecpglib/ecpglib_extern.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/interfaces/ecpg/ecpglib/ecpglib_extern.h b/src/interfaces/ecpg/ecpglib/ecpglib_extern.h index ae2dcfc6172..f3e41d3eec6 100644 --- a/src/interfaces/ecpg/ecpglib/ecpglib_extern.h +++ b/src/interfaces/ecpg/ecpglib/ecpglib_extern.h @@ -78,6 +78,15 @@ struct statement PGresult *results; }; +/* structure to store declared statements */ +struct declared_statement +{ + char *name; /* declared name */ + char *connection_name; + char *cursor_name; + struct declared_statement *next; +}; + /* structure to store prepared statements for a connection */ struct prepared_statement { @@ -87,6 +96,12 @@ struct prepared_statement struct prepared_statement *next; }; +struct cursor_statement +{ + char *name; /*cursor name*/ + struct cursor_statement *next; +}; + /* structure to store connections */ struct connection { @@ -95,6 +110,7 @@ struct connection bool autocommit; struct ECPGtype_information_cache *cache_head; struct prepared_statement *prep_stmts; + struct cursor_statement *cursor_stmts; struct connection *next; }; @@ -177,6 +193,11 @@ struct descriptor *ecpg_find_desc(int line, const char *name); struct prepared_statement *ecpg_find_prepared_statement(const char *, struct connection *, struct prepared_statement **); +void ecpg_update_declare_statement(const char *, const char *, const int); +char *ecpg_get_con_name_by_declared_name(const char *); +const char *ecpg_get_con_name_by_cursor_name(const char *); +void ecpg_release_declared_statement(const char *); + bool ecpg_store_result(const PGresult *results, int act_field, const struct statement *stmt, struct variable *var); bool ecpg_store_input(const int, const bool, const struct variable *, char **, bool); |