diff options
author | Michael Meskes <meskes@postgresql.org> | 2005-11-30 12:50:37 +0000 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2005-11-30 12:50:37 +0000 |
commit | dd13bf167b24fc497a7ce7f1897a89ae3ac40c9f (patch) | |
tree | 5cb0595ed4889482db3e9f8b91f2185bf948be25 /src/interfaces/ecpg/ecpglib/execute.c | |
parent | c4279b45fd6031173adc8ae533a1f81942cfb027 (diff) | |
download | postgresql-dd13bf167b24fc497a7ce7f1897a89ae3ac40c9f.tar.gz postgresql-dd13bf167b24fc497a7ce7f1897a89ae3ac40c9f.zip |
- Made several variables "const char *" instead of "char *" as proposed by Qingqing Zhou <zhouqq@cs.toronto.edu>.
- Replaced all strdup() calls by ECPGstrdup().
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/execute.c')
-rw-r--r-- | src/interfaces/ecpg/ecpglib/execute.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c index ac870f0cc82..870c9d2cc3c 100644 --- a/src/interfaces/ecpg/ecpglib/execute.c +++ b/src/interfaces/ecpg/ecpglib/execute.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.43 2005/10/15 02:49:47 momjian Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.43.2.1 2005/11/30 12:50:37 meskes Exp $ */ /* * The aim is to get a simpler inteface to the database routines. @@ -141,7 +141,7 @@ ECPGget_variable(va_list APREF, enum ECPGttype type, struct variable * var, bool * ind_offset - indicator offset */ static bool -create_statement(int lineno, int compat, int force_indicator, struct connection * connection, struct statement ** stmt, char *query, va_list ap) +create_statement(int lineno, int compat, int force_indicator, struct connection * connection, struct statement ** stmt, const char *query, va_list ap) { struct variable **list = &((*stmt)->inlist); enum ECPGttype type; @@ -149,7 +149,7 @@ create_statement(int lineno, int compat, int force_indicator, struct connection if (!(*stmt = (struct statement *) ECPGalloc(sizeof(struct statement), lineno))) return false; - (*stmt)->command = query; + (*stmt)->command = ECPGstrdup(query, lineno); (*stmt)->connection = connection; (*stmt)->lineno = lineno; (*stmt)->compat = compat; @@ -224,6 +224,7 @@ free_statement(struct statement * stmt) return; free_variable(stmt->inlist); free_variable(stmt->outlist); + ECPGfree(stmt->command); ECPGfree(stmt); } @@ -1359,7 +1360,7 @@ ECPGexecute(struct statement * stmt) } bool -ECPGdo(int lineno, int compat, int force_indicator, const char *connection_name, char *query,...) +ECPGdo(int lineno, int compat, int force_indicator, const char *connection_name, const char *query,...) { va_list args; struct statement *stmt; @@ -1369,7 +1370,7 @@ ECPGdo(int lineno, int compat, int force_indicator, const char *connection_name, /* Make sure we do NOT honor the locale for numeric input/output */ /* since the database wants the standard decimal point */ - oldlocale = strdup(setlocale(LC_NUMERIC, NULL)); + oldlocale = ECPGstrdup(setlocale(LC_NUMERIC, NULL), lineno); setlocale(LC_NUMERIC, "C"); if (!ECPGinit(con, connection_name, lineno)) |