Author: turnstep
Date: Wed Feb 6 09:20:09 2008
New Revision: 10697
Modified:
DBD-Pg/trunk/Changes
DBD-Pg/trunk/dbdimp.c
Log:
Quick support for named trace level 'SQL'
Modified: DBD-Pg/trunk/Changes
==============================================================================
--- DBD-Pg/trunk/Changes (original)
+++ DBD-Pg/trunk/Changes Wed Feb 6 09:20:09 2008
@@ -1,6 +1,7 @@
('GSM' is Greg Sabino Mullane, [EMAIL PROTECTED])
2.0.0
+ - Quick support for named trace level 'SQL' [GSM]
- Allow objects with stringification overloading to work with quote().
(CPAN bug #32868) [David E. Wheeler and GSM]
- Make sure arrays handle UTF-8 smoothly (CPAN bug #32479) [GSM]
Modified: DBD-Pg/trunk/dbdimp.c
==============================================================================
--- DBD-Pg/trunk/dbdimp.c (original)
+++ DBD-Pg/trunk/dbdimp.c Wed Feb 6 09:20:09 2008
@@ -323,6 +323,9 @@
if (dbis->debug >= 4)
(void)PerlIO_printf(DBILOGFP, "dbdpg: _result sql=(%s)\n", sql);
+ if (dbis->debug & 256)
+ (void)PerlIO_printf(DBILOGFP, "%s\n\n", sql);
+
result = PQexec(imp_dbh->conn, sql);
status = _sqlstate(imp_dbh, result);
@@ -1937,6 +1940,9 @@
paramTypes[x++] = (currph->defaultval) ? 0 :
(Oid)currph->bind_type->type_id;
}
}
+ if (dbis->debug & 256)
+ (void)PerlIO_printf(DBILOGFP, "PREPARE %s AS %s\n\n",
imp_sth->prepare_name, statement);
+
result = PQprepare(imp_dbh->conn, imp_sth->prepare_name,
statement, params, paramTypes);
Safefree(paramTypes);
if (result) {
@@ -2496,6 +2502,9 @@
return 0;
}
+ if (dbis->debug & 256)
+ (void)PerlIO_printf(DBILOGFP, "%s\n\n", sql);
+
result = PQexec(imp_dbh->conn, sql);
status = _sqlstate(imp_dbh, result);
@@ -2756,6 +2765,14 @@
if (dbis->debug >= 5)
(void)PerlIO_printf(DBILOGFP, "dbdpg: Running
PQexecPrepared with (%s)\n", imp_sth->prepare_name);
+ if (dbis->debug & 256) {
+ (void)PerlIO_printf(DBILOGFP, "EXECUTE %s (\n",
imp_sth->prepare_name);
+ for (x=0,currph=imp_sth->ph; NULL != currph;
currph=currph->nextph,x++) {
+ (void)PerlIO_printf(DBILOGFP, "$%d: %s\n", x+1,
paramValues[x]);
+ }
+ (void)PerlIO_printf(DBILOGFP, ");\n\n");
+ }
+
if (imp_sth->async_flag & PG_ASYNC)
ret = PQsendQueryPrepared
(imp_dbh->conn, imp_sth->prepare_name, imp_sth->numphs,
paramValues, paramLengths, paramFormats, 0);
@@ -2822,6 +2839,14 @@
}
}
+ if (dbis->debug & 256) {
+ (void)PerlIO_printf(DBILOGFP, "EXECUTE %s (\n",
statement);
+ for (x=0,currph=imp_sth->ph; NULL != currph;
currph=currph->nextph,x++) {
+ (void)PerlIO_printf(DBILOGFP, "$%d:
%s\n", x+1, paramValues[x]);
+ }
+ (void)PerlIO_printf(DBILOGFP, ");\n\n");
+ }
+
if (dbis->debug >= 5)
(void)PerlIO_printf(DBILOGFP, "dbdpg: Running
PQexecParams with (%s)\n", statement);
if (imp_sth->async_flag & PG_ASYNC)
@@ -2859,6 +2884,9 @@
(void)PerlIO_printf(DBILOGFP, "dbdpg: Running
%s with (%s)\n",
imp_sth->async_flag & 1 ? "PQsendQuery" : "PQexec", statement);
+ if (dbis->debug & 256)
+ (void)PerlIO_printf(DBILOGFP, "%s\n\n",
statement);
+
if (imp_sth->async_flag & PG_ASYNC)
ret = PQsendQuery(imp_dbh->conn, statement);
else
@@ -4097,7 +4125,6 @@
if (0 == strncmp(imp_dbh->sqlstate, "57014", 5)) {
if (dbis->debug >= 0) { (void)PerlIO_printf(DBILOGFP, "dbdpg: Rolling
back after cancelled query\n"); }
dbd_db_rollback(h, imp_dbh);
- // PQexec(imp_dbh->conn, "ROLLBACK");
return DBDPG_TRUE;
}