@@ -754,6 +754,7 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES * result, zval **row_ptr, const unsign
754
754
MYSQLND_CONN_DATA * conn = stmt -> conn ;
755
755
zend_uchar buf [MYSQLND_STMT_ID_LENGTH /* statement id */ + 4 /* number of rows to fetch */ ];
756
756
MYSQLND_PACKET_ROW * row_packet ;
757
+ void * checkpoint ;
757
758
758
759
DBG_ENTER ("mysqlnd_fetch_stmt_row_cursor" );
759
760
@@ -790,6 +791,9 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES * result, zval **row_ptr, const unsign
790
791
791
792
}
792
793
794
+ checkpoint = result -> memory_pool -> checkpoint ;
795
+ mysqlnd_mempool_save_state (result -> memory_pool );
796
+
793
797
UPSERT_STATUS_RESET (stmt -> upsert_status );
794
798
if (PASS == (ret = PACKET_READ (conn , row_packet )) && !row_packet -> eof ) {
795
799
if (row_ptr ) {
@@ -804,6 +808,8 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES * result, zval **row_ptr, const unsign
804
808
conn -> options -> int_and_float_native ,
805
809
conn -> stats ))
806
810
{
811
+ mysqlnd_mempool_restore_state (result -> memory_pool );
812
+ result -> memory_pool -> checkpoint = checkpoint ;
807
813
DBG_RETURN (FAIL );
808
814
}
809
815
} else {
@@ -812,11 +818,6 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES * result, zval **row_ptr, const unsign
812
818
}
813
819
/* We asked for one row, the next one should be EOF, eat it */
814
820
ret = PACKET_READ (conn , row_packet );
815
- if (row_packet -> row_buffer .ptr ) {
816
- row_packet -> result_set_memory_pool -> free_chunk (
817
- row_packet -> result_set_memory_pool , row_packet -> row_buffer .ptr );
818
- row_packet -> row_buffer .ptr = NULL ;
819
- }
820
821
MYSQLND_INC_CONN_STATISTIC (conn -> stats , STAT_ROWS_FETCHED_FROM_CLIENT_PS_CURSOR );
821
822
822
823
result -> unbuf -> row_count ++ ;
@@ -837,12 +838,14 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES * result, zval **row_ptr, const unsign
837
838
UPSERT_STATUS_SET_SERVER_STATUS (stmt -> upsert_status , row_packet -> server_status );
838
839
UPSERT_STATUS_SET_SERVER_STATUS (conn -> upsert_status , row_packet -> server_status );
839
840
841
+ mysqlnd_mempool_restore_state (result -> memory_pool );
842
+ result -> memory_pool -> checkpoint = checkpoint ;
843
+
840
844
DBG_INF_FMT ("ret=%s fetched=%u server_status=%u warnings=%u eof=%u" ,
841
845
ret == PASS ? "PASS" :"FAIL" , * fetched_anything ,
842
846
row_packet -> server_status , row_packet -> warning_count ,
843
847
result -> unbuf -> eof_reached );
844
848
DBG_RETURN (ret );
845
- return FAIL ;
846
849
}
847
850
/* }}} */
848
851
0 commit comments