Committed by Tim Bunce <[email protected]>
add comments suggesting better approch to logging
---
Pg.h | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Pg.h b/Pg.h
index f90924f..3a3deb4 100644
--- a/Pg.h
+++ b/Pg.h
@@ -108,6 +108,14 @@ DBISTATE_DECLARE;
/* Fancy stuff for tracing of commonly used libpq functions */
#define TRACE_XX if (TLIBPQ_slow) TRC(DBILOGFP,
+/* XXX every use of every one of these costs at least one call to DBIS
+ * and possibly +1 for DBILOGFP and another for THEADER_slow!
+ * A better approach may be something like DBD::Oracle's
+ * http://cpansearch.perl.org/src/PYTHIAN/DBD-Oracle-1.42/ocitrace.h
+ * #define PGfooBar_log_stat(imp_xxh, stat, a,b,c) ... where imp_xxh
+ * is used to determine the logging and stat holds the result.
+ * That makes the code uncluttered and gives good flexibility.
+ */
#define TRACE_PQBACKENDPID TRACE_XX "%sPQbackendPID\n", THEADER_slow)
#define TRACE_PQCANCEL TRACE_XX "%sPQcancel\n", THEADER_slow)
#define TRACE_PQCLEAR TRACE_XX "%sPQclear\n", THEADER_slow)
@@ -115,7 +123,6 @@ DBISTATE_DECLARE;
#define TRACE_PQCMDTUPLES TRACE_XX "%sPQcmdTuples\n", THEADER_slow)
#define TRACE_PQCONNECTDB TRACE_XX "%sPQconnectdb\n", THEADER_slow)
#define TRACE_PQCONSUMEINPUT TRACE_XX "%sPQconsumeInput\n", THEADER_slow)
-#define TRACE_PQCONSUMEINPUT TRACE_XX "%sPQconsumeInput\n", THEADER_slow)
#define TRACE_PQDB TRACE_XX "%sPQdb\n", THEADER_slow)
#define TRACE_PQENDCOPY TRACE_XX "%sPQendcopy\n", THEADER_slow)
#define TRACE_PQERRORMESSAGE TRACE_XX "%sPQerrorMessage\n", THEADER_slow)
@@ -127,7 +134,6 @@ DBISTATE_DECLARE;
#define TRACE_PQFNAME TRACE_XX "%sPQfname\n", THEADER_slow)
#define TRACE_PQFREECANCEL TRACE_XX "%sPQfreeCancel\n", THEADER_slow)
#define TRACE_PQFREEMEM TRACE_XX "%sPQfreemem\n", THEADER_slow)
-#define TRACE_PQFREEMEM TRACE_XX "%sPQfreemem\n", THEADER_slow)
#define TRACE_PQFSIZE TRACE_XX "%sPQfsize\n", THEADER_slow)
#define TRACE_PQFTABLECOL TRACE_XX "%sPQftableCol\n", THEADER_slow)
#define TRACE_PQFTABLE TRACE_XX "%sPQftable\n", THEADER_slow)
--
1.7.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.