First small patches needed for regression tests

This commit is contained in:
Michael Meskes 2006-07-31 10:15:31 +00:00
parent 68dfef040b
commit c1c9b7c0c0
2 changed files with 18 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.27 2006/06/21 11:38:07 meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.28 2006/07/31 10:15:30 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
@ -246,7 +246,8 @@ ECPGlog(const char *format,...)
if (simple_debug)
{
char *f = (char *) malloc(strlen(format) + 100);
int bufsize = strlen(format) + 100;
char *f = (char *) malloc(bufsize);
if (f == NULL)
{
@ -256,11 +257,24 @@ ECPGlog(const char *format,...)
return;
}
sprintf(f, "[%d]: %s", (int) getpid(), format);
/*
* regression tests set this environment variable to get the same
* output for every run.
*/
if (getenv("ECPG_DONT_LOG_PID"))
snprintf(f, bufsize, "[NO_PID]: %s", format);
else
snprintf(f, bufsize, "[%d]: %s", (int) getpid(), format);
va_start(ap, format);
vfprintf(debugstream, f, ap);
va_end(ap);
/* dump out internal sqlca variables */
if (getenv("ECPG_DONT_LOG_PID"))
fprintf(debugstream, "[NO_PID]: sqlca: code: %ld, state: %s\n",
sqlca.sqlcode, sqlca.sqlstate);
fflush(debugstream);
ECPGfree(f);

View File

@ -9,7 +9,7 @@
#endif /* __CYGWIN__ */
#endif /* DLLIMPORT */
#define SQLERRMC_LEN 70
#define SQLERRMC_LEN 150
#ifdef __cplusplus
extern "C"