summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/ecpglib/execute.c
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2005-11-30 12:51:07 +0000
committerMichael Meskes <meskes@postgresql.org>2005-11-30 12:51:07 +0000
commitf9bdaeeb346065fe45b8761217c869c80e1c89b4 (patch)
treeee3d401c9536569d80f83b6e46482304a3ce87da /src/interfaces/ecpg/ecpglib/execute.c
parentacd3a4f3c5cce6697f0b152438b7a25288a6aff7 (diff)
- 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.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 bc46ddb34f0..f5c0e214e75 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.38.4.2 2005/06/02 12:37:25 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.38.4.3 2005/11/30 12:51:06 meskes Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
@@ -148,7 +148,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;
@@ -156,7 +156,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;
@@ -231,6 +231,7 @@ free_statement(struct statement * stmt)
return;
free_variable(stmt->inlist);
free_variable(stmt->outlist);
+ ECPGfree(stmt->command);
ECPGfree(stmt);
}
@@ -1369,7 +1370,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;
@@ -1379,7 +1380,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))