aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/ecpglib/execute.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2008-05-16 15:20:04 +0000
committerPeter Eisentraut <peter_e@gmx.net>2008-05-16 15:20:04 +0000
commite1bdd07c3c33d4004180506f1493efcbbbc02b4c (patch)
tree4b277572297bc7280a8e073e2e0931413e25d0fd /src/interfaces/ecpg/ecpglib/execute.c
parent4eb0900768a3eb880ab5cb267fa27b46de559433 (diff)
downloadpostgresql-e1bdd07c3c33d4004180506f1493efcbbbc02b4c.tar.gz
postgresql-e1bdd07c3c33d4004180506f1493efcbbbc02b4c.zip
Add localization support to ecpg.
Author: Euler Taveira de Oliveira <euler@timbira.com>
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/execute.c')
-rw-r--r--src/interfaces/ecpg/ecpglib/execute.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index f7bfd9dca7f..a6e58f0eaea 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.77 2008/03/01 03:26:34 tgl Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.78 2008/05/16 15:20:03 petere Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
@@ -301,7 +301,7 @@ ecpg_is_type_an_array(int type, const struct statement * stmt, const struct vari
return (ECPG_ARRAY_ERROR);
ecpg_type_infocache_push(&(stmt->connection->cache_head), type, isarray, stmt->lineno);
- ecpg_log("ecpg_is_type_an_array line %d: TYPE database: %d C: %d array: %s\n", stmt->lineno, type, var->type, isarray ? "Yes" : "No");
+ ecpg_log("ecpg_is_type_an_array on line %d: type (%d); C (%d); array (%s)\n", stmt->lineno, type, var->type, isarray ? _("yes") : _("no"));
return isarray;
}
@@ -328,7 +328,7 @@ ecpg_store_result(const PGresult *results, int act_field,
*/
if ((var->arrsize > 0 && ntuples > var->arrsize) || (var->ind_arrsize > 0 && ntuples > var->ind_arrsize))
{
- ecpg_log("ecpg_store_result line %d: Incorrect number of matches: %d don't fit into array of %d\n",
+ ecpg_log("ecpg_store_result on line %d: incorrect number of matches; %d don't fit into array of %d\n",
stmt->lineno, ntuples, var->arrsize);
ecpg_raise(stmt->lineno, INFORMIX_MODE(stmt->compat) ? ECPG_INFORMIX_SUBSELECT_NOT_ONE : ECPG_TOO_MANY_MATCHES, ECPG_SQLSTATE_CARDINALITY_VIOLATION, NULL);
return false;
@@ -387,7 +387,7 @@ ecpg_store_result(const PGresult *results, int act_field,
len = var->offset * ntuples;
break;
}
- ecpg_log("ecpg_store_result: line %d: allocating memory for %d tuples\n", stmt->lineno, ntuples);
+ ecpg_log("ecpg_store_result on line %d: allocating memory for %d tuples\n", stmt->lineno, ntuples);
var->value = (char *) ecpg_alloc(len, stmt->lineno);
if (!var->value)
return false;
@@ -729,7 +729,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
for (element = 0; element < var->arrsize; element++)
sprintf(mallocedval + strlen(mallocedval), "%c,", (((int *) var->value)[element]) ? 't' : 'f');
else
- ecpg_raise(lineno, ECPG_CONVERT_BOOL, ECPG_SQLSTATE_DATATYPE_MISMATCH, "different size");
+ ecpg_raise(lineno, ECPG_CONVERT_BOOL, ECPG_SQLSTATE_DATATYPE_MISMATCH, _("different size"));
strcpy(mallocedval + strlen(mallocedval) - 1, "]");
}
@@ -740,7 +740,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
else if (var->offset == sizeof(int))
sprintf(mallocedval, "%c", (*((int *) var->value)) ? 't' : 'f');
else
- ecpg_raise(lineno, ECPG_CONVERT_BOOL, ECPG_SQLSTATE_DATATYPE_MISMATCH, "different size");
+ ecpg_raise(lineno, ECPG_CONVERT_BOOL, ECPG_SQLSTATE_DATATYPE_MISMATCH, _("different size"));
}
*tobeinserted_p = mallocedval;
@@ -1042,7 +1042,7 @@ free_params(const char **paramValues, int nParams, bool print, int lineno)
for (n = 0; n < nParams; n++)
{
if (print)
- ecpg_log("free_params line %d: parameter %d = %s\n", lineno, n + 1, paramValues[n] ? paramValues[n] : "null");
+ ecpg_log("free_params on line %d: parameter %d = %s\n", lineno, n + 1, paramValues[n] ? paramValues[n] : _("null"));
ecpg_free((void *) (paramValues[n]));
}
ecpg_free(paramValues);
@@ -1275,23 +1275,23 @@ ecpg_execute(struct statement * stmt)
stmt->connection->committed = false;
}
- ecpg_log("ecpg_execute line %d: QUERY: %s with %d parameter on connection %s \n", stmt->lineno, stmt->command, nParams, stmt->connection->name);
+ ecpg_log("ecpg_execute on line %d: query: %s; with %d parameter(s) on connection %s\n", stmt->lineno, stmt->command, nParams, stmt->connection->name);
if (stmt->statement_type == ECPGst_execute)
{
results = PQexecPrepared(stmt->connection->connection, stmt->name, nParams, paramValues, NULL, NULL, 0);
- ecpg_log("ecpg_execute line %d: using PQexecPrepared for %s\n", stmt->lineno, stmt->command);
+ ecpg_log("ecpg_execute on line %d: using PQexecPrepared for \"%s\"\n", stmt->lineno, stmt->command);
}
else
{
if (nParams == 0)
{
results = PQexec(stmt->connection->connection, stmt->command);
- ecpg_log("ecpg_execute line %d: using PQexec\n", stmt->lineno);
+ ecpg_log("ecpg_execute on line %d: using PQexec\n", stmt->lineno);
}
else
{
results = PQexecParams(stmt->connection->connection, stmt->command, nParams, NULL, paramValues, NULL, NULL, 0);
- ecpg_log("ecpg_execute line %d: using PQexecParams \n", stmt->lineno);
+ ecpg_log("ecpg_execute on line %d: using PQexecParams\n", stmt->lineno);
}
}
@@ -1310,13 +1310,13 @@ ecpg_execute(struct statement * stmt)
case PGRES_TUPLES_OK:
nfields = PQnfields(results);
sqlca->sqlerrd[2] = ntuples = PQntuples(results);
- ecpg_log("ecpg_execute line %d: Correctly got %d tuples with %d fields\n", stmt->lineno, ntuples, nfields);
+ ecpg_log("ecpg_execute on line %d: correctly got %d tuples with %d fields\n", stmt->lineno, ntuples, nfields);
status = true;
if (ntuples < 1)
{
if (ntuples)
- ecpg_log("ecpg_execute line %d: Incorrect number of matches: %d\n",
+ ecpg_log("ecpg_execute on line %d: incorrect number of matches (%d)\n",
stmt->lineno, ntuples);
ecpg_raise(stmt->lineno, ECPG_NOT_FOUND, ECPG_SQLSTATE_NO_DATA, NULL);
status = false;
@@ -1335,7 +1335,8 @@ ecpg_execute(struct statement * stmt)
PQclear(desc->result);
desc->result = results;
clear_result = false;
- ecpg_log("ecpg_execute putting result (%d tuples) into descriptor '%s'\n", PQntuples(results), (const char *) var->pointer);
+ ecpg_log("ecpg_execute on line %d: putting result (%d tuples) into descriptor %s\n",
+ stmt->lineno, PQntuples(results), (const char *) var->pointer);
}
var = var->next;
}
@@ -1366,7 +1367,7 @@ ecpg_execute(struct statement * stmt)
cmdstat = PQcmdStatus(results);
sqlca->sqlerrd[1] = PQoidValue(results);
sqlca->sqlerrd[2] = atol(PQcmdTuples(results));
- ecpg_log("ecpg_execute line %d Ok: %s\n", stmt->lineno, cmdstat);
+ ecpg_log("ecpg_execute on line %d: OK: %s\n", stmt->lineno, cmdstat);
if (stmt->compat != ECPG_COMPAT_INFORMIX_SE &&
!sqlca->sqlerrd[2] &&
(!strncmp(cmdstat, "UPDATE", 6)
@@ -1379,7 +1380,7 @@ ecpg_execute(struct statement * stmt)
char *buffer;
int res;
- ecpg_log("ecpg_execute line %d: Got PGRES_COPY_OUT\n", stmt->lineno);
+ ecpg_log("ecpg_execute on line %d: COPY OUT data transfer in progress\n", stmt->lineno);
while ((res = PQgetCopyData(stmt->connection->connection,
&buffer, 0)) > 0)
{
@@ -1392,9 +1393,9 @@ ecpg_execute(struct statement * stmt)
PQclear(results);
results = PQgetResult(stmt->connection->connection);
if (PQresultStatus(results) == PGRES_COMMAND_OK)
- ecpg_log("ecpg_execute line %d: Got PGRES_COMMAND_OK after PGRES_COPY_OUT\n", stmt->lineno);
+ ecpg_log("ecpg_execute on line %d: got PGRES_COMMAND_OK after PGRES_COPY_OUT\n", stmt->lineno);
else
- ecpg_log("ecpg_execute line %d: Got error after PGRES_COPY_OUT: %s", PQresultErrorMessage(results));
+ ecpg_log("ecpg_execute on line %d: got error after PGRES_COPY_OUT: %s", PQresultErrorMessage(results));
}
break;
}
@@ -1404,7 +1405,7 @@ ecpg_execute(struct statement * stmt)
* execution should never reach this code because it is already
* handled in ECPGcheck_PQresult()
*/
- ecpg_log("ecpg_execute line %d: Got something else, postgres error.\n",
+ ecpg_log("ecpg_execute on line %d: unknown execution status type\n",
stmt->lineno);
ecpg_raise_backend(stmt->lineno, results, stmt->connection->connection, stmt->compat);
status = false;
@@ -1417,7 +1418,7 @@ ecpg_execute(struct statement * stmt)
notify = PQnotifies(stmt->connection->connection);
if (notify)
{
- ecpg_log("ecpg_execute line %d: ASYNC NOTIFY of '%s' from backend pid '%d' received\n",
+ ecpg_log("ecpg_execute on line %d: asynchronous notification of \"%s\" from backend pid %d received\n",
stmt->lineno, notify->relname, notify->be_pid);
PQfreemem(notify);
}
@@ -1624,7 +1625,7 @@ ECPGdo(const int lineno, const int compat, const int force_indicator, const char
if (con == NULL || con->connection == NULL)
{
free_statement(stmt);
- ecpg_raise(lineno, ECPG_NOT_CONN, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, (con) ? con->name : "<empty>");
+ ecpg_raise(lineno, ECPG_NOT_CONN, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, (con) ? con->name : _("<empty>"));
setlocale(LC_NUMERIC, oldlocale);
ecpg_free(oldlocale);
return false;