Author: turnstep
Date: Wed Mar 18 13:14:27 2009
New Revision: 12614
Modified:
DBD-Pg/trunk/dbdimp.c
Log:
Output libpq tracing for lo_ functions.
Modified: DBD-Pg/trunk/dbdimp.c
==============================================================================
--- DBD-Pg/trunk/dbdimp.c (original)
+++ DBD-Pg/trunk/dbdimp.c Wed Mar 18 13:14:27 2009
@@ -4124,6 +4124,9 @@
if (!pg_db_start_txn(aTHX_ dbh,imp_dbh))
return 0; /* No other option, because lo_creat returns an Oid */
+ if (TLIBPQ) {
+ TRC(DBILOGFP, "%slo_creat\n", THEADER);
+ }
return lo_creat(imp_dbh->conn, mode); /* 0 on error */
}
@@ -4139,6 +4142,9 @@
if (!pg_db_start_txn(aTHX_ dbh,imp_dbh))
return -2;
+ if (TLIBPQ) {
+ TRC(DBILOGFP, "%slo_open\n", THEADER);
+ }
return lo_open(imp_dbh->conn, lobjId, mode); /* -1 on error */
}
@@ -4150,6 +4156,9 @@
if (TSTART) TRC(DBILOGFP, "%sBegin pg_db_lo_close (fd: %d)\n", THEADER,
fd);
+ if (TLIBPQ) {
+ TRC(DBILOGFP, "%slo_close\n", THEADER);
+ }
return lo_close(imp_dbh->conn, fd); /* <0 on error, 0 if ok */
}
@@ -4162,6 +4171,9 @@
if (TSTART) TRC(DBILOGFP, "%sBegin pg_db_lo_read (fd: %d length: %d)\n",
THEADER, fd, len);
+ if (TLIBPQ) {
+ TRC(DBILOGFP, "%slo_read\n", THEADER);
+ }
return lo_read(imp_dbh->conn, fd, buf, len); /* bytes read, <0 on error
*/
}
@@ -4174,6 +4186,9 @@
if (TSTART) TRC(DBILOGFP, "%sBegin pg_db_lo_write (fd: %d length:
%d)\n",
THEADER, fd, len);
+ if (TLIBPQ) {
+ TRC(DBILOGFP, "%slo_write\n", THEADER);
+ }
return lo_write(imp_dbh->conn, fd, buf, len); /* bytes written, <0 on
error */
}
@@ -4186,6 +4201,9 @@
if (TSTART) TRC(DBILOGFP, "%sBegin pg_db_lo_lseek (fd: %d offset: %d
whence: %d)\n",
THEADER, fd, offset, whence);
+ if (TLIBPQ) {
+ TRC(DBILOGFP, "%slo_lseek\n", THEADER);
+ }
return lo_lseek(imp_dbh->conn, fd, offset, whence); /* new position, -1
on error */
}
@@ -4197,6 +4215,9 @@
if (TSTART) TRC(DBILOGFP, "%sBegin pg_db_lo_tell (fd: %d)\n", THEADER,
fd);
+ if (TLIBPQ) {
+ TRC(DBILOGFP, "%slo_tell\n", THEADER);
+ }
return lo_tell(imp_dbh->conn, fd); /* current position, <0 on error */
}
@@ -4211,6 +4232,9 @@
if (!pg_db_start_txn(aTHX_ dbh,imp_dbh))
return -2;
+ if (TLIBPQ) {
+ TRC(DBILOGFP, "%slo_unlink\n", THEADER);
+ }
return lo_unlink(imp_dbh->conn, lobjId); /* 1 on success, -1 on failure
*/
}
@@ -4222,9 +4246,15 @@
if (TSTART) TRC(DBILOGFP, "%sBegin pg_db_lo_import (filename: %s)\n",
THEADER, filename);
- if (!pg_db_start_txn(aTHX_ dbh,imp_dbh))
+ if (!pg_db_start_txn(aTHX_ dbh,imp_dbh)) {
+ if (TRACE7) TRC(DBILOGFP, "%sCannot pg_db_log_import unless in
a transaction\n",
+ THEADER);
return 0; /* No other option, because lo_import returns an Oid
*/
+ }
+ if (TLIBPQ) {
+ TRC(DBILOGFP, "%slo_import\n", THEADER);
+ }
return lo_import(imp_dbh->conn, filename); /* 0 on error */
}
@@ -4240,6 +4270,9 @@
if (!pg_db_start_txn(aTHX_ dbh,imp_dbh))
return -2;
+ if (TLIBPQ) {
+ TRC(DBILOGFP, "%slo_export\n", THEADER);
+ }
return lo_export(imp_dbh->conn, lobjId, filename); /* 1 on success, -1
on failure */
}