aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/lib/ecpglib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/ecpg/lib/ecpglib.c')
-rw-r--r--src/interfaces/ecpg/lib/ecpglib.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/interfaces/ecpg/lib/ecpglib.c b/src/interfaces/ecpg/lib/ecpglib.c
index 5074bc20e07..a6e2b23e01b 100644
--- a/src/interfaces/ecpg/lib/ecpglib.c
+++ b/src/interfaces/ecpg/lib/ecpglib.c
@@ -20,7 +20,6 @@
#include <ctype.h>
#include <locale.h>
-#include <libpq-fe.h>
#include <libpq/pqcomm.h>
#include <ecpgtype.h>
#include <ecpglib.h>
@@ -753,7 +752,7 @@ ECPGexecute(struct statement * stmt)
{
char *pval;
char *scan_length;
- char *array_query;
+ char *array_query;
if (var == NULL)
{
@@ -1127,36 +1126,44 @@ ECPGexecute(struct statement * stmt)
bool
ECPGdo(int lineno, const char *connection_name, char *query,...)
{
- va_list args;
- struct statement *stmt;
- struct connection *con = get_connection(connection_name);
- bool status;
- char *locale = setlocale(LC_NUMERIC, NULL);
+ va_list args;
+ struct statement *stmt;
+ struct connection *con = get_connection(connection_name);
+ bool status=true;
+ char *locale = setlocale(LC_NUMERIC, NULL);
/* Make sure we do NOT honor the locale for numeric input/output */
/* since the database wants teh standard decimal point */
setlocale(LC_NUMERIC, "C");
if (!ecpg_init(con, connection_name, lineno))
+ {
+ setlocale(LC_NUMERIC, locale);
return(false);
+ }
va_start(args, query);
if (create_statement(lineno, con, &stmt, query, args) == false)
+ {
+ setlocale(LC_NUMERIC, locale);
return (false);
+ }
va_end(args);
/* are we connected? */
if (con == NULL || con->connection == NULL)
{
+ free_statement(stmt);
ECPGlog("ECPGdo: not connected to %s\n", con->name);
register_error(ECPG_NOT_CONN, "Not connected in line %d.", lineno);
+ setlocale(LC_NUMERIC, locale);
return false;
}
status = ECPGexecute(stmt);
free_statement(stmt);
- /* and reser value so our application is not affected */
+ /* and reset locale value so our application is not affected */
setlocale(LC_NUMERIC, locale);
return (status);
}
@@ -1508,3 +1515,5 @@ ECPGprepared_statement(char *name)
for (this = prep_stmts; this != NULL && strcmp(this->name, name) != 0; this = this->next);
return (this) ? this->stmt->command : NULL;
}
+
+#include "dynamic.c"