/* {{{ send_command_do_request */
static enum_func_status
send_command_do_request(
- MYSQLND_CONN_DATA * const conn,
const enum php_mysqlnd_server_command command,
const zend_uchar * const arg, const size_t arg_len,
const zend_bool silent,
- const zend_bool ignore_upsert_status,
struct st_mysqlnd_connection_state * connection_state,
MYSQLND_ERROR_INFO * error_info,
MYSQLND_UPSERT_STATUS * upsert_status,
MYSQLND_STATS * stats,
- MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * payload_decoder_factory
- )
+ MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * payload_decoder_factory,
+ func_mysqlnd_conn_data__send_close send_close,
+ void * send_close_ctx
+)
{
enum_func_status ret = PASS;
MYSQLND_PACKET_COMMAND * cmd_packet = NULL;
php_error(E_WARNING, "Error while sending %s packet. PID=%d", mysqlnd_command_to_text[command], getpid());
}
connection_state->m->set(connection_state, CONN_QUIT_SENT);
- conn->m->send_close(conn);
+ send_close(send_close_ctx);
DBG_ERR("Server is gone");
ret = FAIL;
}
DBG_ENTER("mysqlnd_com_set_option_run");
int2store(buffer, (unsigned int) option);
- ret = send_command_do_request(conn, COM_SET_OPTION, buffer, sizeof(buffer), FALSE, TRUE,
- &conn->state, conn->error_info, conn->upsert_status, conn->stats, conn->payload_decoder_factory);
+ ret = send_command_do_request(COM_SET_OPTION, buffer, sizeof(buffer), FALSE,
+ &conn->state,
+ conn->error_info,
+ conn->upsert_status,
+ conn->stats,
+ conn->payload_decoder_factory,
+ conn->m->send_close,
+ conn);
if (PASS == ret) {
ret = conn->m->send_command_handle_response(conn, PROT_EOF_PACKET, FALSE, COM_SET_OPTION, TRUE);
}
DBG_ENTER("mysqlnd_com_debug_run");
- ret = send_command_do_request(conn, COM_DEBUG, NULL, 0, FALSE, TRUE,
- &conn->state, conn->error_info, conn->upsert_status, conn->stats, conn->payload_decoder_factory);
+ ret = send_command_do_request(COM_DEBUG, NULL, 0, FALSE,
+ &conn->state,
+ conn->error_info,
+ conn->upsert_status,
+ conn->stats,
+ conn->payload_decoder_factory,
+ conn->m->send_close,
+ conn);
if (PASS == ret) {
ret = conn->m->send_command_handle_response(conn, PROT_EOF_PACKET, COM_DEBUG, COM_DEBUG, TRUE);
}
DBG_ENTER("mysqlnd_com_init_db_run");
- ret = send_command_do_request(conn, COM_INIT_DB, (zend_uchar*) command->context.db.s, command->context.db.l, FALSE, TRUE,
- &conn->state, conn->error_info, conn->upsert_status, conn->stats, conn->payload_decoder_factory);
+ ret = send_command_do_request(COM_INIT_DB, (zend_uchar*) command->context.db.s, command->context.db.l, FALSE,
+ &conn->state,
+ conn->error_info,
+ conn->upsert_status,
+ conn->stats,
+ conn->payload_decoder_factory,
+ conn->m->send_close,
+ conn);
if (PASS == ret) {
ret = conn->m->send_command_handle_response(conn, PROT_OK_PACKET, FALSE, COM_INIT_DB, TRUE);
}
DBG_ENTER("mysqlnd_com_ping_run");
- ret = send_command_do_request(conn, COM_PING, NULL, 0, TRUE, TRUE,
- &conn->state, conn->error_info, conn->upsert_status, conn->stats, conn->payload_decoder_factory);
+ ret = send_command_do_request(COM_PING, NULL, 0, TRUE,
+ &conn->state,
+ conn->error_info,
+ conn->upsert_status,
+ conn->stats,
+ conn->payload_decoder_factory,
+ conn->m->send_close,
+ conn);
if (PASS == ret) {
ret = conn->m->send_command_handle_response(conn, PROT_OK_PACKET, TRUE, COM_PING, TRUE);
}
*p++ = '\0';
}
- ret = send_command_do_request(conn, COM_FIELD_LIST, buff, p - buff, FALSE, TRUE,
- &conn->state, conn->error_info, conn->upsert_status, conn->stats, conn->payload_decoder_factory);
+ ret = send_command_do_request(COM_FIELD_LIST, buff, p - buff, FALSE,
+ &conn->state,
+ conn->error_info,
+ conn->upsert_status,
+ conn->stats,
+ conn->payload_decoder_factory,
+ conn->m->send_close,
+ conn);
DBG_RETURN(ret);
}
DBG_ENTER("mysqlnd_com_statistics_run");
- ret = send_command_do_request(conn, COM_STATISTICS, NULL, 0, FALSE, TRUE,
- &conn->state, conn->error_info, conn->upsert_status, conn->stats, conn->payload_decoder_factory);
+ ret = send_command_do_request(COM_STATISTICS, NULL, 0, FALSE,
+ &conn->state,
+ conn->error_info,
+ conn->upsert_status,
+ conn->stats,
+ conn->payload_decoder_factory,
+ conn->m->send_close,
+ conn);
DBG_RETURN(ret);
}
DBG_ENTER("mysqlnd_com_process_kill_run");
int4store(buff, command->context.process_id);
- ret = send_command_do_request(conn, COM_PROCESS_KILL, buff, 4, FALSE, TRUE,
- &conn->state, conn->error_info, conn->upsert_status, conn->stats, conn->payload_decoder_factory);
+ ret = send_command_do_request(COM_PROCESS_KILL, buff, 4, FALSE,
+ &conn->state,
+ conn->error_info,
+ conn->upsert_status,
+ conn->stats,
+ conn->payload_decoder_factory,
+ conn->m->send_close,
+ conn);
if (PASS == ret && command->context.read_response) {
ret = conn->m->send_command_handle_response(conn, PROT_OK_PACKET, FALSE, COM_PROCESS_KILL, TRUE);
}
DBG_ENTER("mysqlnd_com_refresh_run");
int1store(bits, command->context.options);
- ret = send_command_do_request(conn, COM_REFRESH, bits, 1, FALSE, TRUE,
- &conn->state, conn->error_info, conn->upsert_status, conn->stats, conn->payload_decoder_factory);
+ ret = send_command_do_request(COM_REFRESH, bits, 1, FALSE,
+ &conn->state,
+ conn->error_info,
+ conn->upsert_status,
+ conn->stats,
+ conn->payload_decoder_factory,
+ conn->m->send_close,
+ conn);
if (PASS == ret) {
ret = conn->m->send_command_handle_response(conn, PROT_OK_PACKET, FALSE, COM_REFRESH, TRUE);
}
DBG_ENTER("mysqlnd_com_shutdown_run");
int1store(bits, command->context.level);
- ret = send_command_do_request(conn, COM_SHUTDOWN, bits, 1, FALSE, TRUE,
- &conn->state, conn->error_info, conn->upsert_status, conn->stats, conn->payload_decoder_factory);
+ ret = send_command_do_request(COM_SHUTDOWN, bits, 1, FALSE,
+ &conn->state,
+ conn->error_info,
+ conn->upsert_status,
+ conn->stats,
+ conn->payload_decoder_factory,
+ conn->m->send_close,
+ conn);
if (PASS == ret) {
ret = conn->m->send_command_handle_response(conn, PROT_OK_PACKET, FALSE, COM_SHUTDOWN, TRUE);
}
DBG_ENTER("mysqlnd_com_quit_run");
- ret = send_command_do_request(conn, COM_QUIT, NULL, 0, TRUE, TRUE,
- &conn->state, conn->error_info, conn->upsert_status, conn->stats, conn->payload_decoder_factory);
+ ret = send_command_do_request(COM_QUIT, NULL, 0, TRUE,
+ &conn->state,
+ conn->error_info,
+ conn->upsert_status,
+ conn->stats,
+ conn->payload_decoder_factory,
+ conn->m->send_close,
+ conn);
DBG_RETURN(ret);
}
DBG_ENTER("mysqlnd_com_query_run");
- ret = send_command_do_request(conn, COM_QUERY, (zend_uchar*) command->context.query.s, command->context.query.l, FALSE, FALSE,
- &conn->state, conn->error_info, conn->upsert_status, conn->stats, conn->payload_decoder_factory);
+ ret = send_command_do_request(COM_QUERY, (zend_uchar*) command->context.query.s, command->context.query.l, FALSE,
+ &conn->state,
+ conn->error_info,
+ conn->upsert_status,
+ conn->stats,
+ conn->payload_decoder_factory,
+ conn->m->send_close,
+ conn);
if (PASS == ret) {
SET_CONNECTION_STATE(&conn->state, CONN_QUERY_SENT);
DBG_ENTER("mysqlnd_com_change_user_run");
- ret = send_command_do_request(conn, COM_CHANGE_USER, (zend_uchar*) command->context.payload.s, command->context.payload.l, command->context.silent, TRUE,
- &conn->state, conn->error_info, conn->upsert_status, conn->stats, conn->payload_decoder_factory);
+ ret = send_command_do_request(COM_CHANGE_USER, (zend_uchar*) command->context.payload.s, command->context.payload.l, command->context.silent,
+ &conn->state,
+ conn->error_info,
+ conn->upsert_status,
+ conn->stats,
+ conn->payload_decoder_factory,
+ conn->m->send_close,
+ conn);
DBG_RETURN(ret);
}
DBG_ENTER("mysqlnd_com_stmt_prepare_run");
- ret = send_command_do_request(conn, COM_STMT_PREPARE, (zend_uchar*) command->context.query.s, command->context.query.l, FALSE, TRUE,
- &conn->state, conn->error_info, conn->upsert_status, conn->stats, conn->payload_decoder_factory);
+ ret = send_command_do_request(COM_STMT_PREPARE, (zend_uchar*) command->context.query.s, command->context.query.l, FALSE,
+ &conn->state,
+ conn->error_info,
+ conn->upsert_status,
+ conn->stats,
+ conn->payload_decoder_factory,
+ conn->m->send_close,
+ conn);
DBG_RETURN(ret);
}
DBG_ENTER("mysqlnd_com_stmt_execute_run");
- ret = send_command_do_request(conn, COM_STMT_EXECUTE, (zend_uchar*) command->context.payload.s, command->context.payload.l, FALSE, FALSE,
- &conn->state, conn->error_info, conn->upsert_status, conn->stats, conn->payload_decoder_factory);
+ ret = send_command_do_request(COM_STMT_EXECUTE, (zend_uchar*) command->context.payload.s, command->context.payload.l, FALSE,
+ &conn->state,
+ conn->error_info,
+ conn->upsert_status,
+ conn->stats,
+ conn->payload_decoder_factory,
+ conn->m->send_close,
+ conn);
DBG_RETURN(ret);
}
DBG_ENTER("mysqlnd_com_stmt_fetch_run");
- ret = send_command_do_request(conn, COM_STMT_FETCH, (zend_uchar*) command->context.payload.s, command->context.payload.l, FALSE, TRUE,
- &conn->state, conn->error_info, conn->upsert_status, conn->stats, conn->payload_decoder_factory);
+ ret = send_command_do_request(COM_STMT_FETCH, (zend_uchar*) command->context.payload.s, command->context.payload.l, FALSE,
+ &conn->state,
+ conn->error_info,
+ conn->upsert_status,
+ conn->stats,
+ conn->payload_decoder_factory,
+ conn->m->send_close,
+ conn);
DBG_RETURN(ret);
}
DBG_ENTER("mysqlnd_com_stmt_reset_run");
int4store(cmd_buf, command->context.stmt_id);
- ret = send_command_do_request(conn, COM_STMT_RESET, cmd_buf, sizeof(cmd_buf), FALSE, TRUE,
- &conn->state, conn->error_info, conn->upsert_status, conn->stats, conn->payload_decoder_factory);
+ ret = send_command_do_request(COM_STMT_RESET, cmd_buf, sizeof(cmd_buf), FALSE,
+ &conn->state,
+ conn->error_info,
+ conn->upsert_status,
+ conn->stats,
+ conn->payload_decoder_factory,
+ conn->m->send_close,
+ conn);
DBG_RETURN(ret);
}
DBG_ENTER("mysqlnd_com_stmt_send_long_data_run");
- ret = send_command_do_request(conn, COM_STMT_SEND_LONG_DATA, (zend_uchar*) command->context.payload.s, command->context.payload.l, FALSE, TRUE,
- &conn->state, conn->error_info, conn->upsert_status, conn->stats, conn->payload_decoder_factory);
+ ret = send_command_do_request(COM_STMT_SEND_LONG_DATA, (zend_uchar*) command->context.payload.s, command->context.payload.l, FALSE,
+ &conn->state,
+ conn->error_info,
+ conn->upsert_status,
+ conn->stats,
+ conn->payload_decoder_factory,
+ conn->m->send_close,
+ conn);
DBG_RETURN(ret);
}
DBG_ENTER("mysqlnd_com_stmt_close_run");
int4store(cmd_buf, command->context.stmt_id);
- ret = send_command_do_request(conn, COM_STMT_CLOSE, cmd_buf, sizeof(cmd_buf), FALSE, TRUE,
- &conn->state, conn->error_info, conn->upsert_status, conn->stats, conn->payload_decoder_factory);
+ ret = send_command_do_request(COM_STMT_CLOSE, cmd_buf, sizeof(cmd_buf), FALSE,
+ &conn->state,
+ conn->error_info,
+ conn->upsert_status,
+ conn->stats,
+ conn->payload_decoder_factory,
+ conn->m->send_close,
+ conn);
DBG_RETURN(ret);
}