Skip to content

Commit c1c9b7c

Browse files
author
Michael Meskes
committed
First small patches needed for regression tests
1 parent 68dfef0 commit c1c9b7c

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/interfaces/ecpg/ecpglib/misc.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.27 2006/06/21 11:38:07 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.28 2006/07/31 10:15:30 meskes Exp $ */
22

33
#define POSTGRES_ECPG_INTERNAL
44
#include "postgres_fe.h"
@@ -246,7 +246,8 @@ ECPGlog(const char *format,...)
246246

247247
if (simple_debug)
248248
{
249-
char *f = (char *) malloc(strlen(format) + 100);
249+
int bufsize = strlen(format) + 100;
250+
char *f = (char *) malloc(bufsize);
250251

251252
if (f == NULL)
252253
{
@@ -256,11 +257,24 @@ ECPGlog(const char *format,...)
256257
return;
257258
}
258259

259-
sprintf(f, "[%d]: %s", (int) getpid(), format);
260+
/*
261+
* regression tests set this environment variable to get the same
262+
* output for every run.
263+
*/
264+
if (getenv("ECPG_DONT_LOG_PID"))
265+
snprintf(f, bufsize, "[NO_PID]: %s", format);
266+
else
267+
snprintf(f, bufsize, "[%d]: %s", (int) getpid(), format);
260268

261269
va_start(ap, format);
262270
vfprintf(debugstream, f, ap);
263271
va_end(ap);
272+
273+
/* dump out internal sqlca variables */
274+
if (getenv("ECPG_DONT_LOG_PID"))
275+
fprintf(debugstream, "[NO_PID]: sqlca: code: %ld, state: %s\n",
276+
sqlca.sqlcode, sqlca.sqlstate);
277+
264278
fflush(debugstream);
265279

266280
ECPGfree(f);

src/interfaces/ecpg/include/sqlca.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#endif /* __CYGWIN__ */
1010
#endif /* DLLIMPORT */
1111

12-
#define SQLERRMC_LEN 70
12+
#define SQLERRMC_LEN 150
1313

1414
#ifdef __cplusplus
1515
extern "C"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy