[svn:DBD-Pg] r14864 - DBD-Pg/trunk

[email protected]
Newsgroups gmane.comp.db.postgresql.dbdpg.cvs
Message-ID <[email protected]>
Author: turnstep
Date: Mon May 16 09:28:43 2011
New Revision: 14864

Modified:
   DBD-Pg/trunk/Changes
   DBD-Pg/trunk/dbdimp.c

Log:
Better error message when trying to do things post-disconnect. Per discussion on dbi-dev.


Modified: DBD-Pg/trunk/Changes
==============================================================================
--- DBD-Pg/trunk/Changes	(original)
+++ DBD-Pg/trunk/Changes	Mon May 16 09:28:43 2011
@@ -1,6 +1,9 @@
 'GSM' is Greg Sabino Mullane, greg-738XdyZ4GzZWk0Htik3J/[email protected])
 
 
+  - Better error message when trying to do things post-disconnect [GSM]
+
+
 Version 2.18.1  Released May 9, 2011
 
   - Fix LANG testing issue [GSM] (CPAN bug #56705)

Modified: DBD-Pg/trunk/dbdimp.c
==============================================================================
--- DBD-Pg/trunk/dbdimp.c	(original)
+++ DBD-Pg/trunk/dbdimp.c	Mon May 16 09:28:43 2011
@@ -2712,8 +2712,10 @@
 	if (TSTART) TRC(DBILOGFP, "%sBegin pg_quickexec (query: %s async: %d async_status: %d)\n",
 			THEADER, sql, asyncflag, imp_dbh->async_status);
 
-	if (NULL == imp_dbh->conn)
-		croak("execute on disconnected handle");
+	if (NULL == imp_dbh->conn) {
+		pg_error(aTHX_ dbh, PGRES_FATAL_ERROR, "Database handle has been disconnected");
+		return -2;
+	}
 
 	/* Abort if we are in the middle of a copy */
 	if (imp_dbh->copystate != 0) {
@@ -2880,8 +2882,10 @@
 	
 	if (TSTART) TRC(DBILOGFP, "%sBegin dbd_st_execute\n", THEADER);
 	
-	if (NULL == imp_dbh->conn)
-		croak("execute on disconnected handle");
+	if (NULL == imp_dbh->conn) {
+		pg_error(aTHX_ sth, PGRES_FATAL_ERROR, "Cannot call execute on a disconnected database handle");
+		return -2;
+	}
 
 	/* Abort if we are in the middle of a copy */
 	if (imp_dbh->copystate!=0)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.