1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-18 17:42:25 +03:00

Made parser check for valid copy to/from stdin/stdout combinations.

Lots of small changes in regression test suite
This commit is contained in:
Michael Meskes
2006-08-08 11:51:25 +00:00
parent d42cb5d880
commit 6e11202dbe
33 changed files with 757 additions and 723 deletions

View File

@ -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 */
/*