aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/ecpglib/execute.c
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2009-02-03 08:48:29 +0000
committerMichael Meskes <meskes@postgresql.org>2009-02-03 08:48:29 +0000
commitefd019fc94897d1c8f7f0cf50214caa03308d751 (patch)
tree49ab927dddba8a9bcecc502cfc5af4c5f51544d8 /src/interfaces/ecpg/ecpglib/execute.c
parentb5d23f28ce56ddde40e4648971d233b4485fb71b (diff)
downloadpostgresql-efd019fc94897d1c8f7f0cf50214caa03308d751.tar.gz
postgresql-efd019fc94897d1c8f7f0cf50214caa03308d751.zip
Fixed copy&paste mistake that made library use uninitialized variable.
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/execute.c')
-rw-r--r--src/interfaces/ecpg/ecpglib/execute.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index 54636c4bc95..a0137614941 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.80 2009/02/02 16:14:06 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.81 2009/02/03 08:48:29 meskes Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
@@ -391,7 +391,11 @@ ecpg_store_result(const PGresult *results, int act_field,
}
}
else
- len = PQgetlength(results, act_tuple, act_field);
+ {
+ for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
+ len += strlen(PQgetvalue(results, act_tuple, act_field)) + 1;
+ }
+
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)