Lines Matching refs:result

32 MYSQLND_METHOD(mysqlnd_result_unbuffered, free_result)(MYSQLND_RES_UNBUFFERED * const result, MYSQL…  in MYSQLND_METHOD()
37 if (result->row_packet) { in MYSQLND_METHOD()
38 PACKET_FREE(result->row_packet); in MYSQLND_METHOD()
39 mnd_efree(result->row_packet); in MYSQLND_METHOD()
40 result->row_packet = NULL; in MYSQLND_METHOD()
47 static void mysqlnd_result_free_prev_data(MYSQLND_RES *result) in mysqlnd_result_free_prev_data() argument
49 if (result->free_row_data) { in mysqlnd_result_free_prev_data()
50 for (unsigned i = 0; i < result->field_count; ++i) { in mysqlnd_result_free_prev_data()
51 zval_ptr_dtor_nogc(&result->row_data[i]); in mysqlnd_result_free_prev_data()
53 result->free_row_data = 0; in mysqlnd_result_free_prev_data()
79 MYSQLND_METHOD(mysqlnd_res, free_result_buffers)(MYSQLND_RES * result) in MYSQLND_METHOD()
82 DBG_INF_FMT("%s", result->unbuf? "unbuffered":(result->stored_data? "buffered":"unknown")); in MYSQLND_METHOD()
84 mysqlnd_result_free_prev_data(result); in MYSQLND_METHOD()
86 if (result->meta) { in MYSQLND_METHOD()
87 ZEND_ASSERT(zend_arena_contains(result->memory_pool->arena, result->meta)); in MYSQLND_METHOD()
88 result->meta->m->free_metadata(result->meta); in MYSQLND_METHOD()
89 result->meta = NULL; in MYSQLND_METHOD()
92 if (result->unbuf) { in MYSQLND_METHOD()
93 result->unbuf->m.free_result(result->unbuf, result->conn? result->conn->stats : NULL); in MYSQLND_METHOD()
94 result->unbuf = NULL; in MYSQLND_METHOD()
95 } else if (result->stored_data) { in MYSQLND_METHOD()
96 result->stored_data->m.free_result(result->stored_data); in MYSQLND_METHOD()
97 result->stored_data = NULL; in MYSQLND_METHOD()
100 mysqlnd_mempool_restore_state(result->memory_pool); in MYSQLND_METHOD()
101 mysqlnd_mempool_save_state(result->memory_pool); in MYSQLND_METHOD()
110 void MYSQLND_METHOD(mysqlnd_res, free_result_contents_internal)(MYSQLND_RES * result) in MYSQLND_METHOD()
114 result->m.free_result_buffers(result); in MYSQLND_METHOD()
116 if (result->conn) { in MYSQLND_METHOD()
117 result->conn->m->free_reference(result->conn); in MYSQLND_METHOD()
118 result->conn = NULL; in MYSQLND_METHOD()
121 mysqlnd_mempool_destroy(result->memory_pool); in MYSQLND_METHOD()
130 MYSQLND_METHOD(mysqlnd_res, read_result_metadata)(MYSQLND_RES * result, MYSQLND_CONN_DATA * conn) in MYSQLND_METHOD()
140 if (result->meta) { in MYSQLND_METHOD()
141 result->meta->m->free_metadata(result->meta); in MYSQLND_METHOD()
142 result->meta = NULL; in MYSQLND_METHOD()
145 result->meta = result->m.result_meta_init(result, result->field_count); in MYSQLND_METHOD()
150 if (FAIL == result->meta->m->read_metadata(result->meta, conn, result)) { in MYSQLND_METHOD()
151 result->meta->m->free_metadata(result->meta); in MYSQLND_METHOD()
152 result->meta = NULL; in MYSQLND_METHOD()
156 result->field_count = result->meta->field_count; in MYSQLND_METHOD()
250 MYSQLND_RES * result; in mysqlnd_query_read_result_set_header() local
266 result = conn->current_result = conn->m->result_init(rset_header.field_count); in mysqlnd_query_read_result_set_header()
268 if (!stmt->result) { in mysqlnd_query_read_result_set_header()
275 result = stmt->result = conn->m->result_init(rset_header.field_count); in mysqlnd_query_read_result_set_header()
289 if (rset_header.field_count != stmt->result->field_count) { in mysqlnd_query_read_result_set_header()
290 stmt->result->m.free_result(stmt->result, TRUE); in mysqlnd_query_read_result_set_header()
291 stmt->result = conn->m->result_init(rset_header.field_count); in mysqlnd_query_read_result_set_header()
293 result = stmt->result; in mysqlnd_query_read_result_set_header()
296 if (!result) { in mysqlnd_query_read_result_set_header()
302 if (FAIL == (ret = result->m.read_result_metadata(result, conn))) { in mysqlnd_query_read_result_set_header()
316 result->m.free_result_contents(result); in mysqlnd_query_read_result_set_header()
320 stmt->result = NULL; in mysqlnd_query_read_result_set_header()
370 MYSQLND_METHOD(mysqlnd_result_buffered, fetch_lengths)(const MYSQLND_RES_BUFFERED * const result) in MYSQLND_METHOD()
374 if (result->current_row > result->row_count || result->current_row == 0) { in MYSQLND_METHOD()
379 DBG_RETURN(result->lengths); in MYSQLND_METHOD()
386 …SQLND_METHOD(mysqlnd_result_unbuffered, fetch_lengths)(const MYSQLND_RES_UNBUFFERED * const result) in MYSQLND_METHOD()
389 return (result->last_row_buffer.ptr || result->eof_reached)? result->lengths : NULL; in MYSQLND_METHOD()
396 MYSQLND_METHOD(mysqlnd_res, fetch_lengths)(const MYSQLND_RES * const result) in MYSQLND_METHOD()
400 ret = result->stored_data && result->stored_data->m.fetch_lengths ? in MYSQLND_METHOD()
401 result->stored_data->m.fetch_lengths(result->stored_data) : in MYSQLND_METHOD()
402 (result->unbuf && result->unbuf->m.fetch_lengths ? in MYSQLND_METHOD()
403 result->unbuf->m.fetch_lengths(result->unbuf) : in MYSQLND_METHOD()
413 MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row)(MYSQLND_RES * result, zval **row_ptr, const un… in MYSQLND_METHOD()
416 MYSQLND_PACKET_ROW *row_packet = result->unbuf->row_packet; in MYSQLND_METHOD()
417 const MYSQLND_RES_METADATA * const meta = result->meta; in MYSQLND_METHOD()
418 MYSQLND_RES_UNBUFFERED *set = result->unbuf; in MYSQLND_METHOD()
419 MYSQLND_CONN_DATA * const conn = result->conn; in MYSQLND_METHOD()
438 checkpoint = result->memory_pool->checkpoint; in MYSQLND_METHOD()
439 mysqlnd_mempool_save_state(result->memory_pool); in MYSQLND_METHOD()
452 *row_ptr = result->row_data; in MYSQLND_METHOD()
454 &set->last_row_buffer, result->row_data, field_count, in MYSQLND_METHOD()
457 mysqlnd_mempool_restore_state(result->memory_pool); in MYSQLND_METHOD()
458 result->memory_pool->checkpoint = checkpoint; in MYSQLND_METHOD()
465 zval *data = &result->row_data[i]; in MYSQLND_METHOD()
503 mysqlnd_mempool_restore_state(result->memory_pool); in MYSQLND_METHOD()
504 result->memory_pool->checkpoint = checkpoint; in MYSQLND_METHOD()
514 MYSQLND_METHOD(mysqlnd_res, use_result)(MYSQLND_RES * const result, MYSQLND_STMT_DATA *stmt) in MYSQLND_METHOD()
516 MYSQLND_CONN_DATA * const conn = result->conn; in MYSQLND_METHOD()
522 result->type = MYSQLND_RES_NORMAL; in MYSQLND_METHOD()
524 result->type = MYSQLND_RES_PS_UNBUF; in MYSQLND_METHOD()
527 result->unbuf = mysqlnd_result_unbuffered_init(result, result->field_count, stmt); in MYSQLND_METHOD()
539 row_packet->result_set_memory_pool = result->unbuf->result_set_memory_pool; in MYSQLND_METHOD()
540 row_packet->field_count = result->field_count; in MYSQLND_METHOD()
542 row_packet->fields_metadata = result->meta->fields; in MYSQLND_METHOD()
544 result->unbuf->row_packet = row_packet; in MYSQLND_METHOD()
547 DBG_RETURN(result); in MYSQLND_METHOD()
554 MYSQLND_METHOD(mysqlnd_result_buffered, fetch_row)(MYSQLND_RES * result, zval **row_ptr, const unsi… in MYSQLND_METHOD()
556 MYSQLND_RES_BUFFERED *set = result->stored_data; in MYSQLND_METHOD()
563 const MYSQLND_RES_METADATA * const meta = result->meta; in MYSQLND_METHOD()
565 MYSQLND_CONN_DATA * const conn = result->conn; in MYSQLND_METHOD()
567 zval *current_row = result->row_data; in MYSQLND_METHOD()
568 *row_ptr = result->row_data; in MYSQLND_METHOD()
569 rc = result->stored_data->m.row_decoder(&set->row_buffers[set->current_row], in MYSQLND_METHOD()
607 MYSQLND_METHOD(mysqlnd_res, fetch_row)(MYSQLND_RES *result, zval **row_ptr, const unsigned int flag… in MYSQLND_METHOD()
610 result->stored_data ? result->stored_data->m.fetch_row : in MYSQLND_METHOD()
611 result->unbuf ? result->unbuf->m.fetch_row : NULL; in MYSQLND_METHOD()
613 return f(result, row_ptr, flags, fetched_anything); in MYSQLND_METHOD()
623 …_METHOD(mysqlnd_res, store_result_fetch_data)(MYSQLND_CONN_DATA * const conn, MYSQLND_RES * result, in MYSQLND_METHOD()
631 MYSQLND_RES_BUFFERED * set = result->stored_data; in MYSQLND_METHOD()
645 row_packet.result_set_memory_pool = result->stored_data->result_set_memory_pool; in MYSQLND_METHOD()
747 MYSQLND_METHOD(mysqlnd_res, store_result)(MYSQLND_RES * result, in MYSQLND_METHOD()
758 result->conn = conn->m->get_reference(conn); in MYSQLND_METHOD()
759 result->type = MYSQLND_RES_NORMAL; in MYSQLND_METHOD()
763result->stored_data = (MYSQLND_RES_BUFFERED *) mysqlnd_result_buffered_init(result, result->field_… in MYSQLND_METHOD()
764 row_buffers = &result->stored_data->row_buffers; in MYSQLND_METHOD()
766 ret = result->m.store_result_fetch_data(conn, result, result->meta, row_buffers, stmt != NULL); in MYSQLND_METHOD()
769 if (result->stored_data) { in MYSQLND_METHOD()
770 COPY_CLIENT_ERROR(conn->error_info, result->stored_data->error_info); in MYSQLND_METHOD()
776 result->stored_data->current_row = 0; in MYSQLND_METHOD()
780 UPSERT_STATUS_SET_AFFECTED_ROWS(conn->upsert_status, result->stored_data->row_count); in MYSQLND_METHOD()
782 DBG_RETURN(result); in MYSQLND_METHOD()
789 MYSQLND_METHOD(mysqlnd_res, skip_result)(MYSQLND_RES * const result) in MYSQLND_METHOD()
799 if (result->unbuf && !result->unbuf->eof_reached) { in MYSQLND_METHOD()
800 MYSQLND_CONN_DATA * const conn = result->conn; in MYSQLND_METHOD()
804 result->type == MYSQLND_RES_NORMAL? STAT_FLUSHED_NORMAL_SETS: in MYSQLND_METHOD()
807 …while ((PASS == result->m.fetch_row(result, NULL, 0, &fetched_anything)) && fetched_anything == TR… in MYSQLND_METHOD()
809 result->type == MYSQLND_RES_NORMAL in MYSQLND_METHOD()
820 MYSQLND_METHOD(mysqlnd_res, free_result)(MYSQLND_RES * result, const bool implicit) in MYSQLND_METHOD()
824 MYSQLND_INC_CONN_STATISTIC(result->conn? result->conn->stats : NULL, in MYSQLND_METHOD()
828 result->m.skip_result(result); in MYSQLND_METHOD()
829 result->m.free_result_contents(result); in MYSQLND_METHOD()
837 MYSQLND_METHOD(mysqlnd_res, data_seek)(MYSQLND_RES * const result, const uint64_t row) in MYSQLND_METHOD()
842 DBG_RETURN(result->stored_data? result->stored_data->m.data_seek(result->stored_data, row) : FAIL); in MYSQLND_METHOD()
849 MYSQLND_METHOD(mysqlnd_result_buffered, data_seek)(MYSQLND_RES_BUFFERED * const result, const uint6… in MYSQLND_METHOD()
854 if (row >= result->row_count) { in MYSQLND_METHOD()
855 result->current_row = result->row_count; in MYSQLND_METHOD()
857 result->current_row = row; in MYSQLND_METHOD()
866 MYSQLND_METHOD(mysqlnd_result_unbuffered, num_rows)(const MYSQLND_RES_UNBUFFERED * const result) in MYSQLND_METHOD()
869 return result->eof_reached? result->row_count : 0; in MYSQLND_METHOD()
876 MYSQLND_METHOD(mysqlnd_result_buffered, num_rows)(const MYSQLND_RES_BUFFERED * const result) in MYSQLND_METHOD()
878 return result->row_count; in MYSQLND_METHOD()
885 MYSQLND_METHOD(mysqlnd_res, num_rows)(const MYSQLND_RES * const result) in MYSQLND_METHOD()
887 return result->stored_data? in MYSQLND_METHOD()
888 result->stored_data->m.num_rows(result->stored_data) : in MYSQLND_METHOD()
889 (result->unbuf? result->unbuf->m.num_rows(result->unbuf) : 0); in MYSQLND_METHOD()
896 MYSQLND_METHOD(mysqlnd_res, num_fields)(const MYSQLND_RES * const result) in MYSQLND_METHOD()
898 return result->field_count; in MYSQLND_METHOD()
905 MYSQLND_METHOD(mysqlnd_res, fetch_field)(MYSQLND_RES * const result) in MYSQLND_METHOD()
909 if (result->meta) { in MYSQLND_METHOD()
910 DBG_RETURN(result->meta->m->fetch_field(result->meta)); in MYSQLND_METHOD()
920 MYSQLND_METHOD(mysqlnd_res, fetch_field_direct)(MYSQLND_RES * const result, const MYSQLND_FIELD_OFF… in MYSQLND_METHOD()
924 if (result->meta) { in MYSQLND_METHOD()
925 DBG_RETURN(result->meta->m->fetch_field_direct(result->meta, fieldnr)); in MYSQLND_METHOD()
936 MYSQLND_METHOD(mysqlnd_res, fetch_fields)(MYSQLND_RES * const result) in MYSQLND_METHOD()
940 if (result->meta) { in MYSQLND_METHOD()
941 DBG_RETURN(result->meta->m->fetch_fields(result->meta)); in MYSQLND_METHOD()
951 MYSQLND_METHOD(mysqlnd_res, field_seek)(MYSQLND_RES * const result, const MYSQLND_FIELD_OFFSET fiel… in MYSQLND_METHOD()
953 return result->meta? result->meta->m->field_seek(result->meta, field_offset) : 0; in MYSQLND_METHOD()
960 MYSQLND_METHOD(mysqlnd_res, field_tell)(const MYSQLND_RES * const result) in MYSQLND_METHOD()
962 return result->meta? result->meta->m->field_tell(result->meta) : 0; in MYSQLND_METHOD()
969 MYSQLND_METHOD(mysqlnd_res, fetch_into)(MYSQLND_RES * result, const unsigned int flags, in MYSQLND_METHOD()
977 MYSQLND_CONN_DATA *conn = result->conn; in MYSQLND_METHOD()
983 if (FAIL == result->m.fetch_row(result, &row_data, flags, &fetched_anything)) { in MYSQLND_METHOD()
991 const MYSQLND_RES_METADATA * const meta = result->meta; in MYSQLND_METHOD()
1033 MYSQLND_METHOD(mysqlnd_res, fetch_row_c)(MYSQLND_RES * result) in MYSQLND_METHOD()
1040 mysqlnd_result_free_prev_data(result); in MYSQLND_METHOD()
1041 if (result->m.fetch_row(result, &row_data, 0, &fetched_anything) == PASS && fetched_anything) { in MYSQLND_METHOD()
1042 unsigned field_count = result->field_count; in MYSQLND_METHOD()
1043 MYSQLND_FIELD *field = result->meta->fields; in MYSQLND_METHOD()
1055 result->free_row_data = 1; in MYSQLND_METHOD()
1145 mysqlnd_result_unbuffered_init(MYSQLND_RES *result, const unsigned int field_count, MYSQLND_STMT_DA… in mysqlnd_result_unbuffered_init() argument
1148 MYSQLND_MEMORY_POOL * pool = result->memory_pool; in mysqlnd_result_unbuffered_init()
1180 mysqlnd_result_buffered_init(MYSQLND_RES * result, const unsigned int field_count, MYSQLND_STMT_DAT… in mysqlnd_result_buffered_init() argument
1183 MYSQLND_MEMORY_POOL * pool = result->memory_pool; in mysqlnd_result_buffered_init()