commit 8ce4c5646b139226fb86ed59fa14c269afda7e4d
Author: Böszörményi Zoltán <zboszormenyi@sicom.com>
Date:   Sat Jan 18 11:27:42 2014 +0100

    ECPG: Use the more descriptive "act_tuple" variable name instead of "i".
    Use the variables declared for the function scope, don't alias them.

diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index db06455..2a4dfea 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -1523,6 +1523,7 @@ ecpg_process_output(struct statement * stmt, int start, int ntuples, int directi
 	struct sqlca_t *sqlca = ECPGget_sqlca();
 	int			nfields,
 				tuples_left,
+				act_tuple,
 				act_field;
 
 	var = stmt->outlist;
@@ -1555,17 +1556,16 @@ ecpg_process_output(struct statement * stmt, int start, int ntuples, int directi
 				{
 					if (append_result && desc->result)
 					{
-						int		act_tuple, col,
-								row = PQntuples(desc->result);
+						int		row = PQntuples(desc->result);
 
 						for (tuples_left = ntuples, act_tuple = start; tuples_left; tuples_left--, act_tuple += direction, row++)
-							for (col = 0; col < nfields; col++)
+							for (act_field = 0; act_field < nfields; act_field++)
 							{
-								bool	isnull = PQgetisnull(stmt->results, act_tuple, col);
+								bool	isnull = PQgetisnull(stmt->results, act_tuple, act_field);
 
-								if (!PQsetvalue(desc->result, row, col,
-										isnull ? NULL : PQgetvalue(stmt->results, act_tuple, col),
-										isnull ? -1 : PQgetlength(stmt->results, act_tuple, col)))
+								if (!PQsetvalue(desc->result, row, act_field,
+										isnull ? NULL : PQgetvalue(stmt->results, act_tuple, act_field),
+										isnull ? -1 : PQgetlength(stmt->results, act_tuple, act_field)))
 								{
 									ecpg_raise(stmt->lineno, ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
 									status = false;
@@ -1593,7 +1593,6 @@ ecpg_process_output(struct statement * stmt, int start, int ntuples, int directi
 					struct sqlda_compat *sqlda = *_sqlda;
 					struct sqlda_compat *sqlda_last;
 					struct sqlda_compat *sqlda_new;
-					int			i;
 
 					if (append_result)
 					{
@@ -1615,13 +1614,13 @@ ecpg_process_output(struct statement * stmt, int start, int ntuples, int directi
 						}
 						*_sqlda = sqlda = sqlda_last = NULL;
 					}
-					for (i = start; ntuples; ntuples--, i += direction)
+					for (tuples_left = ntuples, act_tuple = start; tuples_left; tuples_left--, act_tuple += direction)
 					{
 						/*
 						 * Build a new sqlda structure. Note that only
 						 * fetching 1 record is supported
 						 */
-						sqlda_new = ecpg_build_compat_sqlda(stmt->lineno, stmt->results, i, stmt->compat);
+						sqlda_new = ecpg_build_compat_sqlda(stmt->lineno, stmt->results, act_tuple, stmt->compat);
 
 						if (!sqlda_new)
 						{
@@ -1652,7 +1651,7 @@ ecpg_process_output(struct statement * stmt, int start, int ntuples, int directi
 								*_sqlda = sqlda = sqlda_last = sqlda_new;
 							}
 
-							ecpg_set_compat_sqlda(stmt->lineno, &sqlda_new, stmt->results, i, stmt->compat);
+							ecpg_set_compat_sqlda(stmt->lineno, &sqlda_new, stmt->results, act_tuple, stmt->compat);
 							ecpg_log("ecpg_process_output on line %d: putting result (1 tuple %d fields) into sqlda descriptor\n",
 									 stmt->lineno, PQnfields(stmt->results));
 						}
@@ -1664,7 +1663,6 @@ ecpg_process_output(struct statement * stmt, int start, int ntuples, int directi
 					struct sqlda_struct *sqlda = *_sqlda;
 					struct sqlda_struct *sqlda_last;
 					struct sqlda_struct *sqlda_new;
-					int			i;
 
 					if (append_result)
 					{
@@ -1686,13 +1684,13 @@ ecpg_process_output(struct statement * stmt, int start, int ntuples, int directi
 						}
 						*_sqlda = sqlda = sqlda_last = NULL;
 					}
-					for (i = start; ntuples; ntuples--, i += direction)
+					for (tuples_left = ntuples, act_tuple = start; tuples_left; tuples_left--, act_tuple += direction)
 					{
 						/*
 						 * Build a new sqlda structure. Note that only
 						 * fetching 1 record is supported
 						 */
-						sqlda_new = ecpg_build_native_sqlda(stmt->lineno, stmt->results, i, stmt->compat);
+						sqlda_new = ecpg_build_native_sqlda(stmt->lineno, stmt->results, act_tuple, stmt->compat);
 
 						if (!sqlda_new)
 						{
@@ -1723,7 +1721,7 @@ ecpg_process_output(struct statement * stmt, int start, int ntuples, int directi
 								*_sqlda = sqlda = sqlda_last = sqlda_new;
 							}
 
-							ecpg_set_native_sqlda(stmt->lineno, &sqlda_new, stmt->results, i, stmt->compat);
+							ecpg_set_native_sqlda(stmt->lineno, &sqlda_new, stmt->results, act_tuple, stmt->compat);
 							ecpg_log("ecpg_process_output on line %d: putting result (1 tuple %d fields) into sqlda descriptor\n",
 									 stmt->lineno, PQnfields(stmt->results));
 						}
