aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/ecpglib/execute.c
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2005-11-30 12:49:49 +0000
committerMichael Meskes <meskes@postgresql.org>2005-11-30 12:49:49 +0000
commit150131d9d9208d53abbd63052866ab663ab1855e (patch)
tree266e01ea27c861d486fe057c86b7dde04d3b0a61 /src/interfaces/ecpg/ecpglib/execute.c
parent339fbbb9a02b81adc346fa1ec6ad7847a9d3b476 (diff)
downloadpostgresql-150131d9d9208d53abbd63052866ab663ab1855e.tar.gz
postgresql-150131d9d9208d53abbd63052866ab663ab1855e.zip
- Made several variables "const char *" instead of "char *" as proposed by Qingqing Zhou <zhouqq@cs.toronto.edu>.
- Replaced all strdup() calls by ECPGstrdup(). - Set ecpg library version to 5.2. - Set ecpg version to 4.2.1.
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/execute.c')
-rw-r--r--src/interfaces/ecpg/ecpglib/execute.c11
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..491d6e6040b 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.44 2005/11/30 12:49:49 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))