Lines Matching refs:result

50 	MYSQLND_RES * result;
53 if (!stmt || !conn || !stmt->result) {
81 result = stmt->result;
82 result->type = MYSQLND_RES_PS_BUF;
83 /* result->m.row_decoder = php_mysqlnd_rowp_read_binary_protocol; */
85 result->stored_data = (MYSQLND_RES_BUFFERED *) mysqlnd_result_buffered_zval_init(result, result->field_count, TRUE);
86 if (!result->stored_data) {
91 ret = result->m.store_result_fetch_data(conn, result, result->meta, &result->stored_data->row_buffers, TRUE);
93 result->stored_data->m.fetch_row = mysqlnd_stmt_fetch_row_buffered;
96 if (result->stored_data->type == MYSQLND_BUFFERED_TYPE_ZVAL) {
97 MYSQLND_RES_BUFFERED_ZVAL * set = (MYSQLND_RES_BUFFERED_ZVAL *) result->stored_data;
98 if (result->stored_data->row_count) {
100 if (result->stored_data->row_count * result->meta->field_count * sizeof(zval *) > SIZE_MAX) {
105 set->data = mnd_emalloc((size_t)(result->stored_data->row_count * result->meta->field_count * sizeof(zval)));
110 memset(set->data, 0, (size_t)(result->stored_data->row_count * result->meta->field_count * sizeof(zval)));
114 } else if (result->stored_data->type == MYSQLND_BUFFERED_TYPE_ZVAL) {
119 UPSERT_STATUS_SET_AFFECTED_ROWS(stmt->upsert_status, stmt->result->stored_data->row_count);
123 COPY_CLIENT_ERROR(conn->error_info, result->stored_data->error_info);
124 stmt->result->m.free_result_contents(stmt->result);
125 stmt->result = NULL;
129 DBG_RETURN(result);
140 MYSQLND_RES * result;
143 if (!stmt || !conn || !stmt->result) {
169 result = conn->m->result_init(stmt->result->field_count);
170 if (!result) {
175 result->meta = stmt->result->meta->m->clone_metadata(result, stmt->result->meta);
176 if (!result->meta) {
181 if ((result = result->m.store_result(result, conn, MYSQLND_STORE_PS | MYSQLND_STORE_NO_COPY))) {
182 UPSERT_STATUS_SET_AFFECTED_ROWS(stmt->upsert_status, result->stored_data->row_count);
184 result->type = MYSQLND_RES_PS_BUF;
190 DBG_RETURN(result);
193 if (result) {
194 result->m.free_result(result, TRUE);
222 if (!stmt || !conn || !stmt->result) {
233 /* Free space for next result */
341 if (stmt->result) {
342 stmt->result->m.free_result_contents(stmt->result);
387 /* Do implicit use_result and then flush the result */
392 if (stmt->state > MYSQLND_STMT_WAITING_USE_OR_STORE && stmt->result) {
393 stmt->result->m.skip_result(stmt->result);
429 Read metadata only if there is actual result set.
434 MYSQLND_RES * result = conn->m->result_init(stmt_to_prepare->field_count);
435 if (!result) {
439 /* Allocate the result now as it is needed for the reading of metadata */
440 stmt_to_prepare->result = result;
442 result->conn = conn->m->get_reference(conn);
444 result->type = MYSQLND_RES_PS_BUF;
446 if (FAIL == result->m.read_result_metadata(result, conn) ||
529 stmt->result->type = MYSQLND_RES_PS_BUF;
530 if (!stmt->result->conn) {
533 a result set at prepare and thus a connection was missing
535 stmt->result->conn = conn->m->get_reference(conn);
539 stmt->field_count = stmt->result->field_count = conn->field_count;
540 if (stmt->result->stored_data) {
541 stmt->result->stored_data->lengths = NULL;
542 } else if (stmt->result->unbuf) {
543 stmt->result->unbuf->lengths = NULL;
568 This is a single-row result set, a result set with no rows, EXPLAIN,
571 network or b) is more efficient if all (few) result set rows are
589 /* OUT params result set. Skip for now to retain compatibility */
641 if (stmt->result && stmt->state >= MYSQLND_STMT_PREPARED && stmt->field_count) {
649 stmt->result->m.free_result_buffers(stmt->result);
710 mysqlnd_stmt_fetch_row_buffered(MYSQLND_RES * result, void * param, const unsigned int flags, zend_bool * fetched_anything)
714 const MYSQLND_RES_METADATA * const meta = result->meta;
722 if (result->stored_data->type == MYSQLND_BUFFERED_TYPE_ZVAL) {
723 MYSQLND_RES_BUFFERED_ZVAL * set = (MYSQLND_RES_BUFFERED_ZVAL *) result->stored_data;
725 (set->data_cursor - set->data) < (result->stored_data->row_count * field_count))
734 enum_func_status rc = result->stored_data->m.row_decoder(&result->stored_data->row_buffers[row_num],
738 result->conn->options->int_and_float_native,
739 result->conn->stats);
743 result->stored_data->initialized_rows++;
745 for (i = 0; i < result->field_count; i++) {
761 for (i = 0; i < result->field_count; i++) {
772 /* buffered result sets don't have a connection */
779 } else if (result->stored_data->type == MYSQLND_BUFFERED_TYPE_C) {
790 mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES * result, void * param, const unsigned int flags, zend_bool * fetched_anything)
796 MYSQLND_CONN_DATA * conn = result->conn;
797 const MYSQLND_RES_METADATA * const meta = result->meta;
804 if (result->unbuf->eof_reached) {
814 if (!(row_packet = result->unbuf->row_packet)) {
821 checkpoint = result->memory_pool->checkpoint;
822 mysqlnd_mempool_save_state(result->memory_pool);
826 result->unbuf->m.free_last_data() before it. The function returns always true.
829 unsigned int i, field_count = result->field_count;
832 result->unbuf->m.free_last_data(result->unbuf, conn->stats);
834 result->unbuf->last_row_data = row_packet->fields;
835 result->unbuf->last_row_buffer = row_packet->row_buffer;
839 if (PASS != result->unbuf->m.row_decoder(&result->unbuf->last_row_buffer,
840 result->unbuf->last_row_data,
846 mysqlnd_mempool_restore_state(result->memory_pool);
847 result->memory_pool->checkpoint = checkpoint;
854 zval *data = &result->unbuf->last_row_data[i];
869 Data has been allocated and usually result->unbuf->m.free_last_data()
879 result->unbuf->row_count++;
887 result->unbuf->eof_reached = TRUE; /* so next time we won't get an error */
891 result->unbuf->eof_reached = TRUE;
897 result->row_packet will be cleaned when
898 destroying the result object
907 mysqlnd_mempool_restore_state(result->memory_pool);
908 result->memory_pool->checkpoint = checkpoint;
922 MYSQLND_RES * result;
925 if (!stmt || !conn || !stmt->result) {
943 result = stmt->result;
945 result->m.use_result(stmt->result, TRUE);
946 result->unbuf->m.fetch_row = stmt->cursor_exists? mysqlnd_fetch_stmt_row_cursor:
950 DBG_INF_FMT("%p", result);
951 DBG_RETURN(result);
958 mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES * result, void * param, const unsigned int flags, zend_bool * fetched_anything)
969 if (!stmt || !stmt->conn || !result || !result->conn || !result->unbuf) {
981 if (!(row_packet = result->unbuf->row_packet)) {
1006 const MYSQLND_RES_METADATA * const meta = result->meta;
1007 unsigned int i, field_count = result->field_count;
1010 result->unbuf->m.free_last_data(result->unbuf, conn->stats);
1012 result->unbuf->last_row_data = row_packet->fields;
1013 result->unbuf->last_row_buffer = row_packet->row_buffer;
1017 if (PASS != result->unbuf->m.row_decoder(&result->unbuf->last_row_buffer,
1018 result->unbuf->last_row_data,
1027 /* If no result bind, do nothing. We consumed the data */
1031 zval *data = &result->unbuf->last_row_data[i];
1050 Data has been allocated and usually result->unbuf->m.free_last_data()
1068 result->unbuf->row_count++;
1078 result->unbuf->eof_reached = row_packet->eof;
1089 result->unbuf->eof_reached);
1108 if (!stmt->result || stmt->state < MYSQLND_STMT_WAITING_USE_OR_STORE) {
1122 ret = stmt->result->m.fetch_row(stmt->result, (void*)s, 0, fetched_anything);
1161 Don't free now, let the result be usable. When the stmt will again be
1162 executed then the result set will be cleaned, the bound variables will
1204 DBG_INF("fetching result set header");
1209 if (stmt->result) {
1210 DBG_INF("skipping result");
1211 stmt->result->m.skip_result(stmt->result);
1360 There is already result bound.
1366 Switching from bind_one_parameter to bind_parameters may result in zv being NULL
1512 DBG_ERR("no result bind passed");
1618 return stmt && stmt->result? mysqlnd_num_rows(stmt->result):0;
1698 return stmt && stmt->result? stmt->result->m.seek_data(stmt->result, row) : FAIL;
1730 if (!stmt->field_count || !stmt->result || !stmt->result->meta) {
1735 if (stmt->update_max_length && stmt->result->stored_data) {
1736 /* stored result, we have to update the max_length before we clone the meta data :( */
1737 stmt->result->stored_data->m.initialize_result_set_rest(stmt->result->stored_data,
1738 stmt->result->meta,
1745 fuses to check for result->m.fetch_row() being NULL. This should
1759 result_meta->meta = stmt->result->meta->m->clone_metadata(result_meta, stmt->result->meta);
1864 /* free_result() doesn't actually free stmt->result but only the buffers */
1878 if (!stmt->result) {
1879 DBG_INF("no result");
1888 DBG_INF("fetching result set header");
1889 /* Do implicit use_result and then flush the result */
1895 DBG_INF("skipping result");
1897 stmt->result->m.skip_result(stmt->result);
1899 Separate the bound variables, which point to the result set, then
1904 /* Now we can destroy the result set */
1905 stmt->result->m.free_result_buffers(stmt->result);
2002 First separate the bound variables, which point to the result set, then
2006 /* Not every statement has a result set attached */
2007 if (stmt->result) {
2008 stmt->result->m.free_result_internal(stmt->result);
2009 stmt->result = NULL;
2078 DBG_INF("fetching result set header");
2084 if (stmt->result) {
2085 DBG_INF("skipping result");
2086 stmt->result->m.skip_result(stmt->result);
2090 After this point we are allowed to free the result set,