Lines Matching refs:conn

220 MYSQLND_METHOD(mysqlnd_conn_data, free_options)(MYSQLND_CONN_DATA * conn)  in MYSQLND_METHOD()
222 zend_bool pers = conn->persistent; in MYSQLND_METHOD()
224 if (conn->options->charset_name) { in MYSQLND_METHOD()
225 mnd_pefree(conn->options->charset_name, pers); in MYSQLND_METHOD()
226 conn->options->charset_name = NULL; in MYSQLND_METHOD()
228 if (conn->options->auth_protocol) { in MYSQLND_METHOD()
229 mnd_pefree(conn->options->auth_protocol, pers); in MYSQLND_METHOD()
230 conn->options->auth_protocol = NULL; in MYSQLND_METHOD()
232 if (conn->options->num_commands) { in MYSQLND_METHOD()
234 for (i = 0; i < conn->options->num_commands; i++) { in MYSQLND_METHOD()
236 mnd_pefree(conn->options->init_commands[i], pers); in MYSQLND_METHOD()
238 mnd_pefree(conn->options->init_commands, pers); in MYSQLND_METHOD()
239 conn->options->init_commands = NULL; in MYSQLND_METHOD()
241 if (conn->options->cfg_file) { in MYSQLND_METHOD()
242 mnd_pefree(conn->options->cfg_file, pers); in MYSQLND_METHOD()
243 conn->options->cfg_file = NULL; in MYSQLND_METHOD()
245 if (conn->options->cfg_section) { in MYSQLND_METHOD()
246 mnd_pefree(conn->options->cfg_section, pers); in MYSQLND_METHOD()
247 conn->options->cfg_section = NULL; in MYSQLND_METHOD()
249 if (conn->options->connect_attr) { in MYSQLND_METHOD()
250 zend_hash_destroy(conn->options->connect_attr); in MYSQLND_METHOD()
251 mnd_pefree(conn->options->connect_attr, pers); in MYSQLND_METHOD()
252 conn->options->connect_attr = NULL; in MYSQLND_METHOD()
260 MYSQLND_METHOD(mysqlnd_conn_data, free_contents)(MYSQLND_CONN_DATA * conn) in MYSQLND_METHOD()
262 zend_bool pers = conn->persistent; in MYSQLND_METHOD()
266 if (conn->current_result) { in MYSQLND_METHOD()
267 conn->current_result->m.free_result(conn->current_result, TRUE); in MYSQLND_METHOD()
268 conn->current_result = NULL; in MYSQLND_METHOD()
271 if (conn->protocol_frame_codec) { in MYSQLND_METHOD()
272 conn->protocol_frame_codec->data->m.free_contents(conn->protocol_frame_codec); in MYSQLND_METHOD()
275 if (conn->vio) { in MYSQLND_METHOD()
276 conn->vio->data->m.free_contents(conn->vio); in MYSQLND_METHOD()
281 if (conn->hostname.s) { in MYSQLND_METHOD()
282 mnd_pefree(conn->hostname.s, pers); in MYSQLND_METHOD()
283 conn->hostname.s = NULL; in MYSQLND_METHOD()
285 if (conn->username.s) { in MYSQLND_METHOD()
286 mnd_pefree(conn->username.s, pers); in MYSQLND_METHOD()
287 conn->username.s = NULL; in MYSQLND_METHOD()
289 if (conn->password.s) { in MYSQLND_METHOD()
290 mnd_pefree(conn->password.s, pers); in MYSQLND_METHOD()
291 conn->password.s = NULL; in MYSQLND_METHOD()
293 if (conn->connect_or_select_db.s) { in MYSQLND_METHOD()
294 mnd_pefree(conn->connect_or_select_db.s, pers); in MYSQLND_METHOD()
295 conn->connect_or_select_db.s = NULL; in MYSQLND_METHOD()
297 if (conn->unix_socket.s) { in MYSQLND_METHOD()
298 mnd_pefree(conn->unix_socket.s, pers); in MYSQLND_METHOD()
299 conn->unix_socket.s = NULL; in MYSQLND_METHOD()
301 DBG_INF_FMT("scheme=%s", conn->scheme.s); in MYSQLND_METHOD()
302 if (conn->scheme.s) { in MYSQLND_METHOD()
303 mnd_pefree(conn->scheme.s, pers); in MYSQLND_METHOD()
304 conn->scheme.s = NULL; in MYSQLND_METHOD()
306 if (conn->server_version) { in MYSQLND_METHOD()
307 mnd_pefree(conn->server_version, pers); in MYSQLND_METHOD()
308 conn->server_version = NULL; in MYSQLND_METHOD()
310 if (conn->host_info) { in MYSQLND_METHOD()
311 mnd_pefree(conn->host_info, pers); in MYSQLND_METHOD()
312 conn->host_info = NULL; in MYSQLND_METHOD()
314 if (conn->authentication_plugin_data.s) { in MYSQLND_METHOD()
315 mnd_pefree(conn->authentication_plugin_data.s, pers); in MYSQLND_METHOD()
316 conn->authentication_plugin_data.s = NULL; in MYSQLND_METHOD()
318 if (conn->last_message.s) { in MYSQLND_METHOD()
319 mnd_efree(conn->last_message.s); in MYSQLND_METHOD()
320 conn->last_message.s = NULL; in MYSQLND_METHOD()
323 conn->charset = NULL; in MYSQLND_METHOD()
324 conn->greet_charset = NULL; in MYSQLND_METHOD()
333 MYSQLND_METHOD_PRIVATE(mysqlnd_conn_data, dtor)(MYSQLND_CONN_DATA * conn) in MYSQLND_METHOD_PRIVATE()
336 DBG_INF_FMT("conn=%llu", conn->thread_id); in MYSQLND_METHOD_PRIVATE()
338 conn->m->free_contents(conn); in MYSQLND_METHOD_PRIVATE()
339 conn->m->free_options(conn); in MYSQLND_METHOD_PRIVATE()
341 if (conn->error_info) { in MYSQLND_METHOD_PRIVATE()
342 mysqlnd_error_info_free_contents(conn->error_info); in MYSQLND_METHOD_PRIVATE()
343 conn->error_info = NULL; in MYSQLND_METHOD_PRIVATE()
346 if (conn->protocol_frame_codec) { in MYSQLND_METHOD_PRIVATE()
347 mysqlnd_pfc_free(conn->protocol_frame_codec, conn->stats, conn->error_info); in MYSQLND_METHOD_PRIVATE()
348 conn->protocol_frame_codec = NULL; in MYSQLND_METHOD_PRIVATE()
351 if (conn->vio) { in MYSQLND_METHOD_PRIVATE()
352 mysqlnd_vio_free(conn->vio, conn->stats, conn->error_info); in MYSQLND_METHOD_PRIVATE()
353 conn->vio = NULL; in MYSQLND_METHOD_PRIVATE()
356 if (conn->payload_decoder_factory) { in MYSQLND_METHOD_PRIVATE()
357 mysqlnd_protocol_payload_decoder_factory_free(conn->payload_decoder_factory); in MYSQLND_METHOD_PRIVATE()
358 conn->payload_decoder_factory = NULL; in MYSQLND_METHOD_PRIVATE()
361 if (conn->stats) { in MYSQLND_METHOD_PRIVATE()
362 mysqlnd_stats_end(conn->stats, conn->persistent); in MYSQLND_METHOD_PRIVATE()
365 mnd_pefree(conn, conn->persistent); in MYSQLND_METHOD_PRIVATE()
374 MYSQLND_METHOD(mysqlnd_conn_data, set_server_option)(MYSQLND_CONN_DATA * const conn, enum_mysqlnd_s… in MYSQLND_METHOD()
379 if (PASS == conn->m->local_tx_start(conn, this_func)) { in MYSQLND_METHOD()
380 ret = conn->command->set_option(conn, option); in MYSQLND_METHOD()
381 conn->m->local_tx_end(conn, this_func, ret); in MYSQLND_METHOD()
390 MYSQLND_METHOD(mysqlnd_conn_data, restart_psession)(MYSQLND_CONN_DATA * conn) in MYSQLND_METHOD()
393 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_CONNECT_REUSED); in MYSQLND_METHOD()
394 conn->current_result = NULL; in MYSQLND_METHOD()
395 conn->last_message.s = NULL; in MYSQLND_METHOD()
403 MYSQLND_METHOD(mysqlnd_conn_data, end_psession)(MYSQLND_CONN_DATA * conn) in MYSQLND_METHOD()
407 if (conn->current_result) { in MYSQLND_METHOD()
408 conn->current_result->m.free_result(conn->current_result, TRUE); in MYSQLND_METHOD()
409 conn->current_result = NULL; in MYSQLND_METHOD()
411 if (conn->last_message.s) { in MYSQLND_METHOD()
412 mnd_efree(conn->last_message.s); in MYSQLND_METHOD()
413 conn->last_message.s = NULL; in MYSQLND_METHOD()
415 conn->error_info = &conn->error_info_impl; in MYSQLND_METHOD()
441 MYSQLND_METHOD(mysqlnd_conn_data, execute_init_commands)(MYSQLND_CONN_DATA * conn) in MYSQLND_METHOD()
446 if (conn->options->init_commands) { in MYSQLND_METHOD()
448 for (; current_command < conn->options->num_commands; ++current_command) { in MYSQLND_METHOD()
449 const char * const command = conn->options->init_commands[current_command]; in MYSQLND_METHOD()
451 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_INIT_COMMAND_EXECUTED_COUNT); in MYSQLND_METHOD()
452 if (PASS != conn->m->query(conn, command, strlen(command))) { in MYSQLND_METHOD()
453 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_INIT_COMMAND_FAILED_COUNT); in MYSQLND_METHOD()
458 if (conn->last_query_type == QUERY_SELECT) { in MYSQLND_METHOD()
459 MYSQLND_RES * result = conn->m->use_result(conn, 0); in MYSQLND_METHOD()
464 } while (conn->m->next_result(conn) != FAIL); in MYSQLND_METHOD()
475 MYSQLND_METHOD(mysqlnd_conn_data, get_updated_connect_flags)(MYSQLND_CONN_DATA * conn, unsigned int… in MYSQLND_METHOD()
478 MYSQLND_PFC * pfc = conn->protocol_frame_codec; in MYSQLND_METHOD()
480 MYSQLND_VIO * vio = conn->vio; in MYSQLND_METHOD()
487 mysql_flags |= conn->options->flags; /* use the flags from set_client_option() */ in MYSQLND_METHOD()
513 if (conn->options->connect_attr && zend_hash_num_elements(conn->options->connect_attr)) { in MYSQLND_METHOD()
524 MYSQLND_METHOD(mysqlnd_conn_data, connect_handshake)(MYSQLND_CONN_DATA * conn, in MYSQLND_METHOD()
534 …if (PASS == conn->vio->data->m.connect(conn->vio, *scheme, conn->persistent, conn->stats, conn->er… in MYSQLND_METHOD()
535 …PASS == conn->protocol_frame_codec->data->m.reset(conn->protocol_frame_codec, conn->stats, conn->e… in MYSQLND_METHOD()
539 ret = conn->command->handshake(conn, *username, *password, *database, client_flags); in MYSQLND_METHOD()
547 MYSQLND_METHOD(mysqlnd_conn_data, get_scheme)(MYSQLND_CONN_DATA * conn, MYSQLND_CSTRING hostname, M…
584 MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn,
600 MYSQLND_PFC * pfc = conn->protocol_frame_codec;
604 DBG_INF_FMT("conn=%p", conn);
606 if (PASS != conn->m->local_tx_start(conn, this_func)) {
611 SET_EMPTY_ERROR(conn->error_info);
612 UPSERT_STATUS_SET_AFFECTED_ROWS_TO_ERROR(conn->upsert_status);
616 conn? conn->persistent:0, conn? (int)GET_CONNECTION_STATE(&conn->state):-1);
618 if (GET_CONNECTION_STATE(&conn->state) > CONN_ALLOCED) {
621 if (GET_CONNECTION_STATE(&conn->state) < CONN_QUIT_SENT) {
622 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_CLOSE_IMPLICIT);
624 conn->m->send_close(conn);
627 conn->m->free_contents(conn);
643 conn->m->set_client_option(conn, MYSQLND_OPT_MAX_ALLOWED_PACKET, (char *)&max_allowed_size);
668 transport = conn->m->get_scheme(conn, hostname, &socket_or_pipe, port, &unix_socket, &named_pipe);
670 mysql_flags = conn->m->get_updated_connect_flags(conn, mysql_flags);
674 …if (FAIL == conn->m->connect_handshake(conn, &scheme, &username, &password, &database, mysql_flags…
680 SET_CONNECTION_STATE(&conn->state, CONN_READY);
693 conn->scheme.s = mnd_pestrndup(transport.s, transport.l, conn->persistent);
694 conn->scheme.l = transport.l;
700 if (!conn->scheme.s) {
704 conn->username.l = username.l;
705 conn->username.s = mnd_pestrndup(username.s, conn->username.l, conn->persistent);
706 conn->password.l = password.l;
707 conn->password.s = mnd_pestrndup(password.s, conn->password.l, conn->persistent);
708 conn->port = port;
709 conn->connect_or_select_db.l = database.l;
710conn->connect_or_select_db.s = mnd_pestrndup(database.s, conn->connect_or_select_db.l, conn->persi…
712 if (!conn->username.s || !conn->password.s|| !conn->connect_or_select_db.s) {
713 SET_OOM_ERROR(conn->error_info);
718 conn->hostname.s = mnd_pestrndup(hostname.s, hostname.l, conn->persistent);
719 if (!conn->hostname.s) {
720 SET_OOM_ERROR(conn->error_info);
723 conn->hostname.l = hostname.l;
726 mnd_sprintf(&p, 0, "%s via TCP/IP", conn->hostname.s);
728 SET_OOM_ERROR(conn->error_info);
731 conn->host_info = mnd_pestrdup(p, conn->persistent);
733 if (!conn->host_info) {
734 SET_OOM_ERROR(conn->error_info);
739 conn->unix_socket.s = mnd_pestrdup(socket_or_pipe.s, conn->persistent);
741 conn->host_info = mnd_pestrdup("Localhost via UNIX socket", conn->persistent);
744 mnd_sprintf(&p, 0, "%s via named pipe", conn->unix_socket.s);
746 SET_OOM_ERROR(conn->error_info);
749 conn->host_info = mnd_pestrdup(p, conn->persistent);
751 if (!conn->host_info) {
752 SET_OOM_ERROR(conn->error_info);
758 if (!conn->unix_socket.s || !conn->host_info) {
759 SET_OOM_ERROR(conn->error_info);
762 conn->unix_socket.l = strlen(conn->unix_socket.s);
765 SET_EMPTY_ERROR(conn->error_info);
767 mysqlnd_local_infile_default(conn);
769 if (FAIL == conn->m->execute_init_commands(conn)) {
773 …MYSQLND_INC_CONN_STATISTIC_W_VALUE2(conn->stats, STAT_CONNECT_SUCCESS, 1, STAT_OPENED_CONNECTIONS,…
777 if (conn->persistent) {
778 …MYSQLND_INC_CONN_STATISTIC_W_VALUE2(conn->stats, STAT_PCONNECT_SUCCESS, 1, STAT_OPENED_PERSISTENT_…
781 DBG_INF_FMT("connection_id=%llu", conn->thread_id);
783 conn->m->local_tx_end(conn, this_func, PASS);
792 …R_FMT("[%u] %.128s (trying to connect via %s)", conn->error_info->error_no, conn->error_info->erro…
793 if (!conn->error_info->error_no) {
794 …SET_CLIENT_ERROR(conn->error_info, CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE, conn->error_info->error);
795 …NING, "[%u] %.128s (trying to connect via %s)", conn->error_info->error_no, conn->error_info->erro…
798 conn->m->free_contents(conn);
799 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_CONNECT_FAILURE);
801 conn->m->local_tx_end(conn, this_func, FAIL);
822 MYSQLND_CONN_DATA * conn = conn_handle->data; local
826 if (PASS == conn->m->local_tx_start(conn, this_func)) {
831 …ret = conn->m->connect(conn, hostname, username, password, database, port, socket_or_pipe, mysql_f…
833 conn->m->local_tx_end(conn, this_func, FAIL);
846 MYSQLND_METHOD(mysqlnd_conn_data, query)(MYSQLND_CONN_DATA * conn, const char * const query, const …
851 DBG_INF_FMT("conn=%p conn=%llu query=%s", conn, conn->thread_id, query);
853 if (PASS == conn->m->local_tx_start(conn, this_func)) {
854 …if (PASS == conn->m->send_query(conn, query, query_len, MYSQLND_SEND_QUERY_IMPLICIT, NULL, NULL) &&
855 PASS == conn->m->reap_query(conn, MYSQLND_REAP_RESULT_IMPLICIT))
858 …if (conn->last_query_type == QUERY_UPSERT && UPSERT_STATUS_GET_AFFECTED_ROWS(conn->upsert_status))…
859 …MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn->stats, STAT_ROWS_AFFECTED_NORMAL, UPSERT_STATUS_GET_AFFEC…
862 conn->m->local_tx_end(conn, this_func, ret);
871 MYSQLND_METHOD(mysqlnd_conn_data, send_query)(MYSQLND_CONN_DATA * conn, const char * const query, c…
877 DBG_INF_FMT("conn=%llu query=%s", conn->thread_id, query);
878 DBG_INF_FMT("conn->server_status=%u", UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status));
880 if (type == MYSQLND_SEND_QUERY_IMPLICIT || PASS == conn->m->local_tx_start(conn, this_func))
884 ret = conn->command->query(conn, query_string);
887 conn->m->local_tx_end(conn, this_func, ret);
890 DBG_INF_FMT("conn->server_status=%u", UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status));
898 MYSQLND_METHOD(mysqlnd_conn_data, reap_query)(MYSQLND_CONN_DATA * conn, enum_mysqlnd_reap_result_ty…
903 DBG_INF_FMT("conn=%llu", conn->thread_id);
905 DBG_INF_FMT("conn->server_status=%u", UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status));
906 if (type == MYSQLND_REAP_RESULT_IMPLICIT || PASS == conn->m->local_tx_start(conn, this_func))
908 ret = conn->command->reap_result(conn);
911 conn->m->local_tx_end(conn, this_func, ret);
914 DBG_INF_FMT("conn->server_status=%u", UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status));
922 MYSQLND_METHOD(mysqlnd_conn_data, list_method)(MYSQLND_CONN_DATA * conn, const char * const query, …
930 DBG_INF_FMT("conn=%llu query=%s wild=%u", conn->thread_id, query, achtung_wild);
932 if (PASS == conn->m->local_tx_start(conn, this_func)) {
947 if (PASS == conn->m->query(conn, show_query, show_query_len)) {
948 result = conn->m->store_result(conn, MYSQLND_STORE_NO_COPY);
953 conn->m->local_tx_end(conn, this_func, result == NULL? FAIL:PASS);
962 MYSQLND_METHOD(mysqlnd_conn_data, err_no)(const MYSQLND_CONN_DATA * const conn)
964 return conn->error_info->error_no;
971 MYSQLND_METHOD(mysqlnd_conn_data, error)(const MYSQLND_CONN_DATA * const conn)
973 return conn->error_info->error;
980 MYSQLND_METHOD(mysqlnd_conn_data, sqlstate)(const MYSQLND_CONN_DATA * const conn)
982 return conn->error_info->sqlstate[0] ? conn->error_info->sqlstate:MYSQLND_SQLSTATE_NULL;
999 MYSQLND_METHOD(mysqlnd_conn_data, ssl_set)(MYSQLND_CONN_DATA * const conn, const char * key, const …
1004 MYSQLND_VIO * vio = conn->vio;
1007 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1014 conn->m->local_tx_end(conn, this_func, ret);
1023 MYSQLND_METHOD(mysqlnd_conn_data, escape_string)(MYSQLND_CONN_DATA * const conn, char * newstr, con…
1028 DBG_INF_FMT("conn=%llu", conn->thread_id);
1030 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1031 DBG_INF_FMT("server_status=%u", UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status));
1032 if (UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status) & SERVER_STATUS_NO_BACKSLASH_ESCAPES) {
1033 ret = mysqlnd_cset_escape_quotes(conn->charset, newstr, escapestr, escapestr_len);
1035 ret = mysqlnd_cset_escape_slashes(conn->charset, newstr, escapestr, escapestr_len);
1037 conn->m->local_tx_end(conn, this_func, PASS);
1046 MYSQLND_METHOD(mysqlnd_conn_data, dump_debug_info)(MYSQLND_CONN_DATA * const conn)
1051 DBG_INF_FMT("conn=%llu", conn->thread_id);
1052 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1053 ret = conn->command->debug(conn);
1054 conn->m->local_tx_end(conn, this_func, ret);
1064 MYSQLND_METHOD(mysqlnd_conn_data, select_db)(MYSQLND_CONN_DATA * const conn, const char * const db,…
1070 DBG_INF_FMT("conn=%llu db=%s", conn->thread_id, db);
1072 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1075 ret = conn->command->init_db(conn, database);
1076 conn->m->local_tx_end(conn, this_func, ret);
1085 MYSQLND_METHOD(mysqlnd_conn_data, ping)(MYSQLND_CONN_DATA * const conn)
1091 DBG_INF_FMT("conn=%llu", conn->thread_id);
1093 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1094 ret = conn->command->ping(conn);
1095 conn->m->local_tx_end(conn, this_func, ret);
1105 MYSQLND_METHOD(mysqlnd_conn_data, statistic)(MYSQLND_CONN_DATA * conn, zend_string **message)
1111 DBG_INF_FMT("conn=%llu", conn->thread_id);
1113 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1114 ret = conn->command->statistics(conn, message);
1115 conn->m->local_tx_end(conn, this_func, ret);
1124 MYSQLND_METHOD(mysqlnd_conn_data, kill)(MYSQLND_CONN_DATA * conn, unsigned int pid)
1130 DBG_INF_FMT("conn=%llu pid=%u", conn->thread_id, pid);
1132 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1135 const unsigned int read_response = (pid != conn->thread_id);
1137 ret = conn->command->process_kill(conn, process_id, read_response);
1138 conn->m->local_tx_end(conn, this_func, ret);
1147 MYSQLND_METHOD(mysqlnd_conn_data, set_charset)(MYSQLND_CONN_DATA * const conn, const char * const c…
1154 DBG_INF_FMT("conn=%llu cs=%s", conn->thread_id, csname);
1157 …SET_CLIENT_ERROR(conn->error_info, CR_CANT_FIND_CHARSET, UNKNOWN_SQLSTATE, "Invalid character set …
1161 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1165 if (FAIL == (ret = conn->m->query(conn, query, query_len)) || conn->error_info->error_no) {
1168 conn->charset = charset;
1172 conn->m->local_tx_end(conn, this_func, ret);
1183 MYSQLND_METHOD(mysqlnd_conn_data, refresh)(MYSQLND_CONN_DATA * const conn, uint8_t options)
1188 DBG_INF_FMT("conn=%llu options=%lu", conn->thread_id, options);
1190 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1191 ret = conn->command->refresh(conn, options);
1192 conn->m->local_tx_end(conn, this_func, ret);
1201 MYSQLND_METHOD(mysqlnd_conn_data, shutdown)(MYSQLND_CONN_DATA * const conn, uint8_t level)
1206 DBG_INF_FMT("conn=%llu level=%lu", conn->thread_id, level);
1208 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1209 ret = conn->command->shutdown(conn, level);
1210 conn->m->local_tx_end(conn, this_func, ret);
1219 MYSQLND_METHOD(mysqlnd_conn_data, send_close)(MYSQLND_CONN_DATA * const conn)
1222 MYSQLND_VIO * vio = conn->vio;
1224 enum mysqlnd_connection_state state = GET_CONNECTION_STATE(&conn->state);
1227 …DBG_INF_FMT("conn=%llu vio->data->stream->abstract=%p", conn->thread_id, net_stream? net_stream->a…
1232 if (conn->persistent) {
1240 ret = conn->command->quit(conn);
1241 vio->data->m.close_stream(vio, conn->stats, conn->error_info);
1243 SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT);
1254 DBG_ERR_FMT("Brutally closing connection [%p][%s]", conn, conn->scheme.s);
1267 SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT);
1271 vio->data->m.close_stream(vio, conn->stats, conn->error_info);
1282 MYSQLND_METHOD_PRIVATE(mysqlnd_conn_data, get_reference)(MYSQLND_CONN_DATA * const conn)
1285 ++conn->refcount;
1286 DBG_INF_FMT("conn=%llu new_refcount=%u", conn->thread_id, conn->refcount);
1287 DBG_RETURN(conn);
1294 MYSQLND_METHOD_PRIVATE(mysqlnd_conn_data, free_reference)(MYSQLND_CONN_DATA * const conn)
1298 DBG_INF_FMT("conn=%llu old_refcount=%u", conn->thread_id, conn->refcount);
1299 if (!(--conn->refcount)) {
1305 ret = conn->m->send_close(conn);
1306 conn->m->dtor(conn);
1315 MYSQLND_METHOD(mysqlnd_conn_data, field_count)(const MYSQLND_CONN_DATA * const conn)
1317 return conn->field_count;
1324 MYSQLND_METHOD(mysqlnd_conn_data, server_status)(const MYSQLND_CONN_DATA * const conn)
1326 return UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status);
1333 MYSQLND_METHOD(mysqlnd_conn_data, insert_id)(const MYSQLND_CONN_DATA * const conn)
1335 return UPSERT_STATUS_GET_LAST_INSERT_ID(conn->upsert_status);
1342 MYSQLND_METHOD(mysqlnd_conn_data, affected_rows)(const MYSQLND_CONN_DATA * const conn)
1344 return UPSERT_STATUS_GET_AFFECTED_ROWS(conn->upsert_status);
1351 MYSQLND_METHOD(mysqlnd_conn_data, warning_count)(const MYSQLND_CONN_DATA * const conn)
1353 return UPSERT_STATUS_GET_WARNINGS(conn->upsert_status);
1360 MYSQLND_METHOD(mysqlnd_conn_data, info)(const MYSQLND_CONN_DATA * const conn)
1362 return conn->last_message.s;
1385 MYSQLND_METHOD(mysqlnd_conn_data, get_server_info)(const MYSQLND_CONN_DATA * const conn)
1387 return conn->server_version;
1394 MYSQLND_METHOD(mysqlnd_conn_data, get_host_info)(const MYSQLND_CONN_DATA * const conn)
1396 return conn->host_info;
1403 MYSQLND_METHOD(mysqlnd_conn_data, get_proto_info)(const MYSQLND_CONN_DATA * const conn)
1405 return conn->protocol_version;
1412 MYSQLND_METHOD(mysqlnd_conn_data, charset_name)(const MYSQLND_CONN_DATA * const conn)
1414 return conn->charset->name;
1421 MYSQLND_METHOD(mysqlnd_conn_data, thread_id)(const MYSQLND_CONN_DATA * const conn)
1423 return conn->thread_id;
1430 MYSQLND_METHOD(mysqlnd_conn_data, get_server_version)(const MYSQLND_CONN_DATA * const conn)
1435 if (!(p = conn->server_version)) {
1452 MYSQLND_METHOD(mysqlnd_conn_data, more_results)(const MYSQLND_CONN_DATA * const conn)
1456 …DBG_RETURN(UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status) & SERVER_MORE_RESULTS_EXISTS? TRUE…
1463 MYSQLND_METHOD(mysqlnd_conn_data, next_result)(MYSQLND_CONN_DATA * const conn)
1469 DBG_INF_FMT("conn=%llu", conn->thread_id);
1471 SET_EMPTY_ERROR(conn->error_info);
1473 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1475 if (GET_CONNECTION_STATE(&conn->state) != CONN_NEXT_RESULT_PENDING) {
1479 UPSERT_STATUS_SET_AFFECTED_ROWS_TO_ERROR(conn->upsert_status);
1484 if (FAIL == (ret = conn->m->query_read_result_set_header(conn, NULL))) {
1489 if (!conn->error_info->error_no) {
1492 SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT);
1493 conn->m->send_close(conn);
1495 …DBG_INF_FMT("Error from the server : (%u) %s", conn->error_info->error_no, conn->error_info->error…
1499 …if (conn->last_query_type == QUERY_UPSERT && UPSERT_STATUS_GET_AFFECTED_ROWS(conn->upsert_status))…
1500 …MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn->stats, STAT_ROWS_AFFECTED_NORMAL, UPSERT_STATUS_GET_AFFEC…
1503 conn->m->local_tx_end(conn, this_func, ret);
1566 MYSQLND_METHOD(mysqlnd_conn_data, change_user)(MYSQLND_CONN_DATA * const conn,
1579 conn->thread_id, user?user:"", passwd?"***":"null", db?db:"", silent == TRUE);
1581 if (PASS != conn->m->local_tx_start(conn, this_func)) {
1585 SET_EMPTY_ERROR(conn->error_info);
1586 UPSERT_STATUS_SET_AFFECTED_ROWS_TO_ERROR(conn->upsert_status);
1600 ret = mysqlnd_run_authentication(conn, user, passwd, passwd_len, db, strlen(db),
1601 conn->authentication_plugin_data, conn->options->auth_protocol,
1602 … 0 /*charset not used*/, conn->options, conn->server_capabilities, silent, TRUE/*is_change*/);
1608 conn->m->local_tx_end(conn, this_func, ret);
1618 MYSQLND_METHOD(mysqlnd_conn_data, set_client_option)(MYSQLND_CONN_DATA * const conn,
1626 DBG_INF_FMT("conn=%llu option=%u", conn->thread_id, option);
1628 if (PASS != conn->m->local_tx_start(conn, this_func)) {
1642 ret = conn->vio->data->m.set_client_option(conn->vio, option, value);
1647 …ret = conn->protocol_frame_codec->data->m.set_client_option(conn->protocol_frame_codec, option, va…
1651 conn->options->int_and_float_native = *(unsigned int*) value;
1656 conn->options->flags |= CLIENT_LOCAL_FILES;
1658 conn->options->flags &= ~CLIENT_LOCAL_FILES;
1667 …ew_init_commands = mnd_perealloc(conn->options->init_commands, sizeof(char *) * (conn->options->nu…
1671 conn->options->init_commands = new_init_commands;
1672 new_command = mnd_pestrdup(value, conn->persistent);
1676 conn->options->init_commands[conn->options->num_commands] = new_command;
1677 ++conn->options->num_commands;
1692 …SET_CLIENT_ERROR(conn->error_info, CR_CANT_FIND_CHARSET, UNKNOWN_SQLSTATE, "Unknown character set"…
1697 new_charset_name = mnd_pestrdup(value, conn->persistent);
1701 if (conn->options->charset_name) {
1702 mnd_pefree(conn->options->charset_name, conn->persistent);
1704 conn->options->charset_name = new_charset_name;
1705 DBG_INF_FMT("charset=%s", conn->options->charset_name);
1709 conn->options->protocol = MYSQL_PROTOCOL_PIPE;
1713 conn->options->protocol = *(unsigned int*) value;
1730 conn->options->max_allowed_packet = *(unsigned int*) value;
1735 char * new_auth_protocol = value? mnd_pestrdup(value, conn->persistent) : NULL;
1739 if (conn->options->auth_protocol) {
1740 mnd_pefree(conn->options->auth_protocol, conn->persistent);
1742 conn->options->auth_protocol = new_auth_protocol;
1743 DBG_INF_FMT("auth_protocol=%s", conn->options->auth_protocol);
1748 conn->options->flags |= CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS;
1750 conn->options->flags &= ~CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS;
1754 if (conn->options->connect_attr) {
1755 … DBG_INF_FMT("Before reset %d attribute(s)", zend_hash_num_elements(conn->options->connect_attr));
1756 zend_hash_clean(conn->options->connect_attr);
1760 if (conn->options->connect_attr && value) {
1761 … DBG_INF_FMT("Before delete %d attribute(s)", zend_hash_num_elements(conn->options->connect_attr));
1762 zend_hash_str_del(conn->options->connect_attr, value, strlen(value));
1763 DBG_INF_FMT("%d left", zend_hash_num_elements(conn->options->connect_attr));
1775 conn->m->local_tx_end(conn, this_func, ret);
1778 SET_OOM_ERROR(conn->error_info);
1779 conn->m->local_tx_end(conn, this_func, FAIL);
1788 MYSQLND_METHOD(mysqlnd_conn_data, set_client_option_2d)(MYSQLND_CONN_DATA * const conn,
1797 DBG_INF_FMT("conn=%llu option=%u", conn->thread_id, option);
1799 if (PASS != conn->m->local_tx_start(conn, this_func)) {
1804 if (!conn->options->connect_attr) {
1806 conn->options->connect_attr = mnd_pemalloc(sizeof(HashTable), conn->persistent);
1807 if (!conn->options->connect_attr) {
1810 …zend_hash_init(conn->options->connect_attr, 0, NULL, conn->persistent ? ZVAL_INTERNAL_PTR_DTOR : Z…
1817 if (conn->persistent) {
1826 zend_hash_update(conn->options->connect_attr, str, &attrz);
1833 conn->m->local_tx_end(conn, this_func, ret);
1836 SET_OOM_ERROR(conn->error_info);
1837 conn->m->local_tx_end(conn, this_func, FAIL);
1846 MYSQLND_METHOD(mysqlnd_conn_data, use_result)(MYSQLND_CONN_DATA * const conn, const unsigned int fl…
1852 DBG_INF_FMT("conn=%llu", conn->thread_id);
1854 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1856 if (!conn->current_result) {
1861 …if (conn->last_query_type != QUERY_SELECT || GET_CONNECTION_STATE(&conn->state) != CONN_FETCHING_D…
1862 …SET_CLIENT_ERROR(conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
1867 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_UNBUFFERED_SETS);
1869 conn->current_result->conn = conn->m->get_reference(conn);
1870 result = conn->current_result->m.use_result(conn->current_result, FALSE);
1873 conn->current_result->m.free_result(conn->current_result, TRUE);
1875 conn->current_result = NULL;
1878 conn->m->local_tx_end(conn, this_func, result == NULL? FAIL:PASS);
1888 MYSQLND_METHOD(mysqlnd_conn_data, store_result)(MYSQLND_CONN_DATA * const conn, const unsigned int …
1894 DBG_INF_FMT("conn=%llu conn=%p", conn->thread_id, conn);
1896 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1899 if (!conn->current_result) {
1904 …if (conn->last_query_type != QUERY_SELECT || GET_CONNECTION_STATE(&conn->state) != CONN_FETCHING_D…
1905 …SET_CLIENT_ERROR(conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
1910 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_BUFFERED_SETS);
1913 if ((conn->m->get_client_api_capabilities(conn) & MYSQLND_CLIENT_KNOWS_RSET_COPY_DATA)) {
1925 SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "Unknown fetch mode");
1929 result = conn->current_result->m.store_result(conn->current_result, conn, f);
1931 conn->current_result->m.free_result(conn->current_result, TRUE);
1933 conn->current_result = NULL;
1936 conn->m->local_tx_end(conn, this_func, result == NULL? FAIL:PASS);
1945 MYSQLND_METHOD(mysqlnd_conn_data, get_connection_stats)(const MYSQLND_CONN_DATA * const conn,
1949 mysqlnd_fill_stats_hash(conn->stats, mysqlnd_stats_values_names, return_value ZEND_FILE_LINE_CC);
1957 MYSQLND_METHOD(mysqlnd_conn_data, set_autocommit)(MYSQLND_CONN_DATA * conn, unsigned int mode)
1963 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1964 …ret = conn->m->query(conn, (mode) ? "SET AUTOCOMMIT=1":"SET AUTOCOMMIT=0", sizeof("SET AUTOCOMMIT=…
1965 conn->m->local_tx_end(conn, this_func, ret);
1975 MYSQLND_METHOD(mysqlnd_conn_data, tx_commit)(MYSQLND_CONN_DATA * conn)
1977 return conn->m->tx_commit_or_rollback(conn, TRUE, TRANS_COR_NO_OPT, NULL);
1984 MYSQLND_METHOD(mysqlnd_conn_data, tx_rollback)(MYSQLND_CONN_DATA * conn)
1986 return conn->m->tx_commit_or_rollback(conn, FALSE, TRANS_COR_NO_OPT, NULL);
1993 MYSQLND_METHOD(mysqlnd_conn_data, tx_cor_options_to_string)(const MYSQLND_CONN_DATA * const conn, s…
2068 MYSQLND_METHOD(mysqlnd_conn_data, tx_commit_or_rollback)(MYSQLND_CONN_DATA * conn, const zend_bool …
2074 if (PASS == conn->m->local_tx_start(conn, this_func)) {
2077 conn->m->tx_cor_options_to_string(conn, &tmp_str, flags);
2094 SET_OOM_ERROR(conn->error_info);
2098 ret = conn->m->query(conn, query, query_len);
2102 conn->m->local_tx_end(conn, this_func, ret);
2112 MYSQLND_METHOD(mysqlnd_conn_data, tx_begin)(MYSQLND_CONN_DATA * conn, const unsigned int mode, cons…
2118 if (PASS == conn->m->local_tx_start(conn, this_func)) {
2150 SET_OOM_ERROR(conn->error_info);
2153 ret = conn->m->query(conn, query, query_len);
2156 mysqlnd_stmt_errno(conn) == 1064) {
2162 conn->m->local_tx_end(conn, this_func, ret);
2172 MYSQLND_METHOD(mysqlnd_conn_data, tx_savepoint)(MYSQLND_CONN_DATA * conn, const char * const name)
2178 if (PASS == conn->m->local_tx_start(conn, this_func)) {
2183 …SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "Savepoint name not provide…
2188 SET_OOM_ERROR(conn->error_info);
2191 ret = conn->m->query(conn, query, query_len);
2194 conn->m->local_tx_end(conn, this_func, ret);
2204 MYSQLND_METHOD(mysqlnd_conn_data, tx_savepoint_release)(MYSQLND_CONN_DATA * conn, const char * cons…
2210 if (PASS == conn->m->local_tx_start(conn, this_func)) {
2215 …SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "Savepoint name not provide…
2220 SET_OOM_ERROR(conn->error_info);
2223 ret = conn->m->query(conn, query, query_len);
2226 conn->m->local_tx_end(conn, this_func, ret);
2236 MYSQLND_METHOD(mysqlnd_conn_data, negotiate_client_api_capabilities)(MYSQLND_CONN_DATA * const conn
2240 if (conn) {
2241 ret = conn->client_api_capabilities;
2242 conn->client_api_capabilities = flags;
2252 MYSQLND_METHOD(mysqlnd_conn_data, get_client_api_capabilities)(const MYSQLND_CONN_DATA * const conn)
2255 DBG_RETURN(conn? conn->client_api_capabilities : 0);
2262 MYSQLND_METHOD(mysqlnd_conn_data, local_tx_start)(MYSQLND_CONN_DATA * conn, const size_t this_func)
2272 MYSQLND_METHOD(mysqlnd_conn_data, local_tx_end)(MYSQLND_CONN_DATA * conn, const size_t this_func, c…
2282 MYSQLND_METHOD(mysqlnd_conn_data, stmt_init)(MYSQLND_CONN_DATA * const conn)
2286 ret = conn->object_factory.get_prepared_statement(conn);
2384 MYSQLND_METHOD(mysqlnd_conn, clone_object)(MYSQLND * const conn)
2388 ret = conn->data->object_factory.clone_connection_object(conn);
2396 MYSQLND_METHOD_PRIVATE(mysqlnd_conn, dtor)(MYSQLND * conn)
2399 DBG_INF_FMT("conn=%llu", conn->data->thread_id);
2401 conn->data->m->free_reference(conn->data);
2403 mnd_pefree(conn, conn->persistent);
2415 MYSQLND_CONN_DATA * conn = conn_handle->data; local
2419 DBG_INF_FMT("conn=%llu", conn->thread_id);
2421 if (PASS == conn->m->local_tx_start(conn, this_func)) {
2422 if (GET_CONNECTION_STATE(&conn->state) >= CONN_READY) {
2428 MYSQLND_INC_CONN_STATISTIC(conn->stats, close_type_to_stat_map[close_type]);
2435 ret = conn->m->send_close(conn);
2438 conn->m->local_tx_end(conn, this_func, ret);