First small patches needed for regression tests
authorMichael Meskes <meskes@postgresql.org>
Mon, 31 Jul 2006 10:15:31 +0000 (10:15 +0000)
committerMichael Meskes <meskes@postgresql.org>
Mon, 31 Jul 2006 10:15:31 +0000 (10:15 +0000)
src/interfaces/ecpg/ecpglib/misc.c
src/interfaces/ecpg/include/sqlca.h

index fbe02bac10dcb5b2ff663fd254b02f0cd6122fbc..ef46496e753141003624091b90df1656049e12d4 100644 (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);
index aaf97d0ecf34dc72e27226afcfd75e6aa2c06980..32a09be0be0e0712b3954515052d5a08cc28fb01 100644 (file)
@@ -9,7 +9,7 @@
 #endif   /* __CYGWIN__ */
 #endif   /* DLLIMPORT */
 
-#define SQLERRMC_LEN   70
+#define SQLERRMC_LEN   150
 
 #ifdef __cplusplus
 extern         "C"