psqlodbc.git / summary / log / commit / refs
commit d4ef75db064333c4591fe48ab3e548e7af4b8ffb
Author: Hiroshi Inoue <h-inoue@dream.email.ne.jp>
Date: Fri Sep 01 03:08:29 2017 +0000
Improve QLOG.
columninfo.c | 2 ++
connection.c | 2 +-
qresult.c | 6 +++++-
statement.c | 11 ++++++++++-
4 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/columninfo.c b/columninfo.c
index 9160ce67..2863b0cf 100644
--- a/columninfo.c
+++ b/columninfo.c
@@ -66,6 +66,7 @@ CI_read_fields_from_pgres(ColumnInfoClass *self, PGresult *pgres)
/* at first read in the number of fields that are in the query */
new_num_fields = PQnfields(pgres);
+ QLOG(0, "\tnFields: %d\n", new_num_fields);
MYLOG(0, "num_fields = %d\n", new_num_fields);
if (self)
@@ -102,6 +103,7 @@ CI_read_fields_from_pgres(ColumnInfoClass *self, PGresult *pgres)
if (new_atttypmod < 0)
new_atttypmod = -1;
+ QLOG(0, "\tfieldname='%s', adtid=%d, adtsize=%d, atttypmod=%d (rel,att)=(%d,%d)\n", new_field_name, new_adtid, new_adtsize, new_atttypmod, new_relid, new_attid);
MYLOG(0, "fieldname='%s', adtid=%d, adtsize=%d, atttypmod=%d (rel,att)=(%d,%d)\n", new_field_name, new_adtid, new_adtsize, new_atttypmod, new_relid, new_attid);
if (self)
diff --git a/connection.c b/connection.c
index de043634..df7a517b 100644
--- a/connection.c
+++ b/connection.c
@@ -159,7 +159,7 @@ PGAPI_Connect(HDBC hdbc,
free(tmpstr);
}
- QLOG(0, "conn = %p (DSN='%s', UID='%s', PWD='%s')\n", conn, ci->dsn, ci->username, NAME_IS_VALID(ci->password) ? "xxxxx" : "");
+ MYLOG(0, "conn = %p (DSN='%s', UID='%s', PWD='%s')\n", conn, ci->dsn, ci->username, NAME_IS_VALID(ci->password) ? "xxxxx" : "");
if ((fchar = CC_connect(conn, NULL)) <= 0)
{
diff --git a/qresult.c b/qresult.c
index 9ea6e108..7e8efeb5 100644
--- a/qresult.c
+++ b/qresult.c
@@ -602,7 +602,7 @@ QR_from_PGresult(QResultClass *self, StatementClass *stmt, ConnectionClass *conn
/* at first read in the number of fields that are in the query */
new_num_fields = PQnfields(*pgres);
MYLOG(0, "num_fields = %d\n", new_num_fields);
- QLOG(0, "\tnum_fields: %d\n", new_num_fields);
+ QLOG(0, "\tnFields: %d\n", new_num_fields);
/* according to that allocate memory */
QR_set_num_fields(self, new_num_fields);
@@ -1373,6 +1373,7 @@ nextrow:
this_keyset->status = 0;
}
+ QLOG(1, "\t");
for (field_lf = 0; field_lf < ci_num_fields; field_lf++)
{
BOOL isnull = FALSE;
@@ -1383,6 +1384,7 @@ nextrow:
{
this_tuplefield[field_lf].len = 0;
this_tuplefield[field_lf].value = 0;
+ QPRINTF(1, " (null)");
continue;
}
else
@@ -1398,6 +1400,7 @@ nextrow:
memcpy(buffer, value, len);
buffer[len] = '\0';
+ QPRINTF(1, " '%s'(%d)", buffer, len);
MYLOG(0, "qresult: len=%d, buffer='%s'\n", len, buffer);
if (field_lf >= effective_cols)
@@ -1436,6 +1439,7 @@ nextrow:
}
}
}
+ QPRINTF(1, "\n");
self->cursTuple++;
if (self->num_fields > 0)
{
diff --git a/statement.c b/statement.c
index 7ccff775..12ade90d 100644
--- a/statement.c
+++ b/statement.c
@@ -2757,7 +2757,7 @@ MYLOG(0, "sta_pidx=%d end_pidx=%d num_p=%d\n", sta_pidx, end_pidx, num_params);
conn->unnamed_prepared_stmt = NULL;
/* Prepare */
- QLOG(0, "PQprepare: %p '%s' plan=%s num_params=%d\n", conn->pqconn, query, plan_name, num_params);
+ QLOG(0, "PQprepare: %p '%s' plan=%s nParams=%d\n", conn->pqconn, query, plan_name, num_params);
pgres = PQprepare(conn->pqconn, plan_name, query, num_params, paramTypes);
if (PQresultStatus(pgres) != PGRES_COMMAND_OK)
{
@@ -2864,6 +2864,15 @@ ParseAndDescribeWithLibpq(StatementClass *stmt, const char *plan_name,
/* Extract parameter information from the result set */
num_p = PQnparams(pgres);
MYLOG(1, "num_params=%d info=%d\n", stmt->num_params, num_p);
+ if (get_qlog() > 0)
+ {
+ int i;
+
+ QLOG(0, "\tnParams=%d", num_p);
+ for (i = 0; i < num_p; i++)
+ QPRINTF(0, " %u", PQparamtype(pgres, i));
+ QPRINTF(0, "\n");
+ }
num_discard_params = 0;
if (stmt->discard_output_params)
CountParameters(stmt, NULL, NULL, &num_discard_params);
[parent: fb0dd9acbe67]