--- embedaddon/php/ext/mysqlnd/mysqlnd_ps.c 2012/05/29 12:34:41 1.1.1.2 +++ embedaddon/php/ext/mysqlnd/mysqlnd_ps.c 2014/06/15 20:03:52 1.1.1.4 @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 2006-2012 The PHP Group | + | Copyright (c) 2006-2014 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mysqlnd_ps.c,v 1.1.1.2 2012/05/29 12:34:41 misho Exp $ */ +/* $Id: mysqlnd_ps.c,v 1.1.1.4 2014/06/15 20:03:52 misho Exp $ */ #include "php.h" #include "mysqlnd.h" #include "mysqlnd_wireprotocol.h" @@ -485,6 +485,7 @@ mysqlnd_stmt_execute_parse_response(MYSQLND_STMT * con ret = mysqlnd_query_read_result_set_header(stmt->conn, s TSRMLS_CC); if (ret == FAIL) { COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info); + memset(stmt->upsert_status, 0, sizeof(*stmt->upsert_status)); stmt->upsert_status->affected_rows = conn->upsert_status->affected_rows; if (CONN_GET_STATE(conn) == CONN_QUIT_SENT) { /* close the statement here, the connection has been closed */ @@ -636,6 +637,8 @@ MYSQLND_METHOD(mysqlnd_stmt, execute)(MYSQLND_STMT * c have it again. */ stmt->result->m.free_result_buffers(stmt->result TSRMLS_CC); + + stmt->state = MYSQLND_STMT_PREPARED; } else if (stmt->state < MYSQLND_STMT_PREPARED) { /* Only initted - error */ SET_CLIENT_ERROR(*conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, @@ -911,6 +914,7 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES *result, DBG_INF("EOF"); /* Mark the connection as usable again */ result->unbuf->eof_reached = TRUE; + memset(result->conn->upsert_status, 0, sizeof(*result->conn->upsert_status)); result->conn->upsert_status->warning_count = row_packet->warning_count; result->conn->upsert_status->server_status = row_packet->server_status; /* @@ -1020,6 +1024,7 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES *result, voi row_packet->skip_extraction = stmt->result_bind? FALSE:TRUE; + memset(stmt->upsert_status, 0, sizeof(*stmt->upsert_status)); if (PASS == (ret = PACKET_READ(row_packet, result->conn)) && !row_packet->eof) { unsigned int i, field_count = result->field_count; @@ -1221,8 +1226,6 @@ MYSQLND_METHOD(mysqlnd_stmt, reset)(MYSQLND_STMT * con COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info); } *stmt->upsert_status = *conn->upsert_status; - - stmt->state = MYSQLND_STMT_PREPARED; } DBG_INF(ret == PASS? "PASS":"FAIL"); DBG_RETURN(ret); @@ -1261,8 +1264,6 @@ MYSQLND_METHOD(mysqlnd_stmt, flush)(MYSQLND_STMT * con stmt->result->m.skip_result(stmt->result TSRMLS_CC); } } while (mysqlnd_stmt_more_results(s) && mysqlnd_stmt_next_result(s) == PASS); - - stmt->state = MYSQLND_STMT_PREPARED; } DBG_INF(ret == PASS? "PASS":"FAIL"); DBG_RETURN(ret); @@ -1480,7 +1481,7 @@ MYSQLND_METHOD(mysqlnd_stmt, bind_one_parameter)(MYSQL if (stmt->param_count) { if (!stmt->param_bind) { - stmt->param_bind = mnd_ecalloc(stmt->param_count, sizeof(MYSQLND_PARAM_BIND)); + stmt->param_bind = mnd_pecalloc(stmt->param_count, sizeof(MYSQLND_PARAM_BIND), stmt->persistent); if (!stmt->param_bind) { DBG_RETURN(FAIL); } @@ -1622,9 +1623,9 @@ MYSQLND_METHOD(mysqlnd_stmt, bind_one_result)(MYSQLND_ mysqlnd_stmt_separate_one_result_bind(s, param_no TSRMLS_CC); /* Guaranteed is that stmt->result_bind is NULL */ if (!stmt->result_bind) { - stmt->result_bind = mnd_ecalloc(stmt->field_count, sizeof(MYSQLND_RESULT_BIND)); + stmt->result_bind = mnd_pecalloc(stmt->field_count, sizeof(MYSQLND_RESULT_BIND), stmt->persistent); } else { - stmt->result_bind = mnd_erealloc(stmt->result_bind, stmt->field_count * sizeof(MYSQLND_RESULT_BIND)); + stmt->result_bind = mnd_perealloc(stmt->result_bind, stmt->field_count * sizeof(MYSQLND_RESULT_BIND), stmt->persistent); } if (!stmt->result_bind) { DBG_RETURN(FAIL);