]> granicus.if.org Git - php/commitdiff
- free S->stmt
authorAntony Dovgal <tony2001@php.net>
Thu, 27 Oct 2005 17:25:31 +0000 (17:25 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 27 Oct 2005 17:25:31 +0000 (17:25 +0000)
- return correct value from the cursor_closer
- make sure S->stmt is NULL'ed

ext/pdo_mysql/mysql_statement.c

index 9a48b128a04353e23611b1fc689bb1b8978f20b4..e8d1728598136590d6936c5a8739216efb7be455 100755 (executable)
@@ -221,6 +221,12 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC)
        int ret;
 
        /* ensure that we free any previous unfetched results */
+#if HAVE_MYSQL_STMT_PREPARE
+       if (S->stmt) {
+               mysql_stmt_free_result(S->stmt);
+               S->stmt = NULL;
+       }
+#endif
        if (S->result) {
                mysql_free_result(S->result);
                S->result = NULL;
@@ -525,7 +531,9 @@ static int pdo_mysql_stmt_cursor_closer(pdo_stmt_t *stmt TSRMLS_DC)
        pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
 #if HAVE_MYSQL_STMT_PREPARE
        if (S->stmt) {
-               return mysql_stmt_free_result(S->stmt);
+               int retval = mysql_stmt_free_result(S->stmt);
+               S->stmt = NULL;
+               return retval ? 0 : 1;
        }
 #endif
        if (S->result) {