diff options
author | Michael Meskes <meskes@postgresql.org> | 2000-02-16 16:18:29 +0000 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2000-02-16 16:18:29 +0000 |
commit | 35ba9de276150fd3d589509a86ae651924f34cb3 (patch) | |
tree | 8d3c867e2fbb1bd7404036f7e798e9c113fa4859 /src/interfaces/ecpg/lib/ecpglib.c | |
parent | 988d53e5ea6d87a284e8d3c81829e86b89455fa9 (diff) | |
download | postgresql-35ba9de276150fd3d589509a86ae651924f34cb3.tar.gz postgresql-35ba9de276150fd3d589509a86ae651924f34cb3.zip |
*** empty log message ***
Diffstat (limited to 'src/interfaces/ecpg/lib/ecpglib.c')
-rw-r--r-- | src/interfaces/ecpg/lib/ecpglib.c | 25 |
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" |