Lines Matching refs:stmt

42 static void mysqlnd_stmt_separate_result_bind(MYSQLND_STMT * const stmt TSRMLS_DC);
43 static void mysqlnd_stmt_separate_one_result_bind(MYSQLND_STMT * const stmt, unsigned int param_no …
49 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
55 if (!stmt || !stmt->conn || !stmt->result) { in MYSQLND_METHOD()
58 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
60 conn = stmt->conn; in MYSQLND_METHOD()
63 if (!stmt->field_count) { in MYSQLND_METHOD()
67 if (stmt->cursor_exists) { in MYSQLND_METHOD()
74 stmt->state != MYSQLND_STMT_WAITING_USE_OR_STORE) in MYSQLND_METHOD()
81 stmt->default_rset_handler = s->m->store_result; in MYSQLND_METHOD()
83 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
87 result = stmt->result; in MYSQLND_METHOD()
126 stmt->upsert_status->affected_rows = stmt->result->stored_data->row_count; in MYSQLND_METHOD()
128 stmt->state = MYSQLND_STMT_USE_OR_STORE_CALLED; in MYSQLND_METHOD()
131 stmt->result->m.free_result_contents(stmt->result TSRMLS_CC); in MYSQLND_METHOD()
132 mnd_efree(stmt->result); in MYSQLND_METHOD()
133 stmt->result = NULL; in MYSQLND_METHOD()
134 stmt->state = MYSQLND_STMT_PREPARED; in MYSQLND_METHOD()
146 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
151 if (!stmt || !stmt->conn || !stmt->result) { in MYSQLND_METHOD()
154 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
156 conn = stmt->conn; in MYSQLND_METHOD()
159 if (!stmt->field_count) { in MYSQLND_METHOD()
163 if (stmt->cursor_exists) { in MYSQLND_METHOD()
169 …if (CONN_GET_STATE(conn) != CONN_FETCHING_DATA || stmt->state != MYSQLND_STMT_WAITING_USE_OR_STORE… in MYSQLND_METHOD()
175 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
180 result = conn->m->result_init(stmt->result->field_count, stmt->persistent TSRMLS_CC); in MYSQLND_METHOD()
186 result->meta = stmt->result->meta->m->clone_metadata(stmt->result->meta, FALSE TSRMLS_CC); in MYSQLND_METHOD()
193 stmt->upsert_status->affected_rows = result->stored_data->row_count; in MYSQLND_METHOD()
194 stmt->state = MYSQLND_STMT_PREPARED; in MYSQLND_METHOD()
197 COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info); in MYSQLND_METHOD()
198 stmt->state = MYSQLND_STMT_PREPARED; in MYSQLND_METHOD()
216 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
219 …DBG_RETURN((stmt && stmt->conn && (stmt->conn->m->get_server_status(stmt->conn TSRMLS_CC) & SERVER… in MYSQLND_METHOD()
230 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
234 if (!stmt || !stmt->conn || !stmt->result) { in MYSQLND_METHOD()
237 conn = stmt->conn; in MYSQLND_METHOD()
238 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
244 …DBG_INF_FMT("server_status=%u cursor=%u", stmt->upsert_status->server_status, stmt->upsert_status-… in MYSQLND_METHOD()
260 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in mysqlnd_stmt_skip_metadata() local
267 if (!stmt || !stmt->conn || !stmt->conn->protocol) { in mysqlnd_stmt_skip_metadata()
270 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in mysqlnd_stmt_skip_metadata()
272 …field_packet = stmt->conn->protocol->m.get_result_field_packet(stmt->conn->protocol, FALSE TSRMLS_… in mysqlnd_stmt_skip_metadata()
274 SET_OOM_ERROR(*stmt->error_info); in mysqlnd_stmt_skip_metadata()
275 SET_OOM_ERROR(*stmt->conn->error_info); in mysqlnd_stmt_skip_metadata()
279 for (;i < stmt->param_count; i++) { in mysqlnd_stmt_skip_metadata()
280 if (FAIL == PACKET_READ(field_packet, stmt->conn)) { in mysqlnd_stmt_skip_metadata()
297 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in mysqlnd_stmt_read_prepare_response() local
302 if (!stmt || !stmt->conn || !stmt->conn->protocol) { in mysqlnd_stmt_read_prepare_response()
305 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in mysqlnd_stmt_read_prepare_response()
307 …prepare_resp = stmt->conn->protocol->m.get_prepare_response_packet(stmt->conn->protocol, FALSE TSR… in mysqlnd_stmt_read_prepare_response()
309 SET_OOM_ERROR(*stmt->error_info); in mysqlnd_stmt_read_prepare_response()
310 SET_OOM_ERROR(*stmt->conn->error_info); in mysqlnd_stmt_read_prepare_response()
314 if (FAIL == PACKET_READ(prepare_resp, stmt->conn)) { in mysqlnd_stmt_read_prepare_response()
319 COPY_CLIENT_ERROR(*stmt->error_info, prepare_resp->error_info); in mysqlnd_stmt_read_prepare_response()
320 COPY_CLIENT_ERROR(*stmt->conn->error_info, prepare_resp->error_info); in mysqlnd_stmt_read_prepare_response()
324 stmt->stmt_id = prepare_resp->stmt_id; in mysqlnd_stmt_read_prepare_response()
325 stmt->warning_count = stmt->conn->upsert_status->warning_count = prepare_resp->warning_count; in mysqlnd_stmt_read_prepare_response()
326 stmt->field_count = stmt->conn->field_count = prepare_resp->field_count; in mysqlnd_stmt_read_prepare_response()
327 stmt->param_count = prepare_resp->param_count; in mysqlnd_stmt_read_prepare_response()
328 stmt->upsert_status->affected_rows = 0; /* be like libmysql */ in mysqlnd_stmt_read_prepare_response()
341 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in mysqlnd_stmt_prepare_read_eof() local
346 if (!stmt || !stmt->conn || !stmt->conn->protocol) { in mysqlnd_stmt_prepare_read_eof()
349 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in mysqlnd_stmt_prepare_read_eof()
351 fields_eof = stmt->conn->protocol->m.get_eof_packet(stmt->conn->protocol, FALSE TSRMLS_CC); in mysqlnd_stmt_prepare_read_eof()
353 SET_OOM_ERROR(*stmt->error_info); in mysqlnd_stmt_prepare_read_eof()
354 SET_OOM_ERROR(*stmt->conn->error_info); in mysqlnd_stmt_prepare_read_eof()
356 if (FAIL == (ret = PACKET_READ(fields_eof, stmt->conn))) { in mysqlnd_stmt_prepare_read_eof()
357 if (stmt->result) { in mysqlnd_stmt_prepare_read_eof()
358 stmt->result->m.free_result_contents(stmt->result TSRMLS_CC); in mysqlnd_stmt_prepare_read_eof()
359 mnd_efree(stmt->result); in mysqlnd_stmt_prepare_read_eof()
360 memset(stmt, 0, sizeof(MYSQLND_STMT_DATA)); in mysqlnd_stmt_prepare_read_eof()
361 stmt->state = MYSQLND_STMT_INITTED; in mysqlnd_stmt_prepare_read_eof()
364 stmt->upsert_status->server_status = fields_eof->server_status; in mysqlnd_stmt_prepare_read_eof()
365 stmt->upsert_status->warning_count = fields_eof->warning_count; in mysqlnd_stmt_prepare_read_eof()
366 stmt->state = MYSQLND_STMT_PREPARED; in mysqlnd_stmt_prepare_read_eof()
380 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
382 MYSQLND_STMT_DATA * stmt_to_prepare = stmt; in MYSQLND_METHOD()
385 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
388 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
391 SET_ERROR_AFF_ROWS(stmt); in MYSQLND_METHOD()
392 SET_ERROR_AFF_ROWS(stmt->conn); in MYSQLND_METHOD()
394 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
395 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
397 if (stmt->state > MYSQLND_STMT_INITTED) { in MYSQLND_METHOD()
399 if (stmt->state == MYSQLND_STMT_WAITING_USE_OR_STORE) { in MYSQLND_METHOD()
401 stmt->default_rset_handler = s->m->use_result; in MYSQLND_METHOD()
402 stmt->default_rset_handler(s TSRMLS_CC); in MYSQLND_METHOD()
405 if (stmt->state > MYSQLND_STMT_WAITING_USE_OR_STORE && stmt->result) { in MYSQLND_METHOD()
406 stmt->result->m.skip_result(stmt->result TSRMLS_CC); in MYSQLND_METHOD()
412 s_to_prepare = stmt->conn->m->stmt_init(stmt->conn TSRMLS_CC); in MYSQLND_METHOD()
439 …MYSQLND_RES * result = stmt->conn->m->result_init(stmt_to_prepare->field_count, stmt_to_prepare->p… in MYSQLND_METHOD()
441 SET_OOM_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
458 if (stmt_to_prepare != stmt) { in MYSQLND_METHOD()
468 stmt_to_prepare = stmt; in MYSQLND_METHOD()
469 stmt = tmp_swap_data; in MYSQLND_METHOD()
473 stmt->state = MYSQLND_STMT_PREPARED; in MYSQLND_METHOD()
478 if (stmt_to_prepare != stmt && s_to_prepare) { in MYSQLND_METHOD()
481 stmt->state = MYSQLND_STMT_INITTED; in MYSQLND_METHOD()
493 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in mysqlnd_stmt_execute_parse_response() local
498 if (!stmt || !stmt->conn) { in mysqlnd_stmt_execute_parse_response()
501 conn = stmt->conn; in mysqlnd_stmt_execute_parse_response()
504 ret = mysqlnd_query_read_result_set_header(stmt->conn, s TSRMLS_CC); in mysqlnd_stmt_execute_parse_response()
506 COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info); in mysqlnd_stmt_execute_parse_response()
507 memset(stmt->upsert_status, 0, sizeof(*stmt->upsert_status)); in mysqlnd_stmt_execute_parse_response()
508 stmt->upsert_status->affected_rows = conn->upsert_status->affected_rows; in mysqlnd_stmt_execute_parse_response()
512 stmt->state = MYSQLND_STMT_PREPARED; in mysqlnd_stmt_execute_parse_response()
513 stmt->send_types_to_server = 1; in mysqlnd_stmt_execute_parse_response()
522 SET_EMPTY_ERROR(*stmt->error_info); in mysqlnd_stmt_execute_parse_response()
523 SET_EMPTY_ERROR(*stmt->conn->error_info); in mysqlnd_stmt_execute_parse_response()
524 *stmt->upsert_status = *conn->upsert_status; /* copy status */ in mysqlnd_stmt_execute_parse_response()
525 stmt->state = MYSQLND_STMT_EXECUTED; in mysqlnd_stmt_execute_parse_response()
531 stmt->result->type = MYSQLND_RES_PS_BUF; in mysqlnd_stmt_execute_parse_response()
532 if (!stmt->result->conn) { in mysqlnd_stmt_execute_parse_response()
537 stmt->result->conn = stmt->conn->m->get_reference(stmt->conn TSRMLS_CC); in mysqlnd_stmt_execute_parse_response()
541 stmt->field_count = stmt->result->field_count = conn->field_count; in mysqlnd_stmt_execute_parse_response()
542 if (stmt->result->stored_data) { in mysqlnd_stmt_execute_parse_response()
543 stmt->result->stored_data->lengths = NULL; in mysqlnd_stmt_execute_parse_response()
544 } else if (stmt->result->unbuf) { in mysqlnd_stmt_execute_parse_response()
545 stmt->result->unbuf->lengths = NULL; in mysqlnd_stmt_execute_parse_response()
547 if (stmt->field_count) { in mysqlnd_stmt_execute_parse_response()
548 stmt->state = MYSQLND_STMT_WAITING_USE_OR_STORE; in mysqlnd_stmt_execute_parse_response()
554 DBG_INF_FMT("server_status=%u cursor=%u", stmt->upsert_status->server_status, in mysqlnd_stmt_execute_parse_response()
555 stmt->upsert_status->server_status & SERVER_STATUS_CURSOR_EXISTS); in mysqlnd_stmt_execute_parse_response()
557 if (stmt->upsert_status->server_status & SERVER_STATUS_CURSOR_EXISTS) { in mysqlnd_stmt_execute_parse_response()
559 stmt->cursor_exists = TRUE; in mysqlnd_stmt_execute_parse_response()
562 stmt->default_rset_handler = s->m->use_result; in mysqlnd_stmt_execute_parse_response()
564 } else if (stmt->flags & CURSOR_TYPE_READ_ONLY) { in mysqlnd_stmt_execute_parse_response()
577 stmt->default_rset_handler = s->m->store_result; in mysqlnd_stmt_execute_parse_response()
582 stmt->default_rset_handler = s->m->use_result; in mysqlnd_stmt_execute_parse_response()
588 if (stmt->upsert_status->server_status & SERVER_PS_OUT_PARAMS) { in mysqlnd_stmt_execute_parse_response()
606 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
614 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
617 conn = stmt->conn; in MYSQLND_METHOD()
618 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
620 SET_ERROR_AFF_ROWS(stmt); in MYSQLND_METHOD()
621 SET_ERROR_AFF_ROWS(stmt->conn); in MYSQLND_METHOD()
623 if (stmt->result && stmt->state >= MYSQLND_STMT_PREPARED && stmt->field_count) { in MYSQLND_METHOD()
630 if (stmt->result_bind && in MYSQLND_METHOD()
631 stmt->result_zvals_separated_once == TRUE && in MYSQLND_METHOD()
632 stmt->state >= MYSQLND_STMT_USER_FETCHING) in MYSQLND_METHOD()
647 for (i = 0; i < stmt->field_count; i++) { in MYSQLND_METHOD()
648 if (stmt->result_bind[i].bound == TRUE) { in MYSQLND_METHOD()
649 zval_copy_ctor(stmt->result_bind[i].zv); in MYSQLND_METHOD()
662 stmt->result->m.free_result_buffers(stmt->result TSRMLS_CC); in MYSQLND_METHOD()
664 stmt->state = MYSQLND_STMT_PREPARED; in MYSQLND_METHOD()
665 } else if (stmt->state < MYSQLND_STMT_PREPARED) { in MYSQLND_METHOD()
669 SET_STMT_ERROR(stmt, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync); in MYSQLND_METHOD()
674 if (stmt->param_count) { in MYSQLND_METHOD()
676 if (!stmt->param_bind) { in MYSQLND_METHOD()
677 SET_STMT_ERROR(stmt, CR_PARAMS_NOT_BOUND, UNKNOWN_SQLSTATE, in MYSQLND_METHOD()
682 for (i = 0; i < stmt->param_count; i++) { in MYSQLND_METHOD()
683 if (stmt->param_bind[i].zv == NULL) { in MYSQLND_METHOD()
691 SET_STMT_ERROR(stmt, CR_PARAMS_NOT_BOUND, UNKNOWN_SQLSTATE, msg); in MYSQLND_METHOD()
702 ret = stmt->conn->m->simple_command(stmt->conn, COM_STMT_EXECUTE, request, request_len, in MYSQLND_METHOD()
706 …SET_STMT_ERROR(stmt, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "Couldn't generate the request. Possibly … in MYSQLND_METHOD()
714 COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info); in MYSQLND_METHOD()
718 stmt->execute_count++; in MYSQLND_METHOD()
722 …DBG_INF_FMT("server_status=%u cursor=%u", stmt->upsert_status->server_status, stmt->upsert_status-… in MYSQLND_METHOD()
724 if (ret == PASS && conn->last_query_type == QUERY_UPSERT && stmt->upsert_status->affected_rows) { in MYSQLND_METHOD()
725 …MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn->stats, STAT_ROWS_AFFECTED_PS, stmt->upsert_status->affect… in MYSQLND_METHOD()
737 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in mysqlnd_stmt_fetch_row_buffered() local
743 DBG_INF_FMT("stmt=%lu", stmt != NULL ? stmt->stmt_id : 0L); in mysqlnd_stmt_fetch_row_buffered()
752 if (stmt->result_bind) { in mysqlnd_stmt_fetch_row_buffered()
768 if (stmt->update_max_length) { in mysqlnd_stmt_fetch_row_buffered()
788 if (stmt->result_bind[i].zv) { in mysqlnd_stmt_fetch_row_buffered()
789 zval_dtor(stmt->result_bind[i].zv); in mysqlnd_stmt_fetch_row_buffered()
793 if (stmt->result_bind[i].bound == TRUE) { in mysqlnd_stmt_fetch_row_buffered()
804 Z_TYPE_P(stmt->result_bind[i].zv) = Z_TYPE_P(current_row[i]); in mysqlnd_stmt_fetch_row_buffered()
805 stmt->result_bind[i].zv->value = current_row[i]->value; in mysqlnd_stmt_fetch_row_buffered()
807 zval_copy_ctor(stmt->result_bind[i].zv); in mysqlnd_stmt_fetch_row_buffered()
810 ZVAL_NULL(stmt->result_bind[i].zv); in mysqlnd_stmt_fetch_row_buffered()
839 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in mysqlnd_stmt_fetch_row_unbuffered() local
863 row_packet->skip_extraction = stmt && stmt->result_bind? FALSE:TRUE; in mysqlnd_stmt_fetch_row_unbuffered()
891 if (stmt->result_bind[i].bound == TRUE) { in mysqlnd_stmt_fetch_row_unbuffered()
898 zval_dtor(stmt->result_bind[i].zv); in mysqlnd_stmt_fetch_row_unbuffered()
900 if (IS_NULL != (Z_TYPE_P(stmt->result_bind[i].zv) = Z_TYPE_P(data)) ) { in mysqlnd_stmt_fetch_row_unbuffered()
904 stmt->result_bind[i].zv->value = data->value; in mysqlnd_stmt_fetch_row_unbuffered()
910 MYSQLND_INC_CONN_STATISTIC(stmt->conn->stats, STAT_ROWS_FETCHED_FROM_CLIENT_PS_UNBUF); in mysqlnd_stmt_fetch_row_unbuffered()
927 COPY_CLIENT_ERROR(*stmt->conn->error_info, row_packet->error_info); in mysqlnd_stmt_fetch_row_unbuffered()
928 COPY_CLIENT_ERROR(*stmt->error_info, row_packet->error_info); in mysqlnd_stmt_fetch_row_unbuffered()
960 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
965 if (!stmt || !stmt->conn || !stmt->result) { in MYSQLND_METHOD()
968 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
970 conn = stmt->conn; in MYSQLND_METHOD()
972 if (!stmt->field_count || in MYSQLND_METHOD()
973 (!stmt->cursor_exists && CONN_GET_STATE(conn) != CONN_FETCHING_DATA) || in MYSQLND_METHOD()
974 (stmt->cursor_exists && CONN_GET_STATE(conn) != CONN_READY) || in MYSQLND_METHOD()
975 (stmt->state != MYSQLND_STMT_WAITING_USE_OR_STORE)) in MYSQLND_METHOD()
983 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
985 MYSQLND_INC_CONN_STATISTIC(stmt->conn->stats, STAT_PS_UNBUFFERED_SETS); in MYSQLND_METHOD()
986 result = stmt->result; in MYSQLND_METHOD()
988 result->m.use_result(stmt->result, TRUE TSRMLS_CC); in MYSQLND_METHOD()
989 result->unbuf->m.fetch_row = stmt->cursor_exists? mysqlnd_fetch_stmt_row_cursor: in MYSQLND_METHOD()
991 stmt->state = MYSQLND_STMT_USE_OR_STORE_CALLED; in MYSQLND_METHOD()
1007 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in mysqlnd_fetch_stmt_row_cursor() local
1013 if (!stmt || !stmt->conn || !result || !result->conn || !result->unbuf) { in mysqlnd_fetch_stmt_row_cursor()
1018 DBG_INF_FMT("stmt=%lu flags=%u", stmt->stmt_id, flags); in mysqlnd_fetch_stmt_row_cursor()
1020 if (stmt->state < MYSQLND_STMT_USER_FETCHING) { in mysqlnd_fetch_stmt_row_cursor()
1022 SET_CLIENT_ERROR(*stmt->conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, in mysqlnd_fetch_stmt_row_cursor()
1031 SET_EMPTY_ERROR(*stmt->error_info); in mysqlnd_fetch_stmt_row_cursor()
1032 SET_EMPTY_ERROR(*stmt->conn->error_info); in mysqlnd_fetch_stmt_row_cursor()
1034 int4store(buf, stmt->stmt_id); in mysqlnd_fetch_stmt_row_cursor()
1037 if (FAIL == stmt->conn->m->simple_command(stmt->conn, COM_STMT_FETCH, buf, sizeof(buf), in mysqlnd_fetch_stmt_row_cursor()
1040 COPY_CLIENT_ERROR(*stmt->error_info, *stmt->conn->error_info); in mysqlnd_fetch_stmt_row_cursor()
1044 row_packet->skip_extraction = stmt->result_bind? FALSE:TRUE; in mysqlnd_fetch_stmt_row_cursor()
1046 memset(stmt->upsert_status, 0, sizeof(*stmt->upsert_status)); in mysqlnd_fetch_stmt_row_cursor()
1071 if (stmt->result_bind[i].bound == TRUE) { in mysqlnd_fetch_stmt_row_cursor()
1078 zval_dtor(stmt->result_bind[i].zv); in mysqlnd_fetch_stmt_row_cursor()
1080 DBG_INF_FMT("i=%u bound_var=%p type=%u refc=%u", i, stmt->result_bind[i].zv, in mysqlnd_fetch_stmt_row_cursor()
1081 Z_TYPE_P(data), Z_REFCOUNT_P(stmt->result_bind[i].zv)); in mysqlnd_fetch_stmt_row_cursor()
1082 if (IS_NULL != (Z_TYPE_P(stmt->result_bind[i].zv) = Z_TYPE_P(data))) { in mysqlnd_fetch_stmt_row_cursor()
1086 stmt->result_bind[i].zv->value = data->value; in mysqlnd_fetch_stmt_row_cursor()
1109 MYSQLND_INC_CONN_STATISTIC(stmt->conn->stats, STAT_ROWS_FETCHED_FROM_CLIENT_PS_CURSOR); in mysqlnd_fetch_stmt_row_cursor()
1116 stmt->upsert_status->warning_count = in mysqlnd_fetch_stmt_row_cursor()
1117 stmt->conn->upsert_status->warning_count = in mysqlnd_fetch_stmt_row_cursor()
1120 stmt->upsert_status->server_status = in mysqlnd_fetch_stmt_row_cursor()
1121 stmt->conn->upsert_status->server_status = in mysqlnd_fetch_stmt_row_cursor()
1126 stmt->upsert_status->warning_count = in mysqlnd_fetch_stmt_row_cursor()
1127 stmt->conn->upsert_status->warning_count = in mysqlnd_fetch_stmt_row_cursor()
1129 stmt->upsert_status->server_status = in mysqlnd_fetch_stmt_row_cursor()
1130 stmt->conn->upsert_status->server_status = in mysqlnd_fetch_stmt_row_cursor()
1146 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1149 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1152 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
1154 if (!stmt->result || in MYSQLND_METHOD()
1155 stmt->state < MYSQLND_STMT_WAITING_USE_OR_STORE) { in MYSQLND_METHOD()
1156 SET_STMT_ERROR(stmt, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync); in MYSQLND_METHOD()
1160 } else if (stmt->state == MYSQLND_STMT_WAITING_USE_OR_STORE) { in MYSQLND_METHOD()
1163 stmt->default_rset_handler(s TSRMLS_CC); in MYSQLND_METHOD()
1165 stmt->state = MYSQLND_STMT_USER_FETCHING; in MYSQLND_METHOD()
1167 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
1168 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
1170 …DBG_INF_FMT("result_bind=%p separated_once=%u", stmt->result_bind, stmt->result_zvals_separated_on… in MYSQLND_METHOD()
1175 if (stmt->result_bind && !stmt->result_zvals_separated_once) { in MYSQLND_METHOD()
1181 for (i = 0; i < stmt->result->field_count; i++) { in MYSQLND_METHOD()
1182 if (stmt->result_bind[i].bound == TRUE) { in MYSQLND_METHOD()
1183 zval_dtor(stmt->result_bind[i].zv); in MYSQLND_METHOD()
1184 ZVAL_NULL(stmt->result_bind[i].zv); in MYSQLND_METHOD()
1187 stmt->result_zvals_separated_once = TRUE; in MYSQLND_METHOD()
1190 ret = stmt->result->m.fetch_row(stmt->result, (void*)s, 0, fetched_anything TSRMLS_CC); in MYSQLND_METHOD()
1200 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1205 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1208 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
1210 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
1211 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
1213 if (stmt->stmt_id) { in MYSQLND_METHOD()
1214 MYSQLND_CONN_DATA * conn = stmt->conn; in MYSQLND_METHOD()
1215 if (stmt->param_bind) { in MYSQLND_METHOD()
1219 for (i = 0; i < stmt->param_count; i++) { in MYSQLND_METHOD()
1220 if (stmt->param_bind[i].flags & MYSQLND_PARAM_BIND_BLOB_USED) { in MYSQLND_METHOD()
1221 stmt->param_bind[i].flags &= ~MYSQLND_PARAM_BIND_BLOB_USED; in MYSQLND_METHOD()
1234 int4store(cmd_buf, stmt->stmt_id); in MYSQLND_METHOD()
1239 COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info); in MYSQLND_METHOD()
1241 *stmt->upsert_status = *conn->upsert_status; in MYSQLND_METHOD()
1253 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1257 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1260 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
1262 if (stmt->stmt_id) { in MYSQLND_METHOD()
1269 if (stmt->state == MYSQLND_STMT_WAITING_USE_OR_STORE) { in MYSQLND_METHOD()
1271 stmt->default_rset_handler(s TSRMLS_CC); in MYSQLND_METHOD()
1272 stmt->state = MYSQLND_STMT_USER_FETCHING; in MYSQLND_METHOD()
1275 if (stmt->result) { in MYSQLND_METHOD()
1277 stmt->result->m.skip_result(stmt->result TSRMLS_CC); in MYSQLND_METHOD()
1292 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1299 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1302 DBG_INF_FMT("stmt=%lu param_no=%u data_len=%lu", stmt->stmt_id, param_no, length); in MYSQLND_METHOD()
1304 conn = stmt->conn; in MYSQLND_METHOD()
1306 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
1307 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
1309 if (stmt->state < MYSQLND_STMT_PREPARED) { in MYSQLND_METHOD()
1310 SET_STMT_ERROR(stmt, CR_NO_PREPARE_STMT, UNKNOWN_SQLSTATE, mysqlnd_stmt_not_prepared); in MYSQLND_METHOD()
1314 if (!stmt->param_bind) { in MYSQLND_METHOD()
1315 SET_STMT_ERROR(stmt, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync); in MYSQLND_METHOD()
1319 if (param_no >= stmt->param_count) { in MYSQLND_METHOD()
1320 SET_STMT_ERROR(stmt, CR_INVALID_PARAMETER_NO, UNKNOWN_SQLSTATE, "Invalid parameter number"); in MYSQLND_METHOD()
1324 if (stmt->param_bind[param_no].type != MYSQL_TYPE_LONG_BLOB) { in MYSQLND_METHOD()
1325 SET_STMT_ERROR(stmt, CR_INVALID_BUFFER_USE, UNKNOWN_SQLSTATE, mysqlnd_not_bound_as_blob); in MYSQLND_METHOD()
1344 stmt->param_bind[param_no].flags |= MYSQLND_PARAM_BIND_BLOB_USED; in MYSQLND_METHOD()
1346 int4store(cmd_buf, stmt->stmt_id); in MYSQLND_METHOD()
1354 COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info); in MYSQLND_METHOD()
1358 SET_OOM_ERROR(*stmt->error_info); in MYSQLND_METHOD()
1386 SET_STMT_ERROR(stmt, CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE, in MYSQLND_METHOD()
1403 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1405 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1408 DBG_INF_FMT("stmt=%lu param_count=%u", stmt->stmt_id, stmt->param_count); in MYSQLND_METHOD()
1410 if (stmt->state < MYSQLND_STMT_PREPARED) { in MYSQLND_METHOD()
1411 SET_STMT_ERROR(stmt, CR_NO_PREPARE_STMT, UNKNOWN_SQLSTATE, mysqlnd_stmt_not_prepared); in MYSQLND_METHOD()
1419 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
1420 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
1422 if (stmt->param_count) { in MYSQLND_METHOD()
1426 …SET_STMT_ERROR(stmt, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, "Re-binding (still) not supported"… in MYSQLND_METHOD()
1429 } else if (stmt->param_bind) { in MYSQLND_METHOD()
1435 for (i = 0; i < stmt->param_count; i++) { in MYSQLND_METHOD()
1440 if (stmt->param_bind[i].zv) { in MYSQLND_METHOD()
1441 zval_ptr_dtor(&stmt->param_bind[i].zv); in MYSQLND_METHOD()
1444 if (stmt->param_bind != param_bind) { in MYSQLND_METHOD()
1445 s->m->free_parameter_bind(s, stmt->param_bind TSRMLS_CC); in MYSQLND_METHOD()
1449 stmt->param_bind = param_bind; in MYSQLND_METHOD()
1450 for (i = 0; i < stmt->param_count; i++) { in MYSQLND_METHOD()
1452 DBG_INF_FMT("%u is of type %u", i, stmt->param_bind[i].type); in MYSQLND_METHOD()
1455 Z_ADDREF_P(stmt->param_bind[i].zv); in MYSQLND_METHOD()
1456 stmt->param_bind[i].flags = 0; in MYSQLND_METHOD()
1457 if (stmt->param_bind[i].type == MYSQL_TYPE_LONG_BLOB) { in MYSQLND_METHOD()
1458 stmt->param_bind[i].flags &= ~MYSQLND_PARAM_BIND_BLOB_USED; in MYSQLND_METHOD()
1461 stmt->send_types_to_server = 1; in MYSQLND_METHOD()
1474 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1476 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1479 …DBG_INF_FMT("stmt=%lu param_no=%u param_count=%u type=%u", stmt->stmt_id, param_no, stmt->param_co… in MYSQLND_METHOD()
1481 if (stmt->state < MYSQLND_STMT_PREPARED) { in MYSQLND_METHOD()
1482 SET_STMT_ERROR(stmt, CR_NO_PREPARE_STMT, UNKNOWN_SQLSTATE, mysqlnd_stmt_not_prepared); in MYSQLND_METHOD()
1487 if (param_no >= stmt->param_count) { in MYSQLND_METHOD()
1488 SET_STMT_ERROR(stmt, CR_INVALID_PARAMETER_NO, UNKNOWN_SQLSTATE, "Invalid parameter number"); in MYSQLND_METHOD()
1492 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
1493 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
1495 if (stmt->param_count) { in MYSQLND_METHOD()
1496 if (!stmt->param_bind) { in MYSQLND_METHOD()
1497 stmt->param_bind = mnd_pecalloc(stmt->param_count, sizeof(MYSQLND_PARAM_BIND), stmt->persistent); in MYSQLND_METHOD()
1498 if (!stmt->param_bind) { in MYSQLND_METHOD()
1508 if (stmt->param_bind[param_no].zv) { in MYSQLND_METHOD()
1509 zval_ptr_dtor(&stmt->param_bind[param_no].zv); in MYSQLND_METHOD()
1513 stmt->param_bind[param_no].flags &= ~MYSQLND_PARAM_BIND_BLOB_USED; in MYSQLND_METHOD()
1515 stmt->param_bind[param_no].zv = zv; in MYSQLND_METHOD()
1516 stmt->param_bind[param_no].type = type; in MYSQLND_METHOD()
1518 stmt->send_types_to_server = 1; in MYSQLND_METHOD()
1530 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1532 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1535 DBG_INF_FMT("stmt=%lu param_count=%u", stmt->stmt_id, stmt->param_count); in MYSQLND_METHOD()
1537 if (stmt->state < MYSQLND_STMT_PREPARED) { in MYSQLND_METHOD()
1538 SET_STMT_ERROR(stmt, CR_NO_PREPARE_STMT, UNKNOWN_SQLSTATE, mysqlnd_stmt_not_prepared); in MYSQLND_METHOD()
1543 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
1544 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
1546 if (stmt->param_count) { in MYSQLND_METHOD()
1547 stmt->send_types_to_server = 1; in MYSQLND_METHOD()
1559 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1561 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1564 DBG_INF_FMT("stmt=%lu field_count=%u", stmt->stmt_id, stmt->field_count); in MYSQLND_METHOD()
1566 if (stmt->state < MYSQLND_STMT_PREPARED) { in MYSQLND_METHOD()
1567 SET_STMT_ERROR(stmt, CR_NO_PREPARE_STMT, UNKNOWN_SQLSTATE, mysqlnd_stmt_not_prepared); in MYSQLND_METHOD()
1575 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
1576 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
1578 if (stmt->field_count) { in MYSQLND_METHOD()
1587 stmt->result_zvals_separated_once = FALSE; in MYSQLND_METHOD()
1588 stmt->result_bind = result_bind; in MYSQLND_METHOD()
1589 for (i = 0; i < stmt->field_count; i++) { in MYSQLND_METHOD()
1591 Z_ADDREF_P(stmt->result_bind[i].zv); in MYSQLND_METHOD()
1592 DBG_INF_FMT("ref of %p = %u", stmt->result_bind[i].zv, Z_REFCOUNT_P(stmt->result_bind[i].zv)); in MYSQLND_METHOD()
1598 stmt->result_bind[i].bound = TRUE; in MYSQLND_METHOD()
1613 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1615 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1618 DBG_INF_FMT("stmt=%lu field_count=%u", stmt->stmt_id, stmt->field_count); in MYSQLND_METHOD()
1620 if (stmt->state < MYSQLND_STMT_PREPARED) { in MYSQLND_METHOD()
1621 SET_STMT_ERROR(stmt, CR_NO_PREPARE_STMT, UNKNOWN_SQLSTATE, mysqlnd_stmt_not_prepared); in MYSQLND_METHOD()
1626 if (param_no >= stmt->field_count) { in MYSQLND_METHOD()
1627 SET_STMT_ERROR(stmt, CR_INVALID_PARAMETER_NO, UNKNOWN_SQLSTATE, "Invalid parameter number"); in MYSQLND_METHOD()
1632 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
1633 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
1635 if (stmt->field_count) { in MYSQLND_METHOD()
1638 if (!stmt->result_bind) { in MYSQLND_METHOD()
1639stmt->result_bind = mnd_pecalloc(stmt->field_count, sizeof(MYSQLND_RESULT_BIND), stmt->persistent); in MYSQLND_METHOD()
1641stmt->result_bind = mnd_perealloc(stmt->result_bind, stmt->field_count * sizeof(MYSQLND_RESULT_BIN… in MYSQLND_METHOD()
1643 if (!stmt->result_bind) { in MYSQLND_METHOD()
1646 ALLOC_INIT_ZVAL(stmt->result_bind[param_no].zv); in MYSQLND_METHOD()
1652 stmt->result_bind[param_no].bound = TRUE; in MYSQLND_METHOD()
1664 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1665 return stmt? stmt->upsert_status->last_insert_id : 0; in MYSQLND_METHOD()
1674 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1675 return stmt? stmt->upsert_status->affected_rows : 0; in MYSQLND_METHOD()
1684 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1685 return stmt && stmt->result? mysqlnd_num_rows(stmt->result):0; in MYSQLND_METHOD()
1694 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1695 return stmt? stmt->upsert_status->warning_count : 0; in MYSQLND_METHOD()
1704 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1705 return stmt? stmt->upsert_status->server_status : 0; in MYSQLND_METHOD()
1714 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1715 return stmt? stmt->field_count : 0; in MYSQLND_METHOD()
1724 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1725 return stmt? stmt->param_count : 0; in MYSQLND_METHOD()
1734 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1735 return stmt? stmt->error_info->error_no : 0; in MYSQLND_METHOD()
1744 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1745 return stmt? stmt->error_info->error : 0; in MYSQLND_METHOD()
1754 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1755 return stmt && stmt->error_info->sqlstate[0] ? stmt->error_info->sqlstate:MYSQLND_SQLSTATE_NULL; in MYSQLND_METHOD()
1764 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1765 return stmt && stmt->result? stmt->result->m.seek_data(stmt->result, row TSRMLS_CC) : FAIL; in MYSQLND_METHOD()
1774 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1775 if (!stmt || !stmt->param_count) { in MYSQLND_METHOD()
1787 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1791 if (!stmt) { in MYSQLND_METHOD()
1794 DBG_INF_FMT("stmt=%u field_count=%u", stmt->stmt_id, stmt->field_count); in MYSQLND_METHOD()
1796 if (!stmt->field_count || !stmt->conn || !stmt->result || !stmt->result->meta) { in MYSQLND_METHOD()
1801 if (stmt->update_max_length && stmt->result->stored_data) { in MYSQLND_METHOD()
1803stmt->result->stored_data->m.initialize_result_set_rest(stmt->result->stored_data, stmt->result->m… in MYSQLND_METHOD()
1804 stmt->conn->options->int_and_float_native TSRMLS_CC); in MYSQLND_METHOD()
1816 result = stmt->conn->m->result_init(stmt->field_count, stmt->persistent TSRMLS_CC); in MYSQLND_METHOD()
1821 …result->unbuf = mysqlnd_result_unbuffered_init(stmt->field_count, TRUE, result->persistent TSRMLS_… in MYSQLND_METHOD()
1826 result->meta = stmt->result->meta->m->clone_metadata(stmt->result->meta, FALSE TSRMLS_CC); in MYSQLND_METHOD()
1835 SET_OOM_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
1850 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1852 if (!stmt) { in MYSQLND_METHOD()
1855 DBG_INF_FMT("stmt=%lu attr_type=%u", stmt->stmt_id, attr_type); in MYSQLND_METHOD()
1864 stmt->update_max_length = bval? TRUE:FALSE; in MYSQLND_METHOD()
1870 SET_STMT_ERROR(stmt, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "Not implemented"); in MYSQLND_METHOD()
1874 stmt->flags = ival; in MYSQLND_METHOD()
1882 SET_STMT_ERROR(stmt, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "Not implemented"); in MYSQLND_METHOD()
1886 stmt->prefetch_rows = ival; in MYSQLND_METHOD()
1890 SET_STMT_ERROR(stmt, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "Not implemented"); in MYSQLND_METHOD()
1905 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1907 if (!stmt) { in MYSQLND_METHOD()
1910 DBG_INF_FMT("stmt=%lu attr_type=%u", stmt->stmt_id, attr_type); in MYSQLND_METHOD()
1914 *(zend_bool *) value= stmt->update_max_length; in MYSQLND_METHOD()
1917 *(unsigned long *) value= stmt->flags; in MYSQLND_METHOD()
1920 *(unsigned long *) value= stmt->prefetch_rows; in MYSQLND_METHOD()
1936 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1938 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1941 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
1943 if (!stmt->result) { in MYSQLND_METHOD()
1952 if (stmt->state == MYSQLND_STMT_WAITING_USE_OR_STORE) { in MYSQLND_METHOD()
1955 stmt->default_rset_handler = s->m->use_result; in MYSQLND_METHOD()
1956 stmt->default_rset_handler(s TSRMLS_CC); in MYSQLND_METHOD()
1959 if (stmt->state > MYSQLND_STMT_WAITING_USE_OR_STORE) { in MYSQLND_METHOD()
1962 stmt->result->m.skip_result(stmt->result TSRMLS_CC); in MYSQLND_METHOD()
1970 stmt->result->m.free_result_buffers(stmt->result TSRMLS_CC); in MYSQLND_METHOD()
1973 if (stmt->state > MYSQLND_STMT_PREPARED) { in MYSQLND_METHOD()
1975 stmt->state = MYSQLND_STMT_PREPARED; in MYSQLND_METHOD()
1979 CONN_SET_STATE(stmt->conn, CONN_READY); in MYSQLND_METHOD()
1990 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in mysqlnd_stmt_separate_result_bind() local
1994 if (!stmt) { in mysqlnd_stmt_separate_result_bind()
1997 …DBG_INF_FMT("stmt=%lu result_bind=%p field_count=%u", stmt->stmt_id, stmt->result_bind, stmt->fiel… in mysqlnd_stmt_separate_result_bind()
1999 if (!stmt->result_bind) { in mysqlnd_stmt_separate_result_bind()
2008 for (i = 0; i < stmt->field_count; i++) { in mysqlnd_stmt_separate_result_bind()
2010 if (stmt->result_bind[i].bound == TRUE) { in mysqlnd_stmt_separate_result_bind()
2011 DBG_INF_FMT("%u has refcount=%u", i, Z_REFCOUNT_P(stmt->result_bind[i].zv)); in mysqlnd_stmt_separate_result_bind()
2016 if (Z_REFCOUNT_P(stmt->result_bind[i].zv) > 1) { in mysqlnd_stmt_separate_result_bind()
2018 zval_copy_ctor(stmt->result_bind[i].zv); in mysqlnd_stmt_separate_result_bind()
2020 zval_ptr_dtor(&stmt->result_bind[i].zv); in mysqlnd_stmt_separate_result_bind()
2028 ZVAL_NULL(stmt->result_bind[i].zv); in mysqlnd_stmt_separate_result_bind()
2030 zval_ptr_dtor(&stmt->result_bind[i].zv); in mysqlnd_stmt_separate_result_bind()
2034 s->m->free_result_bind(s, stmt->result_bind TSRMLS_CC); in mysqlnd_stmt_separate_result_bind()
2035 stmt->result_bind = NULL; in mysqlnd_stmt_separate_result_bind()
2046 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in mysqlnd_stmt_separate_one_result_bind() local
2048 if (!stmt) { in mysqlnd_stmt_separate_one_result_bind()
2051 …MT("stmt=%lu result_bind=%p field_count=%u param_no=%u", stmt->stmt_id, stmt->result_bind, stmt->f… in mysqlnd_stmt_separate_one_result_bind()
2053 if (!stmt->result_bind) { in mysqlnd_stmt_separate_one_result_bind()
2063 if (stmt->result_bind[param_no].bound == TRUE) { in mysqlnd_stmt_separate_one_result_bind()
2064 DBG_INF_FMT("%u has refcount=%u", param_no, Z_REFCOUNT_P(stmt->result_bind[param_no].zv)); in mysqlnd_stmt_separate_one_result_bind()
2069 if (Z_REFCOUNT_P(stmt->result_bind[param_no].zv) > 1) { in mysqlnd_stmt_separate_one_result_bind()
2071 zval_copy_ctor(stmt->result_bind[param_no].zv); in mysqlnd_stmt_separate_one_result_bind()
2073 zval_ptr_dtor(&stmt->result_bind[param_no].zv); in mysqlnd_stmt_separate_one_result_bind()
2081 ZVAL_NULL(stmt->result_bind[param_no].zv); in mysqlnd_stmt_separate_one_result_bind()
2083 zval_ptr_dtor(&stmt->result_bind[param_no].zv); in mysqlnd_stmt_separate_one_result_bind()
2096 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
2098 if (!stmt) { in MYSQLND_METHOD()
2108 if (stmt->result) { in MYSQLND_METHOD()
2109 stmt->result->m.free_result_internal(stmt->result TSRMLS_CC); in MYSQLND_METHOD()
2110 stmt->result = NULL; in MYSQLND_METHOD()
2112 if (stmt->error_info->error_list) { in MYSQLND_METHOD()
2113 zend_llist_clean(stmt->error_info->error_list); in MYSQLND_METHOD()
2114 mnd_pefree(stmt->error_info->error_list, s->persistent); in MYSQLND_METHOD()
2115 stmt->error_info->error_list = NULL; in MYSQLND_METHOD()
2127 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
2129 if (!stmt) { in MYSQLND_METHOD()
2132 …DBG_INF_FMT("stmt=%lu param_bind=%p param_count=%u", stmt->stmt_id, stmt->param_bind, stmt->param_… in MYSQLND_METHOD()
2135 if (stmt->param_bind) { in MYSQLND_METHOD()
2142 for (i = 0; i < stmt->param_count; i++) { in MYSQLND_METHOD()
2147 if (stmt->param_bind[i].zv) { in MYSQLND_METHOD()
2148 zval_ptr_dtor(&stmt->param_bind[i].zv); in MYSQLND_METHOD()
2151 s->m->free_parameter_bind(s, stmt->param_bind TSRMLS_CC); in MYSQLND_METHOD()
2152 stmt->param_bind = NULL; in MYSQLND_METHOD()
2165 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD_PRIVATE() local
2171 if (!stmt || !stmt->conn) { in MYSQLND_METHOD_PRIVATE()
2174 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD_PRIVATE()
2176 conn = stmt->conn; in MYSQLND_METHOD_PRIVATE()
2178 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD_PRIVATE()
2179 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD_PRIVATE()
2187 if (stmt->state == MYSQLND_STMT_WAITING_USE_OR_STORE) { in MYSQLND_METHOD_PRIVATE()
2189 stmt->default_rset_handler(s TSRMLS_CC); in MYSQLND_METHOD_PRIVATE()
2190 stmt->state = MYSQLND_STMT_USER_FETCHING; in MYSQLND_METHOD_PRIVATE()
2194 if (stmt->result) { in MYSQLND_METHOD_PRIVATE()
2196 stmt->result->m.skip_result(stmt->result TSRMLS_CC); in MYSQLND_METHOD_PRIVATE()
2203 if (stmt->stmt_id) { in MYSQLND_METHOD_PRIVATE()
2207 int4store(cmd_buf, stmt->stmt_id); in MYSQLND_METHOD_PRIVATE()
2212 COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info); in MYSQLND_METHOD_PRIVATE()
2216 switch (stmt->execute_count) { in MYSQLND_METHOD_PRIVATE()
2230 if (stmt->execute_cmd_buffer.buffer) { in MYSQLND_METHOD_PRIVATE()
2231 mnd_pefree(stmt->execute_cmd_buffer.buffer, stmt->persistent); in MYSQLND_METHOD_PRIVATE()
2232 stmt->execute_cmd_buffer.buffer = NULL; in MYSQLND_METHOD_PRIVATE()
2237 if (stmt->conn) { in MYSQLND_METHOD_PRIVATE()
2238 stmt->conn->m->free_reference(stmt->conn TSRMLS_CC); in MYSQLND_METHOD_PRIVATE()
2239 stmt->conn = NULL; in MYSQLND_METHOD_PRIVATE()
2250 MYSQLND_STMT_DATA * stmt = (s != NULL) ? s->data:NULL; in MYSQLND_METHOD() local
2255 if (stmt) { in MYSQLND_METHOD()
2256 DBG_INF_FMT("stmt=%p", stmt); in MYSQLND_METHOD()
2262 mnd_pefree(stmt, persistent); in MYSQLND_METHOD()
2276 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
2278 if (!stmt) { in MYSQLND_METHOD()
2281 DBG_RETURN(mnd_pecalloc(stmt->param_count, sizeof(MYSQLND_PARAM_BIND), stmt->persistent)); in MYSQLND_METHOD()
2290 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
2292 if (!stmt) { in MYSQLND_METHOD()
2295 DBG_RETURN(mnd_pecalloc(stmt->field_count, sizeof(MYSQLND_RESULT_BIND), stmt->persistent)); in MYSQLND_METHOD()
2304 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
2305 if (stmt) { in MYSQLND_METHOD()
2306 mnd_pefree(param_bind, stmt->persistent); in MYSQLND_METHOD()
2316 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
2317 if (stmt) { in MYSQLND_METHOD()
2318 mnd_pefree(result_bind, stmt->persistent); in MYSQLND_METHOD()