Committed by Stephen Keller <[email protected]>
Better handling of failed libpq connections. Should fix the bug where a
SQLSTATE of 08000 is expected but not returned.
---
dbdimp.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/dbdimp.c b/dbdimp.c
index d8f4f88..a63e7b7 100644
--- a/dbdimp.c
+++ b/dbdimp.c
@@ -403,7 +403,9 @@ static ExecStatusType _sqlstate(pTHX_ imp_dbh_t * imp_dbh,
PGresult * result)
strncpy(imp_dbh->sqlstate, "01000", 6); /* WARNING */
break;
case PGRES_FATAL_ERROR:
- if (!result) { /* libpq returned null - some sort of
connection problem */
+ /* libpq returned an actual PGRES_FATAL_ERROR result or
null indicating
+ some sort of connection problem. */
+ if ((result && PGRES_FATAL_ERROR ==
PQresultStatus(result)) || !result ) {
strncpy(imp_dbh->sqlstate, "08000", 6); /*
CONNECTION EXCEPTION */
break;
}
--
1.7.1