List:Commits« Previous MessageNext Message »
From:ahristov Date:February 27 2007 11:29am
Subject:PHP mysqlnd svn commit: r70 - trunk/ext/mysqli/mysqlnd
View as plain text  
Author: ahristov
Date: 2007-02-27 12:29:14 +0100 (Tue, 27 Feb 2007)
New Revision: 70

Modified:
   trunk/ext/mysqli/mysqlnd/mysqlnd_ps.c
Log:
Don't close the connection implicitly, the resource
management will clean it


Modified: trunk/ext/mysqli/mysqlnd/mysqlnd_ps.c
===================================================================
--- trunk/ext/mysqli/mysqlnd/mysqlnd_ps.c	2007-02-26 20:27:24 UTC (rev 69)
+++ trunk/ext/mysqli/mysqlnd/mysqlnd_ps.c	2007-02-27 11:29:14 UTC (rev 70)
@@ -260,19 +260,12 @@
 		/* CLEAN BUFFERS !!!!!!!!!!!!!!!!!!*/
 	}
 
-	ret = mysqlnd_simple_command(stmt->conn, COM_STMT_PREPARE, query, query_len,
-								 PROT_LAST /* we will handle the OK packet*/,
-								 FALSE TSRMLS_CC);
-	stmt->upsert_status = stmt->conn->upsert_status;
-
-	if (FAIL == ret) {
+	if (FAIL == mysqlnd_simple_command(stmt->conn, COM_STMT_PREPARE, query,
+									   query_len, PROT_LAST, FALSE TSRMLS_CC) ||
+		FAIL == mysqlnd_stmt_read_prepare_response(stmt TSRMLS_CC)) {
 		return FAIL;
 	}
 
-	if (FAIL == (ret = mysqlnd_stmt_read_prepare_response(stmt TSRMLS_CC))) {
-		return FAIL;
-	}
-
 	if (stmt->param_count && FAIL == (ret = mysqlnd_stmt_skip_metadata(stmt
TSRMLS_CC))) {
 		memset(stmt, 0, sizeof(MYSQLND_STMT));
 		stmt->state = MYSQLND_STMT_INITTED;
@@ -727,13 +720,15 @@
 	/* Don't free it, the resource destructor will do it */
 	mysqlnd_internal_free_stmt_content(stmt TSRMLS_CC);
 	int4store(buf, stmt->stmt_id);
-	if (FAIL == mysqlnd_simple_command(conn, COM_STMT_CLOSE, (char *)buf, sizeof(buf),
+	if (conn->state == CONN_READY &&
+		FAIL == mysqlnd_simple_command(conn, COM_STMT_CLOSE, (char *)buf, sizeof(buf),
 									   PROT_LAST /* we will handle the response packet*/,
 									   FALSE TSRMLS_CC)) {
 		stmt->error_info = conn->error_info;
 		return FAIL;
 	}
-	
+	efree(stmt);
+
 	return PASS;
 }
 /* }}} */
@@ -1057,12 +1052,16 @@
 		efree(stmt->cmd_buffer.buffer);
 		stmt->cmd_buffer.buffer = NULL;
 	}
-	
+
 	/*
 	  result->conn is an address if this is an unbuffered query.
 	  In this case, decrement the reference counter in the connection
 	  object and if needed free the latter. If quit_sent is no
 	*/
+	if (stmt->conn) {
+		 --stmt->conn->references;
+	}
+#if A0
 	if (stmt->conn && (!(--stmt->conn->references)) &&
stmt->conn->state == CONN_QUIT_SENT) {
 		/*
 		  No multithreading issues as we don't share the connection :)
@@ -1072,6 +1071,7 @@
 		stmt->conn->m->dtor(stmt->conn TSRMLS_CC);
 		stmt->conn = NULL;
 	}
+#endif
 }
 /* }}} */
 

Thread
PHP mysqlnd svn commit: r70 - trunk/ext/mysqli/mysqlndahristov27 Feb