qlog_off_count = 0;
ENTER_MYLOG_CS;
- ENTER_QLOG_CS;
if (mylog_onoff)
mylog_on_count += cnopen;
else
mylog_on = 0;
else if (getGlobalDebug() > 0)
mylog_on = getGlobalDebug();
+ LEAVE_MYLOG_CS;
+
+ ENTER_QLOG_CS;
if (qlog_onoff)
qlog_on_count += cnopen;
else
qlog_off_count += cnopen;
if (qlog_on_count > 0)
- qlog_on = 1;
+ {
+ if (qlog_onoff > qlog_on)
+ qlog_on = qlog_onoff;
+ else if (qlog_on < 1)
+ qlog_on = 1;
+ }
else if (qlog_off_count > 0)
qlog_on = 0;
else if (getGlobalCommlog() > 0)
qlog_on = getGlobalCommlog();
LEAVE_QLOG_CS;
- LEAVE_MYLOG_CS;
+MYLOG(0, "mylog_on=%d qlog_on=%d\n", mylog_on, qlog_on);
}
#ifdef WIN32
break;
case SQL_ATTR_PGOPT_COMMLOG:
newValue = CAST_UPTR(SQLCHAR, Value);
- if (newValue > 0 && conn->connInfo.drivers.commlog <= 0)
+ if (newValue > 0)
{
- logs_on_off(-1, 0, 0);
+ logs_on_off(-1, 0, conn->connInfo.drivers.commlog);
conn->connInfo.drivers.commlog = newValue;
logs_on_off(1, 0, conn->connInfo.drivers.commlog);
MYLOG(0, "commlog => %d\n", conn->connInfo.drivers.commlog);
return ret;
}
+static log_params(int nParams, const Oid *paramTypes, const UCHAR * const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat)
+{
+ const int level = 1;
+ int i, j;
+ BOOL isBinary;
+
+ for (i = 0; i < nParams; i++)
+ {
+ isBinary = paramFormats ? paramFormats[i] : FALSE;
+ if (!paramValues[i])
+ QLOG(level, "\t%c (null) OID=%u\n", isBinary ? 'b' : 't', paramTypes ? paramTypes[i] : 0);
+ else if (isBinary)
+ {
+ QLOG(level, "\tb '");
+ for (j = 0; j < paramLengths[i]; j++)
+ QPRINTF(level, "%02x", paramValues[i][j]);
+ QPRINTF(level, " OID=%u\n", paramTypes ? paramTypes[i] : 0);
+ }
+ else
+ QLOG(level, "\tt '%s' OID=%u\n", paramValues[i], paramTypes ? paramTypes[i] : 0);
+ }
+}
static QResultClass *
libpq_bind_and_exec(StatementClass *stmt)
pstmt = stmt->processed_statements;
MYLOG(0, "execParams query=%s nParams=%d\n", pstmt->query, nParams);
QLOG(0, "PQexecParams: %p '%s' nParams=%d\n", conn->pqconn, pstmt->query, nParams);
+ log_params(nParams, paramTypes, (const UCHAR * const *) paramValues, paramLengths, paramFormats, resultFormat);
pgres = PQexecParams(conn->pqconn,
pstmt->query,
nParams,
/* already prepared */
MYLOG(0, "execPrepared plan=%s nParams=%d\n", plan_name, nParams);
QLOG(0, "PQexecPrepared: %p plan=%s nParams=%d\n", conn->pqconn, plan_name, nParams);
+ log_params(nParams, paramTypes, (const UCHAR * const *) paramValues, paramLengths, paramFormats, resultFormat);
pgres = PQexecPrepared(conn->pqconn,
plan_name, /* portal name == plan name */
nParams,