aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/ecpglib/data.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/data.c')
-rw-r--r--src/interfaces/ecpg/ecpglib/data.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c
index c81a6828474..36d54496224 100644
--- a/src/interfaces/ecpg/ecpglib/data.c
+++ b/src/interfaces/ecpg/ecpglib/data.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.32 2006/06/21 10:24:40 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.33 2006/08/08 11:51:24 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
@@ -16,6 +16,8 @@
#include "pgtypes_timestamp.h"
#include "pgtypes_interval.h"
+static enum { NOT_CHECKED, REGRESS, NORMAL } ECPG_regression_mode = NOT_CHECKED;
+
static bool
garbage_left(enum ARRAY_TYPE isarray, char *scan_length, enum COMPAT_MODE compat)
{
@@ -49,8 +51,32 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
int binary = PQfformat(results, act_field);
int size = PQgetlength(results, act_tuple, act_field);
int value_for_indicator = 0;
+ long log_offset;
+
+ /*
+ * use a global variable to see if the environment variable
+ * ECPG_REGRESSION is set or not. Remember the state in order to avoid
+ * subsequent calls to getenv() for this purpose.
+ */
+ if (ECPG_regression_mode == NOT_CHECKED)
+ {
+ if (getenv("ECPG_REGRESSION"))
+ ECPG_regression_mode = REGRESS;
+ else
+ ECPG_regression_mode = NORMAL;
+ }
+
+ /*
+ * If we are running in a regression test, do not log the offset
+ * variable, it depends on the machine's alignment.
+ */
+ if (ECPG_regression_mode == REGRESS)
+ log_offset = -1;
+ else
+ log_offset = offset;
+
+ ECPGlog("ECPGget_data line %d: RESULT: %s offset: %ld array: %s\n", lineno, pval ? (binary ? "BINARY" : pval) : "EMPTY", log_offset, isarray ? "Yes" : "No");
- ECPGlog("ECPGget_data line %d: RESULT: %s offset: %ld array: %s\n", lineno, pval ? (binary ? "BINARY" : pval) : "EMPTY", offset, isarray ? "Yes" : "No");
/* We will have to decode the value */
/*