apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tdono...@apache.org
Subject svn commit: r668784 - /apr/apr-util/trunk/dbd/apr_dbd_odbc.c
Date Tue, 17 Jun 2008 18:34:57 GMT
Author: tdonovan
Date: Tue Jun 17 11:34:57 2008
New Revision: 668784

URL: http://svn.apache.org/viewvc?rev=668784&view=rev
Log:
don't try to close results or stmts in a cleanup if the connection has already been manually
closed

Modified:
    apr/apr-util/trunk/dbd/apr_dbd_odbc.c

Modified: apr/apr-util/trunk/dbd/apr_dbd_odbc.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/dbd/apr_dbd_odbc.c?rev=668784&r1=668783&r2=668784&view=diff
==============================================================================
--- apr/apr-util/trunk/dbd/apr_dbd_odbc.c (original)
+++ apr/apr-util/trunk/dbd/apr_dbd_odbc.c Tue Jun 17 11:34:57 2008
@@ -293,10 +293,11 @@
 {   apr_dbd_results_t *dbr = (apr_dbd_results_t *) d;
     SQLRETURN rc = SQL_SUCCESS;
     
-    if (dbr && !dbr->isclosed) {
-        rc = SQLCloseCursor(dbr->stmt);
+    if (dbr && dbr->apr_dbd && dbr->apr_dbd->dbc) {
+    	if (!dbr->isclosed) 
+        	rc = SQLCloseCursor(dbr->stmt);
+    	dbr->isclosed = 1;
     }
-    dbr->isclosed = 1;
     return APR_FROM_SQL_RESULT(rc);
 }
 
@@ -305,12 +306,15 @@
 {   
     SQLRETURN rc = APR_SUCCESS;
     apr_dbd_prepared_t *statement = s;
-    SQLHANDLE hstmt = statement->stmt;
     /* stmt is closed if connection has already been closed */
-    if (hstmt && statement->apr_dbd && statement->apr_dbd->dbc)
{
-        rc = SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
+    if (statement) {
+        SQLHANDLE hstmt = statement->stmt;
+
+        if (hstmt && statement->apr_dbd && statement->apr_dbd->dbc)
{
+            rc = SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
         }
-    statement->stmt = NULL;
+        statement->stmt = NULL;
+    }
     return APR_FROM_SQL_RESULT(rc);
 }
 



Mime
View raw message