Lines Matching refs:stmt

50 static void mysqlnd_stmt_separate_result_bind(MYSQLND_STMT * const stmt TSRMLS_DC);
51 static void mysqlnd_stmt_separate_one_result_bind(MYSQLND_STMT * const stmt, unsigned int param_no …
59 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
65 if (!stmt || !stmt->conn || !stmt->result) { in MYSQLND_METHOD()
68 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
70 conn = stmt->conn; in MYSQLND_METHOD()
73 if (!stmt->field_count) { in MYSQLND_METHOD()
77 if (stmt->cursor_exists) { in MYSQLND_METHOD()
84 stmt->state != MYSQLND_STMT_WAITING_USE_OR_STORE) in MYSQLND_METHOD()
91 stmt->default_rset_handler = s->m->store_result; in MYSQLND_METHOD()
93 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
97 result = stmt->result; in MYSQLND_METHOD()
109 stmt->upsert_status->affected_rows = stmt->result->stored_data->row_count; in MYSQLND_METHOD()
111 stmt->state = MYSQLND_STMT_USE_OR_STORE_CALLED; in MYSQLND_METHOD()
114 stmt->result->m.free_result_contents(stmt->result TSRMLS_CC); in MYSQLND_METHOD()
115 mnd_efree(stmt->result); in MYSQLND_METHOD()
116 stmt->result = NULL; in MYSQLND_METHOD()
117 stmt->state = MYSQLND_STMT_PREPARED; in MYSQLND_METHOD()
129 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
134 if (!stmt || !stmt->conn || !stmt->result) { in MYSQLND_METHOD()
137 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
139 conn = stmt->conn; in MYSQLND_METHOD()
142 if (!stmt->field_count) { in MYSQLND_METHOD()
146 if (stmt->cursor_exists) { in MYSQLND_METHOD()
152 …if (CONN_GET_STATE(conn) != CONN_FETCHING_DATA || stmt->state != MYSQLND_STMT_WAITING_USE_OR_STORE… in MYSQLND_METHOD()
158 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
163 result = conn->m->result_init(stmt->result->field_count, stmt->persistent TSRMLS_CC); in MYSQLND_METHOD()
169 result->meta = stmt->result->meta->m->clone_metadata(stmt->result->meta, FALSE TSRMLS_CC); in MYSQLND_METHOD()
176 stmt->upsert_status->affected_rows = result->stored_data->row_count; in MYSQLND_METHOD()
177 stmt->state = MYSQLND_STMT_PREPARED; in MYSQLND_METHOD()
180 COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info); in MYSQLND_METHOD()
181 stmt->state = MYSQLND_STMT_PREPARED; in MYSQLND_METHOD()
199 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
202 …DBG_RETURN((stmt && stmt->conn && (stmt->conn->m->get_server_status(stmt->conn TSRMLS_CC) & SERVER… in MYSQLND_METHOD()
213 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
217 if (!stmt || !stmt->conn || !stmt->result) { in MYSQLND_METHOD()
220 conn = stmt->conn; in MYSQLND_METHOD()
221 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
227 …DBG_INF_FMT("server_status=%u cursor=%u", stmt->upsert_status->server_status, stmt->upsert_status-… in MYSQLND_METHOD()
243 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in mysqlnd_stmt_skip_metadata() local
250 if (!stmt || !stmt->conn || !stmt->conn->protocol) { in mysqlnd_stmt_skip_metadata()
253 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in mysqlnd_stmt_skip_metadata()
255 …field_packet = stmt->conn->protocol->m.get_result_field_packet(stmt->conn->protocol, FALSE TSRMLS_… in mysqlnd_stmt_skip_metadata()
257 SET_OOM_ERROR(*stmt->error_info); in mysqlnd_stmt_skip_metadata()
258 SET_OOM_ERROR(*stmt->conn->error_info); in mysqlnd_stmt_skip_metadata()
262 for (;i < stmt->param_count; i++) { in mysqlnd_stmt_skip_metadata()
263 if (FAIL == PACKET_READ(field_packet, stmt->conn)) { in mysqlnd_stmt_skip_metadata()
280 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in mysqlnd_stmt_read_prepare_response() local
285 if (!stmt || !stmt->conn || !stmt->conn->protocol) { in mysqlnd_stmt_read_prepare_response()
288 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in mysqlnd_stmt_read_prepare_response()
290 …prepare_resp = stmt->conn->protocol->m.get_prepare_response_packet(stmt->conn->protocol, FALSE TSR… in mysqlnd_stmt_read_prepare_response()
292 SET_OOM_ERROR(*stmt->error_info); in mysqlnd_stmt_read_prepare_response()
293 SET_OOM_ERROR(*stmt->conn->error_info); in mysqlnd_stmt_read_prepare_response()
297 if (FAIL == PACKET_READ(prepare_resp, stmt->conn)) { in mysqlnd_stmt_read_prepare_response()
302 COPY_CLIENT_ERROR(*stmt->error_info, prepare_resp->error_info); in mysqlnd_stmt_read_prepare_response()
303 COPY_CLIENT_ERROR(*stmt->conn->error_info, prepare_resp->error_info); in mysqlnd_stmt_read_prepare_response()
307 stmt->stmt_id = prepare_resp->stmt_id; in mysqlnd_stmt_read_prepare_response()
308 stmt->warning_count = stmt->conn->upsert_status->warning_count = prepare_resp->warning_count; in mysqlnd_stmt_read_prepare_response()
309 stmt->field_count = stmt->conn->field_count = prepare_resp->field_count; in mysqlnd_stmt_read_prepare_response()
310 stmt->param_count = prepare_resp->param_count; in mysqlnd_stmt_read_prepare_response()
323 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in mysqlnd_stmt_prepare_read_eof() local
328 if (!stmt || !stmt->conn || !stmt->conn->protocol) { in mysqlnd_stmt_prepare_read_eof()
331 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in mysqlnd_stmt_prepare_read_eof()
333 fields_eof = stmt->conn->protocol->m.get_eof_packet(stmt->conn->protocol, FALSE TSRMLS_CC); in mysqlnd_stmt_prepare_read_eof()
335 SET_OOM_ERROR(*stmt->error_info); in mysqlnd_stmt_prepare_read_eof()
336 SET_OOM_ERROR(*stmt->conn->error_info); in mysqlnd_stmt_prepare_read_eof()
338 if (FAIL == (ret = PACKET_READ(fields_eof, stmt->conn))) { in mysqlnd_stmt_prepare_read_eof()
339 if (stmt->result) { in mysqlnd_stmt_prepare_read_eof()
340 stmt->result->m.free_result_contents(stmt->result TSRMLS_CC); in mysqlnd_stmt_prepare_read_eof()
341 mnd_efree(stmt->result); in mysqlnd_stmt_prepare_read_eof()
342 memset(stmt, 0, sizeof(MYSQLND_STMT_DATA)); in mysqlnd_stmt_prepare_read_eof()
343 stmt->state = MYSQLND_STMT_INITTED; in mysqlnd_stmt_prepare_read_eof()
346 stmt->upsert_status->server_status = fields_eof->server_status; in mysqlnd_stmt_prepare_read_eof()
347 stmt->upsert_status->warning_count = fields_eof->warning_count; in mysqlnd_stmt_prepare_read_eof()
348 stmt->state = MYSQLND_STMT_PREPARED; in mysqlnd_stmt_prepare_read_eof()
362 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
364 MYSQLND_STMT_DATA * stmt_to_prepare = stmt; in MYSQLND_METHOD()
367 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
370 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
373 SET_ERROR_AFF_ROWS(stmt); in MYSQLND_METHOD()
374 SET_ERROR_AFF_ROWS(stmt->conn); in MYSQLND_METHOD()
376 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
377 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
379 if (stmt->state > MYSQLND_STMT_INITTED) { in MYSQLND_METHOD()
381 if (stmt->state == MYSQLND_STMT_WAITING_USE_OR_STORE) { in MYSQLND_METHOD()
383 stmt->default_rset_handler = s->m->use_result; in MYSQLND_METHOD()
384 stmt->default_rset_handler(s TSRMLS_CC); in MYSQLND_METHOD()
387 if (stmt->state > MYSQLND_STMT_WAITING_USE_OR_STORE && stmt->result) { in MYSQLND_METHOD()
388 stmt->result->m.skip_result(stmt->result TSRMLS_CC); in MYSQLND_METHOD()
394 s_to_prepare = stmt->conn->m->stmt_init(stmt->conn TSRMLS_CC); in MYSQLND_METHOD()
421 …MYSQLND_RES * result = stmt->conn->m->result_init(stmt_to_prepare->field_count, stmt_to_prepare->p… in MYSQLND_METHOD()
423 SET_OOM_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
440 if (stmt_to_prepare != stmt) { in MYSQLND_METHOD()
450 stmt_to_prepare = stmt; in MYSQLND_METHOD()
451 stmt = tmp_swap_data; in MYSQLND_METHOD()
455 stmt->state = MYSQLND_STMT_PREPARED; in MYSQLND_METHOD()
460 if (stmt_to_prepare != stmt && s_to_prepare) { in MYSQLND_METHOD()
463 stmt->state = MYSQLND_STMT_INITTED; in MYSQLND_METHOD()
475 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in mysqlnd_stmt_execute_parse_response() local
480 if (!stmt || !stmt->conn) { in mysqlnd_stmt_execute_parse_response()
483 conn = stmt->conn; in mysqlnd_stmt_execute_parse_response()
486 ret = mysqlnd_query_read_result_set_header(stmt->conn, s TSRMLS_CC); in mysqlnd_stmt_execute_parse_response()
488 COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info); in mysqlnd_stmt_execute_parse_response()
489 memset(stmt->upsert_status, 0, sizeof(*stmt->upsert_status)); in mysqlnd_stmt_execute_parse_response()
490 stmt->upsert_status->affected_rows = conn->upsert_status->affected_rows; in mysqlnd_stmt_execute_parse_response()
494 stmt->state = MYSQLND_STMT_PREPARED; in mysqlnd_stmt_execute_parse_response()
495 stmt->send_types_to_server = 1; in mysqlnd_stmt_execute_parse_response()
504 SET_EMPTY_ERROR(*stmt->error_info); in mysqlnd_stmt_execute_parse_response()
505 SET_EMPTY_ERROR(*stmt->conn->error_info); in mysqlnd_stmt_execute_parse_response()
506 *stmt->upsert_status = *conn->upsert_status; /* copy status */ in mysqlnd_stmt_execute_parse_response()
507 stmt->state = MYSQLND_STMT_EXECUTED; in mysqlnd_stmt_execute_parse_response()
513 stmt->result->type = MYSQLND_RES_PS_BUF; in mysqlnd_stmt_execute_parse_response()
514 if (!stmt->result->conn) { in mysqlnd_stmt_execute_parse_response()
519 stmt->result->conn = stmt->conn->m->get_reference(stmt->conn TSRMLS_CC); in mysqlnd_stmt_execute_parse_response()
523 stmt->field_count = stmt->result->field_count = conn->field_count; in mysqlnd_stmt_execute_parse_response()
524 stmt->result->lengths = NULL; in mysqlnd_stmt_execute_parse_response()
525 if (stmt->field_count) { in mysqlnd_stmt_execute_parse_response()
526 stmt->state = MYSQLND_STMT_WAITING_USE_OR_STORE; in mysqlnd_stmt_execute_parse_response()
532 DBG_INF_FMT("server_status=%u cursor=%u", stmt->upsert_status->server_status, in mysqlnd_stmt_execute_parse_response()
533 stmt->upsert_status->server_status & SERVER_STATUS_CURSOR_EXISTS); in mysqlnd_stmt_execute_parse_response()
535 if (stmt->upsert_status->server_status & SERVER_STATUS_CURSOR_EXISTS) { in mysqlnd_stmt_execute_parse_response()
537 stmt->cursor_exists = TRUE; in mysqlnd_stmt_execute_parse_response()
540 stmt->default_rset_handler = s->m->use_result; in mysqlnd_stmt_execute_parse_response()
542 } else if (stmt->flags & CURSOR_TYPE_READ_ONLY) { in mysqlnd_stmt_execute_parse_response()
555 stmt->default_rset_handler = s->m->store_result; in mysqlnd_stmt_execute_parse_response()
560 stmt->default_rset_handler = s->m->use_result; in mysqlnd_stmt_execute_parse_response()
566 if (stmt->upsert_status->server_status & SERVER_PS_OUT_PARAMS) { in mysqlnd_stmt_execute_parse_response()
584 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
592 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
595 conn = stmt->conn; in MYSQLND_METHOD()
596 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
598 SET_ERROR_AFF_ROWS(stmt); in MYSQLND_METHOD()
599 SET_ERROR_AFF_ROWS(stmt->conn); in MYSQLND_METHOD()
601 if (stmt->result && stmt->state >= MYSQLND_STMT_PREPARED && stmt->field_count) { in MYSQLND_METHOD()
608 if (stmt->result_bind && in MYSQLND_METHOD()
609 stmt->result_zvals_separated_once == TRUE && in MYSQLND_METHOD()
610 stmt->state >= MYSQLND_STMT_USER_FETCHING) in MYSQLND_METHOD()
625 for (i = 0; i < stmt->field_count; i++) { in MYSQLND_METHOD()
626 if (stmt->result_bind[i].bound == TRUE) { in MYSQLND_METHOD()
627 zval_copy_ctor(stmt->result_bind[i].zv); in MYSQLND_METHOD()
640 stmt->result->m.free_result_buffers(stmt->result TSRMLS_CC); in MYSQLND_METHOD()
642 stmt->state = MYSQLND_STMT_PREPARED; in MYSQLND_METHOD()
643 } else if (stmt->state < MYSQLND_STMT_PREPARED) { in MYSQLND_METHOD()
647 SET_STMT_ERROR(stmt, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync); in MYSQLND_METHOD()
652 if (stmt->param_count) { in MYSQLND_METHOD()
654 if (!stmt->param_bind) { in MYSQLND_METHOD()
655 SET_STMT_ERROR(stmt, CR_PARAMS_NOT_BOUND, UNKNOWN_SQLSTATE, in MYSQLND_METHOD()
660 for (i = 0; i < stmt->param_count; i++) { in MYSQLND_METHOD()
661 if (stmt->param_bind[i].zv == NULL) { in MYSQLND_METHOD()
669 SET_STMT_ERROR(stmt, CR_PARAMS_NOT_BOUND, UNKNOWN_SQLSTATE, msg); in MYSQLND_METHOD()
680 ret = stmt->conn->m->simple_command(stmt->conn, COM_STMT_EXECUTE, request, request_len, in MYSQLND_METHOD()
684 …SET_STMT_ERROR(stmt, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "Couldn't generate the request. Possibly … in MYSQLND_METHOD()
692 COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info); in MYSQLND_METHOD()
696 stmt->execute_count++; in MYSQLND_METHOD()
700 …DBG_INF_FMT("server_status=%u cursor=%u", stmt->upsert_status->server_status, stmt->upsert_status-… in MYSQLND_METHOD()
702 if (ret == PASS && conn->last_query_type == QUERY_UPSERT && stmt->upsert_status->affected_rows) { in MYSQLND_METHOD()
703 …MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn->stats, STAT_ROWS_AFFECTED_PS, stmt->upsert_status->affect… in MYSQLND_METHOD()
715 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in mysqlnd_stmt_fetch_row_buffered() local
721 DBG_INF_FMT("stmt=%lu", stmt != NULL ? stmt->stmt_id : 0L); in mysqlnd_stmt_fetch_row_buffered()
728 if (stmt->result_bind) { in mysqlnd_stmt_fetch_row_buffered()
746 if (stmt->update_max_length) { in mysqlnd_stmt_fetch_row_buffered()
766 if (stmt->result_bind[i].zv) { in mysqlnd_stmt_fetch_row_buffered()
767 zval_dtor(stmt->result_bind[i].zv); in mysqlnd_stmt_fetch_row_buffered()
771 if (stmt->result_bind[i].bound == TRUE) { in mysqlnd_stmt_fetch_row_buffered()
782 Z_TYPE_P(stmt->result_bind[i].zv) = Z_TYPE_P(current_row[i]); in mysqlnd_stmt_fetch_row_buffered()
783 stmt->result_bind[i].zv->value = current_row[i]->value; in mysqlnd_stmt_fetch_row_buffered()
785 zval_copy_ctor(stmt->result_bind[i].zv); in mysqlnd_stmt_fetch_row_buffered()
788 ZVAL_NULL(stmt->result_bind[i].zv); in mysqlnd_stmt_fetch_row_buffered()
814 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in mysqlnd_stmt_fetch_row_unbuffered() local
837 row_packet->skip_extraction = stmt && stmt->result_bind? FALSE:TRUE; in mysqlnd_stmt_fetch_row_unbuffered()
866 if (stmt->result_bind[i].bound == TRUE) { in mysqlnd_stmt_fetch_row_unbuffered()
873 zval_dtor(stmt->result_bind[i].zv); in mysqlnd_stmt_fetch_row_unbuffered()
875 if (IS_NULL != (Z_TYPE_P(stmt->result_bind[i].zv) = Z_TYPE_P(data)) ) { in mysqlnd_stmt_fetch_row_unbuffered()
886 stmt->result_bind[i].zv->value = data->value; in mysqlnd_stmt_fetch_row_unbuffered()
892 MYSQLND_INC_CONN_STATISTIC(stmt->conn->stats, STAT_ROWS_FETCHED_FROM_CLIENT_PS_UNBUF); in mysqlnd_stmt_fetch_row_unbuffered()
909 COPY_CLIENT_ERROR(*stmt->conn->error_info, row_packet->error_info); in mysqlnd_stmt_fetch_row_unbuffered()
910 COPY_CLIENT_ERROR(*stmt->error_info, row_packet->error_info); in mysqlnd_stmt_fetch_row_unbuffered()
942 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
947 if (!stmt || !stmt->conn || !stmt->result) { in MYSQLND_METHOD()
950 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
952 conn = stmt->conn; in MYSQLND_METHOD()
954 if (!stmt->field_count || in MYSQLND_METHOD()
955 (!stmt->cursor_exists && CONN_GET_STATE(conn) != CONN_FETCHING_DATA) || in MYSQLND_METHOD()
956 (stmt->cursor_exists && CONN_GET_STATE(conn) != CONN_READY) || in MYSQLND_METHOD()
957 (stmt->state != MYSQLND_STMT_WAITING_USE_OR_STORE)) in MYSQLND_METHOD()
965 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
967 MYSQLND_INC_CONN_STATISTIC(stmt->conn->stats, STAT_PS_UNBUFFERED_SETS); in MYSQLND_METHOD()
968 result = stmt->result; in MYSQLND_METHOD()
970 result->m.use_result(stmt->result, TRUE TSRMLS_CC); in MYSQLND_METHOD()
971 result->m.fetch_row = stmt->cursor_exists? mysqlnd_fetch_stmt_row_cursor: in MYSQLND_METHOD()
973 stmt->state = MYSQLND_STMT_USE_OR_STORE_CALLED; in MYSQLND_METHOD()
989 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in mysqlnd_fetch_stmt_row_cursor() local
995 if (!stmt || !stmt->conn || !result || !result->conn || !result->unbuf) { in mysqlnd_fetch_stmt_row_cursor()
1000 DBG_INF_FMT("stmt=%lu flags=%u", stmt->stmt_id, flags); in mysqlnd_fetch_stmt_row_cursor()
1002 if (stmt->state < MYSQLND_STMT_USER_FETCHING) { in mysqlnd_fetch_stmt_row_cursor()
1004 SET_CLIENT_ERROR(*stmt->conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, in mysqlnd_fetch_stmt_row_cursor()
1013 SET_EMPTY_ERROR(*stmt->error_info); in mysqlnd_fetch_stmt_row_cursor()
1014 SET_EMPTY_ERROR(*stmt->conn->error_info); in mysqlnd_fetch_stmt_row_cursor()
1016 int4store(buf, stmt->stmt_id); in mysqlnd_fetch_stmt_row_cursor()
1019 if (FAIL == stmt->conn->m->simple_command(stmt->conn, COM_STMT_FETCH, buf, sizeof(buf), in mysqlnd_fetch_stmt_row_cursor()
1022 COPY_CLIENT_ERROR(*stmt->error_info, *stmt->conn->error_info); in mysqlnd_fetch_stmt_row_cursor()
1026 row_packet->skip_extraction = stmt->result_bind? FALSE:TRUE; in mysqlnd_fetch_stmt_row_cursor()
1028 memset(stmt->upsert_status, 0, sizeof(*stmt->upsert_status)); in mysqlnd_fetch_stmt_row_cursor()
1053 if (stmt->result_bind[i].bound == TRUE) { in mysqlnd_fetch_stmt_row_cursor()
1060 zval_dtor(stmt->result_bind[i].zv); in mysqlnd_fetch_stmt_row_cursor()
1062 DBG_INF_FMT("i=%u bound_var=%p type=%u refc=%u", i, stmt->result_bind[i].zv, in mysqlnd_fetch_stmt_row_cursor()
1063 Z_TYPE_P(data), Z_REFCOUNT_P(stmt->result_bind[i].zv)); in mysqlnd_fetch_stmt_row_cursor()
1064 if (IS_NULL != (Z_TYPE_P(stmt->result_bind[i].zv) = Z_TYPE_P(data))) { in mysqlnd_fetch_stmt_row_cursor()
1074 stmt->result_bind[i].zv->value = data->value; in mysqlnd_fetch_stmt_row_cursor()
1097 MYSQLND_INC_CONN_STATISTIC(stmt->conn->stats, STAT_ROWS_FETCHED_FROM_CLIENT_PS_CURSOR); in mysqlnd_fetch_stmt_row_cursor()
1104 stmt->upsert_status->warning_count = in mysqlnd_fetch_stmt_row_cursor()
1105 stmt->conn->upsert_status->warning_count = in mysqlnd_fetch_stmt_row_cursor()
1108 stmt->upsert_status->server_status = in mysqlnd_fetch_stmt_row_cursor()
1109 stmt->conn->upsert_status->server_status = in mysqlnd_fetch_stmt_row_cursor()
1114 stmt->upsert_status->warning_count = in mysqlnd_fetch_stmt_row_cursor()
1115 stmt->conn->upsert_status->warning_count = in mysqlnd_fetch_stmt_row_cursor()
1117 stmt->upsert_status->server_status = in mysqlnd_fetch_stmt_row_cursor()
1118 stmt->conn->upsert_status->server_status = in mysqlnd_fetch_stmt_row_cursor()
1134 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1137 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1140 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
1142 if (!stmt->result || in MYSQLND_METHOD()
1143 stmt->state < MYSQLND_STMT_WAITING_USE_OR_STORE) { in MYSQLND_METHOD()
1144 SET_STMT_ERROR(stmt, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync); in MYSQLND_METHOD()
1148 } else if (stmt->state == MYSQLND_STMT_WAITING_USE_OR_STORE) { in MYSQLND_METHOD()
1151 stmt->default_rset_handler(s TSRMLS_CC); in MYSQLND_METHOD()
1153 stmt->state = MYSQLND_STMT_USER_FETCHING; in MYSQLND_METHOD()
1155 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
1156 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
1158 …DBG_INF_FMT("result_bind=%p separated_once=%u", stmt->result_bind, stmt->result_zvals_separated_on… in MYSQLND_METHOD()
1163 if (stmt->result_bind && !stmt->result_zvals_separated_once) { in MYSQLND_METHOD()
1169 for (i = 0; i < stmt->result->field_count; i++) { in MYSQLND_METHOD()
1170 if (stmt->result_bind[i].bound == TRUE) { in MYSQLND_METHOD()
1171 zval_dtor(stmt->result_bind[i].zv); in MYSQLND_METHOD()
1172 ZVAL_NULL(stmt->result_bind[i].zv); in MYSQLND_METHOD()
1175 stmt->result_zvals_separated_once = TRUE; in MYSQLND_METHOD()
1178 ret = stmt->result->m.fetch_row(stmt->result, (void*)s, 0, fetched_anything TSRMLS_CC); in MYSQLND_METHOD()
1188 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1193 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1196 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
1198 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
1199 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
1201 if (stmt->stmt_id) { in MYSQLND_METHOD()
1202 MYSQLND_CONN_DATA * conn = stmt->conn; in MYSQLND_METHOD()
1203 if (stmt->param_bind) { in MYSQLND_METHOD()
1207 for (i = 0; i < stmt->param_count; i++) { in MYSQLND_METHOD()
1208 if (stmt->param_bind[i].flags & MYSQLND_PARAM_BIND_BLOB_USED) { in MYSQLND_METHOD()
1209 stmt->param_bind[i].flags &= ~MYSQLND_PARAM_BIND_BLOB_USED; in MYSQLND_METHOD()
1222 int4store(cmd_buf, stmt->stmt_id); in MYSQLND_METHOD()
1227 COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info); in MYSQLND_METHOD()
1229 *stmt->upsert_status = *conn->upsert_status; in MYSQLND_METHOD()
1241 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1245 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1248 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
1250 if (stmt->stmt_id) { in MYSQLND_METHOD()
1257 if (stmt->state == MYSQLND_STMT_WAITING_USE_OR_STORE) { in MYSQLND_METHOD()
1259 stmt->default_rset_handler(s TSRMLS_CC); in MYSQLND_METHOD()
1260 stmt->state = MYSQLND_STMT_USER_FETCHING; in MYSQLND_METHOD()
1263 if (stmt->result) { in MYSQLND_METHOD()
1265 stmt->result->m.skip_result(stmt->result TSRMLS_CC); in MYSQLND_METHOD()
1280 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1287 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1290 DBG_INF_FMT("stmt=%lu param_no=%u data_len=%lu", stmt->stmt_id, param_no, length); in MYSQLND_METHOD()
1292 conn = stmt->conn; in MYSQLND_METHOD()
1294 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
1295 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
1297 if (stmt->state < MYSQLND_STMT_PREPARED) { in MYSQLND_METHOD()
1298 SET_STMT_ERROR(stmt, CR_NO_PREPARE_STMT, UNKNOWN_SQLSTATE, mysqlnd_stmt_not_prepared); in MYSQLND_METHOD()
1302 if (!stmt->param_bind) { in MYSQLND_METHOD()
1303 SET_STMT_ERROR(stmt, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync); in MYSQLND_METHOD()
1307 if (param_no >= stmt->param_count) { in MYSQLND_METHOD()
1308 SET_STMT_ERROR(stmt, CR_INVALID_PARAMETER_NO, UNKNOWN_SQLSTATE, "Invalid parameter number"); in MYSQLND_METHOD()
1312 if (stmt->param_bind[param_no].type != MYSQL_TYPE_LONG_BLOB) { in MYSQLND_METHOD()
1313 SET_STMT_ERROR(stmt, CR_INVALID_BUFFER_USE, UNKNOWN_SQLSTATE, mysqlnd_not_bound_as_blob); in MYSQLND_METHOD()
1332 stmt->param_bind[param_no].flags |= MYSQLND_PARAM_BIND_BLOB_USED; in MYSQLND_METHOD()
1334 int4store(cmd_buf, stmt->stmt_id); in MYSQLND_METHOD()
1342 COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info); in MYSQLND_METHOD()
1346 SET_OOM_ERROR(*stmt->error_info); in MYSQLND_METHOD()
1374 SET_STMT_ERROR(stmt, CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE, in MYSQLND_METHOD()
1391 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1393 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1396 DBG_INF_FMT("stmt=%lu param_count=%u", stmt->stmt_id, stmt->param_count); in MYSQLND_METHOD()
1398 if (stmt->state < MYSQLND_STMT_PREPARED) { in MYSQLND_METHOD()
1399 SET_STMT_ERROR(stmt, CR_NO_PREPARE_STMT, UNKNOWN_SQLSTATE, mysqlnd_stmt_not_prepared); in MYSQLND_METHOD()
1407 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
1408 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
1410 if (stmt->param_count) { in MYSQLND_METHOD()
1414 …SET_STMT_ERROR(stmt, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, "Re-binding (still) not supported"… in MYSQLND_METHOD()
1417 } else if (stmt->param_bind) { in MYSQLND_METHOD()
1423 for (i = 0; i < stmt->param_count; i++) { in MYSQLND_METHOD()
1428 if (stmt->param_bind[i].zv) { in MYSQLND_METHOD()
1429 zval_ptr_dtor(&stmt->param_bind[i].zv); in MYSQLND_METHOD()
1432 if (stmt->param_bind != param_bind) { in MYSQLND_METHOD()
1433 s->m->free_parameter_bind(s, stmt->param_bind TSRMLS_CC); in MYSQLND_METHOD()
1437 stmt->param_bind = param_bind; in MYSQLND_METHOD()
1438 for (i = 0; i < stmt->param_count; i++) { in MYSQLND_METHOD()
1440 DBG_INF_FMT("%u is of type %u", i, stmt->param_bind[i].type); in MYSQLND_METHOD()
1443 Z_ADDREF_P(stmt->param_bind[i].zv); in MYSQLND_METHOD()
1444 stmt->param_bind[i].flags = 0; in MYSQLND_METHOD()
1445 if (stmt->param_bind[i].type == MYSQL_TYPE_LONG_BLOB) { in MYSQLND_METHOD()
1446 stmt->param_bind[i].flags &= ~MYSQLND_PARAM_BIND_BLOB_USED; in MYSQLND_METHOD()
1449 stmt->send_types_to_server = 1; in MYSQLND_METHOD()
1462 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1464 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1467 …DBG_INF_FMT("stmt=%lu param_no=%u param_count=%u type=%u", stmt->stmt_id, param_no, stmt->param_co… in MYSQLND_METHOD()
1469 if (stmt->state < MYSQLND_STMT_PREPARED) { in MYSQLND_METHOD()
1470 SET_STMT_ERROR(stmt, CR_NO_PREPARE_STMT, UNKNOWN_SQLSTATE, mysqlnd_stmt_not_prepared); in MYSQLND_METHOD()
1475 if (param_no >= stmt->param_count) { in MYSQLND_METHOD()
1476 SET_STMT_ERROR(stmt, CR_INVALID_PARAMETER_NO, UNKNOWN_SQLSTATE, "Invalid parameter number"); in MYSQLND_METHOD()
1480 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
1481 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
1483 if (stmt->param_count) { in MYSQLND_METHOD()
1484 if (!stmt->param_bind) { in MYSQLND_METHOD()
1485 stmt->param_bind = mnd_pecalloc(stmt->param_count, sizeof(MYSQLND_PARAM_BIND), stmt->persistent); in MYSQLND_METHOD()
1486 if (!stmt->param_bind) { in MYSQLND_METHOD()
1496 if (stmt->param_bind[param_no].zv) { in MYSQLND_METHOD()
1497 zval_ptr_dtor(&stmt->param_bind[param_no].zv); in MYSQLND_METHOD()
1501 stmt->param_bind[param_no].flags &= ~MYSQLND_PARAM_BIND_BLOB_USED; in MYSQLND_METHOD()
1503 stmt->param_bind[param_no].zv = zv; in MYSQLND_METHOD()
1504 stmt->param_bind[param_no].type = type; in MYSQLND_METHOD()
1506 stmt->send_types_to_server = 1; in MYSQLND_METHOD()
1518 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1520 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1523 DBG_INF_FMT("stmt=%lu param_count=%u", stmt->stmt_id, stmt->param_count); in MYSQLND_METHOD()
1525 if (stmt->state < MYSQLND_STMT_PREPARED) { in MYSQLND_METHOD()
1526 SET_STMT_ERROR(stmt, CR_NO_PREPARE_STMT, UNKNOWN_SQLSTATE, mysqlnd_stmt_not_prepared); in MYSQLND_METHOD()
1531 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
1532 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
1534 if (stmt->param_count) { in MYSQLND_METHOD()
1535 stmt->send_types_to_server = 1; in MYSQLND_METHOD()
1547 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1549 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1552 DBG_INF_FMT("stmt=%lu field_count=%u", stmt->stmt_id, stmt->field_count); in MYSQLND_METHOD()
1554 if (stmt->state < MYSQLND_STMT_PREPARED) { in MYSQLND_METHOD()
1555 SET_STMT_ERROR(stmt, CR_NO_PREPARE_STMT, UNKNOWN_SQLSTATE, mysqlnd_stmt_not_prepared); in MYSQLND_METHOD()
1563 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
1564 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
1566 if (stmt->field_count) { in MYSQLND_METHOD()
1575 stmt->result_zvals_separated_once = FALSE; in MYSQLND_METHOD()
1576 stmt->result_bind = result_bind; in MYSQLND_METHOD()
1577 for (i = 0; i < stmt->field_count; i++) { in MYSQLND_METHOD()
1579 Z_ADDREF_P(stmt->result_bind[i].zv); in MYSQLND_METHOD()
1580 DBG_INF_FMT("ref of %p = %u", stmt->result_bind[i].zv, Z_REFCOUNT_P(stmt->result_bind[i].zv)); in MYSQLND_METHOD()
1586 stmt->result_bind[i].bound = TRUE; in MYSQLND_METHOD()
1601 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1603 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1606 DBG_INF_FMT("stmt=%lu field_count=%u", stmt->stmt_id, stmt->field_count); in MYSQLND_METHOD()
1608 if (stmt->state < MYSQLND_STMT_PREPARED) { in MYSQLND_METHOD()
1609 SET_STMT_ERROR(stmt, CR_NO_PREPARE_STMT, UNKNOWN_SQLSTATE, mysqlnd_stmt_not_prepared); in MYSQLND_METHOD()
1614 if (param_no >= stmt->field_count) { in MYSQLND_METHOD()
1615 SET_STMT_ERROR(stmt, CR_INVALID_PARAMETER_NO, UNKNOWN_SQLSTATE, "Invalid parameter number"); in MYSQLND_METHOD()
1620 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD()
1621 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
1623 if (stmt->field_count) { in MYSQLND_METHOD()
1626 if (!stmt->result_bind) { in MYSQLND_METHOD()
1627stmt->result_bind = mnd_pecalloc(stmt->field_count, sizeof(MYSQLND_RESULT_BIND), stmt->persistent); in MYSQLND_METHOD()
1629stmt->result_bind = mnd_perealloc(stmt->result_bind, stmt->field_count * sizeof(MYSQLND_RESULT_BIN… in MYSQLND_METHOD()
1631 if (!stmt->result_bind) { in MYSQLND_METHOD()
1634 ALLOC_INIT_ZVAL(stmt->result_bind[param_no].zv); in MYSQLND_METHOD()
1640 stmt->result_bind[param_no].bound = TRUE; in MYSQLND_METHOD()
1652 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1653 return stmt? stmt->upsert_status->last_insert_id : 0; in MYSQLND_METHOD()
1662 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1663 return stmt? stmt->upsert_status->affected_rows : 0; in MYSQLND_METHOD()
1672 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1673 return stmt && stmt->result? mysqlnd_num_rows(stmt->result):0; in MYSQLND_METHOD()
1682 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1683 return stmt? stmt->upsert_status->warning_count : 0; in MYSQLND_METHOD()
1692 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1693 return stmt? stmt->upsert_status->server_status : 0; in MYSQLND_METHOD()
1702 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1703 return stmt? stmt->field_count : 0; in MYSQLND_METHOD()
1712 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1713 return stmt? stmt->param_count : 0; in MYSQLND_METHOD()
1722 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1723 return stmt? stmt->error_info->error_no : 0; in MYSQLND_METHOD()
1732 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1733 return stmt? stmt->error_info->error : 0; in MYSQLND_METHOD()
1742 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1743 return stmt && stmt->error_info->sqlstate[0] ? stmt->error_info->sqlstate:MYSQLND_SQLSTATE_NULL; in MYSQLND_METHOD()
1752 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1753 return stmt && stmt->result? stmt->result->m.seek_data(stmt->result, row TSRMLS_CC) : FAIL; in MYSQLND_METHOD()
1762 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1763 if (!stmt || !stmt->param_count) { in MYSQLND_METHOD()
1775 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1779 if (!stmt) { in MYSQLND_METHOD()
1782 DBG_INF_FMT("stmt=%u field_count=%u", stmt->stmt_id, stmt->field_count); in MYSQLND_METHOD()
1784 if (!stmt->field_count || !stmt->conn || !stmt->result || !stmt->result->meta) { in MYSQLND_METHOD()
1789 if (stmt->update_max_length && stmt->result->stored_data) { in MYSQLND_METHOD()
1791 stmt->result->m.initialize_result_set_rest(stmt->result TSRMLS_CC); in MYSQLND_METHOD()
1803 result = stmt->conn->m->result_init(stmt->field_count, stmt->persistent TSRMLS_CC); in MYSQLND_METHOD()
1814 result->meta = stmt->result->meta->m->clone_metadata(stmt->result->meta, FALSE TSRMLS_CC); in MYSQLND_METHOD()
1823 SET_OOM_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD()
1838 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1840 if (!stmt) { in MYSQLND_METHOD()
1843 DBG_INF_FMT("stmt=%lu attr_type=%u", stmt->stmt_id, attr_type); in MYSQLND_METHOD()
1852 stmt->update_max_length = bval? TRUE:FALSE; in MYSQLND_METHOD()
1858 SET_STMT_ERROR(stmt, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "Not implemented"); in MYSQLND_METHOD()
1862 stmt->flags = ival; in MYSQLND_METHOD()
1870 SET_STMT_ERROR(stmt, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "Not implemented"); in MYSQLND_METHOD()
1874 stmt->prefetch_rows = ival; in MYSQLND_METHOD()
1878 SET_STMT_ERROR(stmt, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "Not implemented"); in MYSQLND_METHOD()
1893 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1895 if (!stmt) { in MYSQLND_METHOD()
1898 DBG_INF_FMT("stmt=%lu attr_type=%u", stmt->stmt_id, attr_type); in MYSQLND_METHOD()
1902 *(zend_bool *) value= stmt->update_max_length; in MYSQLND_METHOD()
1905 *(unsigned long *) value= stmt->flags; in MYSQLND_METHOD()
1908 *(unsigned long *) value= stmt->prefetch_rows; in MYSQLND_METHOD()
1924 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
1926 if (!stmt || !stmt->conn) { in MYSQLND_METHOD()
1929 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD()
1931 if (!stmt->result) { in MYSQLND_METHOD()
1940 if (stmt->state == MYSQLND_STMT_WAITING_USE_OR_STORE) { in MYSQLND_METHOD()
1943 stmt->default_rset_handler = s->m->use_result; in MYSQLND_METHOD()
1944 stmt->default_rset_handler(s TSRMLS_CC); in MYSQLND_METHOD()
1947 if (stmt->state > MYSQLND_STMT_WAITING_USE_OR_STORE) { in MYSQLND_METHOD()
1950 stmt->result->m.skip_result(stmt->result TSRMLS_CC); in MYSQLND_METHOD()
1958 stmt->result->m.free_result_buffers(stmt->result TSRMLS_CC); in MYSQLND_METHOD()
1961 if (stmt->state > MYSQLND_STMT_PREPARED) { in MYSQLND_METHOD()
1963 stmt->state = MYSQLND_STMT_PREPARED; in MYSQLND_METHOD()
1967 CONN_SET_STATE(stmt->conn, CONN_READY); in MYSQLND_METHOD()
1978 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in mysqlnd_stmt_separate_result_bind() local
1982 if (!stmt) { in mysqlnd_stmt_separate_result_bind()
1985 …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()
1987 if (!stmt->result_bind) { in mysqlnd_stmt_separate_result_bind()
1996 for (i = 0; i < stmt->field_count; i++) { in mysqlnd_stmt_separate_result_bind()
1998 if (stmt->result_bind[i].bound == TRUE) { in mysqlnd_stmt_separate_result_bind()
1999 DBG_INF_FMT("%u has refcount=%u", i, Z_REFCOUNT_P(stmt->result_bind[i].zv)); in mysqlnd_stmt_separate_result_bind()
2004 if (Z_REFCOUNT_P(stmt->result_bind[i].zv) > 1) { in mysqlnd_stmt_separate_result_bind()
2006 zval_copy_ctor(stmt->result_bind[i].zv); in mysqlnd_stmt_separate_result_bind()
2008 zval_ptr_dtor(&stmt->result_bind[i].zv); in mysqlnd_stmt_separate_result_bind()
2016 ZVAL_NULL(stmt->result_bind[i].zv); in mysqlnd_stmt_separate_result_bind()
2018 zval_ptr_dtor(&stmt->result_bind[i].zv); in mysqlnd_stmt_separate_result_bind()
2022 s->m->free_result_bind(s, stmt->result_bind TSRMLS_CC); in mysqlnd_stmt_separate_result_bind()
2023 stmt->result_bind = NULL; in mysqlnd_stmt_separate_result_bind()
2034 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in mysqlnd_stmt_separate_one_result_bind() local
2036 if (!stmt) { in mysqlnd_stmt_separate_one_result_bind()
2039 …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()
2041 if (!stmt->result_bind) { in mysqlnd_stmt_separate_one_result_bind()
2051 if (stmt->result_bind[param_no].bound == TRUE) { in mysqlnd_stmt_separate_one_result_bind()
2052 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()
2057 if (Z_REFCOUNT_P(stmt->result_bind[param_no].zv) > 1) { in mysqlnd_stmt_separate_one_result_bind()
2059 zval_copy_ctor(stmt->result_bind[param_no].zv); in mysqlnd_stmt_separate_one_result_bind()
2061 zval_ptr_dtor(&stmt->result_bind[param_no].zv); in mysqlnd_stmt_separate_one_result_bind()
2069 ZVAL_NULL(stmt->result_bind[param_no].zv); in mysqlnd_stmt_separate_one_result_bind()
2071 zval_ptr_dtor(&stmt->result_bind[param_no].zv); in mysqlnd_stmt_separate_one_result_bind()
2084 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
2086 if (!stmt) { in MYSQLND_METHOD()
2096 if (stmt->result) { in MYSQLND_METHOD()
2097 stmt->result->m.free_result_internal(stmt->result TSRMLS_CC); in MYSQLND_METHOD()
2098 stmt->result = NULL; in MYSQLND_METHOD()
2100 if (stmt->error_info->error_list) { in MYSQLND_METHOD()
2101 zend_llist_clean(stmt->error_info->error_list); in MYSQLND_METHOD()
2102 mnd_pefree(stmt->error_info->error_list, s->persistent); in MYSQLND_METHOD()
2103 stmt->error_info->error_list = NULL; in MYSQLND_METHOD()
2115 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
2117 if (!stmt) { in MYSQLND_METHOD()
2120 …DBG_INF_FMT("stmt=%lu param_bind=%p param_count=%u", stmt->stmt_id, stmt->param_bind, stmt->param_… in MYSQLND_METHOD()
2123 if (stmt->param_bind) { in MYSQLND_METHOD()
2130 for (i = 0; i < stmt->param_count; i++) { in MYSQLND_METHOD()
2135 if (stmt->param_bind[i].zv) { in MYSQLND_METHOD()
2136 zval_ptr_dtor(&stmt->param_bind[i].zv); in MYSQLND_METHOD()
2139 s->m->free_parameter_bind(s, stmt->param_bind TSRMLS_CC); in MYSQLND_METHOD()
2140 stmt->param_bind = NULL; in MYSQLND_METHOD()
2153 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD_PRIVATE() local
2159 if (!stmt || !stmt->conn) { in MYSQLND_METHOD_PRIVATE()
2162 DBG_INF_FMT("stmt=%lu", stmt->stmt_id); in MYSQLND_METHOD_PRIVATE()
2164 conn = stmt->conn; in MYSQLND_METHOD_PRIVATE()
2166 SET_EMPTY_ERROR(*stmt->error_info); in MYSQLND_METHOD_PRIVATE()
2167 SET_EMPTY_ERROR(*stmt->conn->error_info); in MYSQLND_METHOD_PRIVATE()
2175 if (stmt->state == MYSQLND_STMT_WAITING_USE_OR_STORE) { in MYSQLND_METHOD_PRIVATE()
2177 stmt->default_rset_handler(s TSRMLS_CC); in MYSQLND_METHOD_PRIVATE()
2178 stmt->state = MYSQLND_STMT_USER_FETCHING; in MYSQLND_METHOD_PRIVATE()
2182 if (stmt->result) { in MYSQLND_METHOD_PRIVATE()
2184 stmt->result->m.skip_result(stmt->result TSRMLS_CC); in MYSQLND_METHOD_PRIVATE()
2191 if (stmt->stmt_id) { in MYSQLND_METHOD_PRIVATE()
2195 int4store(cmd_buf, stmt->stmt_id); in MYSQLND_METHOD_PRIVATE()
2200 COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info); in MYSQLND_METHOD_PRIVATE()
2204 switch (stmt->execute_count) { in MYSQLND_METHOD_PRIVATE()
2218 if (stmt->execute_cmd_buffer.buffer) { in MYSQLND_METHOD_PRIVATE()
2219 mnd_pefree(stmt->execute_cmd_buffer.buffer, stmt->persistent); in MYSQLND_METHOD_PRIVATE()
2220 stmt->execute_cmd_buffer.buffer = NULL; in MYSQLND_METHOD_PRIVATE()
2225 if (stmt->conn) { in MYSQLND_METHOD_PRIVATE()
2226 stmt->conn->m->free_reference(stmt->conn TSRMLS_CC); in MYSQLND_METHOD_PRIVATE()
2227 stmt->conn = NULL; in MYSQLND_METHOD_PRIVATE()
2238 MYSQLND_STMT_DATA * stmt = (s != NULL) ? s->data:NULL; in MYSQLND_METHOD() local
2243 if (stmt) { in MYSQLND_METHOD()
2244 DBG_INF_FMT("stmt=%p", stmt); in MYSQLND_METHOD()
2250 mnd_pefree(stmt, persistent); in MYSQLND_METHOD()
2264 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
2266 if (!stmt) { in MYSQLND_METHOD()
2269 DBG_RETURN(mnd_pecalloc(stmt->param_count, sizeof(MYSQLND_PARAM_BIND), stmt->persistent)); in MYSQLND_METHOD()
2278 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
2280 if (!stmt) { in MYSQLND_METHOD()
2283 DBG_RETURN(mnd_pecalloc(stmt->field_count, sizeof(MYSQLND_RESULT_BIND), stmt->persistent)); in MYSQLND_METHOD()
2292 MYSQLND_STMT_DATA * stmt = s? s->data:NULL; in MYSQLND_METHOD() local
2293 if (stmt) { in MYSQLND_METHOD()
2294 mnd_pefree(param_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(result_bind, stmt->persistent); in MYSQLND_METHOD()