Lines Matching refs:conn
222 MYSQLND_METHOD(mysqlnd_conn_data, free_options)(MYSQLND_CONN_DATA * conn) in MYSQLND_METHOD()
224 zend_bool pers = conn->persistent; in MYSQLND_METHOD()
226 if (conn->options->charset_name) { in MYSQLND_METHOD()
227 mnd_pefree(conn->options->charset_name, pers); in MYSQLND_METHOD()
228 conn->options->charset_name = NULL; in MYSQLND_METHOD()
230 if (conn->options->auth_protocol) { in MYSQLND_METHOD()
231 mnd_pefree(conn->options->auth_protocol, pers); in MYSQLND_METHOD()
232 conn->options->auth_protocol = NULL; in MYSQLND_METHOD()
234 if (conn->options->num_commands) { in MYSQLND_METHOD()
236 for (i = 0; i < conn->options->num_commands; i++) { in MYSQLND_METHOD()
238 mnd_pefree(conn->options->init_commands[i], pers); in MYSQLND_METHOD()
240 mnd_pefree(conn->options->init_commands, pers); in MYSQLND_METHOD()
241 conn->options->init_commands = NULL; in MYSQLND_METHOD()
243 if (conn->options->cfg_file) { in MYSQLND_METHOD()
244 mnd_pefree(conn->options->cfg_file, pers); in MYSQLND_METHOD()
245 conn->options->cfg_file = NULL; in MYSQLND_METHOD()
247 if (conn->options->cfg_section) { in MYSQLND_METHOD()
248 mnd_pefree(conn->options->cfg_section, pers); in MYSQLND_METHOD()
249 conn->options->cfg_section = NULL; in MYSQLND_METHOD()
251 if (conn->options->connect_attr) { in MYSQLND_METHOD()
252 zend_hash_destroy(conn->options->connect_attr); in MYSQLND_METHOD()
253 mnd_pefree(conn->options->connect_attr, pers); in MYSQLND_METHOD()
254 conn->options->connect_attr = NULL; in MYSQLND_METHOD()
262 MYSQLND_METHOD(mysqlnd_conn_data, free_contents)(MYSQLND_CONN_DATA * conn) in MYSQLND_METHOD()
264 zend_bool pers = conn->persistent; in MYSQLND_METHOD()
268 if (conn->current_result) { in MYSQLND_METHOD()
269 conn->current_result->m.free_result(conn->current_result, TRUE); in MYSQLND_METHOD()
270 conn->current_result = NULL; in MYSQLND_METHOD()
273 if (conn->protocol_frame_codec) { in MYSQLND_METHOD()
274 conn->protocol_frame_codec->data->m.free_contents(conn->protocol_frame_codec); in MYSQLND_METHOD()
277 if (conn->vio) { in MYSQLND_METHOD()
278 conn->vio->data->m.free_contents(conn->vio); in MYSQLND_METHOD()
283 if (conn->hostname.s) { in MYSQLND_METHOD()
284 mnd_pefree(conn->hostname.s, pers); in MYSQLND_METHOD()
285 conn->hostname.s = NULL; in MYSQLND_METHOD()
287 if (conn->username.s) { in MYSQLND_METHOD()
288 mnd_pefree(conn->username.s, pers); in MYSQLND_METHOD()
289 conn->username.s = NULL; in MYSQLND_METHOD()
291 if (conn->password.s) { in MYSQLND_METHOD()
292 mnd_pefree(conn->password.s, pers); in MYSQLND_METHOD()
293 conn->password.s = NULL; in MYSQLND_METHOD()
295 if (conn->connect_or_select_db.s) { in MYSQLND_METHOD()
296 mnd_pefree(conn->connect_or_select_db.s, pers); in MYSQLND_METHOD()
297 conn->connect_or_select_db.s = NULL; in MYSQLND_METHOD()
299 if (conn->unix_socket.s) { in MYSQLND_METHOD()
300 mnd_pefree(conn->unix_socket.s, pers); in MYSQLND_METHOD()
301 conn->unix_socket.s = NULL; in MYSQLND_METHOD()
303 DBG_INF_FMT("scheme=%s", conn->scheme.s); in MYSQLND_METHOD()
304 if (conn->scheme.s) { in MYSQLND_METHOD()
305 mnd_pefree(conn->scheme.s, pers); in MYSQLND_METHOD()
306 conn->scheme.s = NULL; in MYSQLND_METHOD()
308 if (conn->server_version) { in MYSQLND_METHOD()
309 mnd_pefree(conn->server_version, pers); in MYSQLND_METHOD()
310 conn->server_version = NULL; in MYSQLND_METHOD()
312 if (conn->host_info) { in MYSQLND_METHOD()
313 mnd_pefree(conn->host_info, pers); in MYSQLND_METHOD()
314 conn->host_info = NULL; in MYSQLND_METHOD()
316 if (conn->authentication_plugin_data.s) { in MYSQLND_METHOD()
317 mnd_pefree(conn->authentication_plugin_data.s, pers); in MYSQLND_METHOD()
318 conn->authentication_plugin_data.s = NULL; in MYSQLND_METHOD()
320 if (conn->last_message.s) { in MYSQLND_METHOD()
321 mnd_efree(conn->last_message.s); in MYSQLND_METHOD()
322 conn->last_message.s = NULL; in MYSQLND_METHOD()
325 conn->charset = NULL; in MYSQLND_METHOD()
326 conn->greet_charset = NULL; in MYSQLND_METHOD()
335 MYSQLND_METHOD_PRIVATE(mysqlnd_conn_data, dtor)(MYSQLND_CONN_DATA * conn) in MYSQLND_METHOD_PRIVATE()
338 DBG_INF_FMT("conn=%llu", conn->thread_id); in MYSQLND_METHOD_PRIVATE()
340 conn->m->free_contents(conn); in MYSQLND_METHOD_PRIVATE()
341 conn->m->free_options(conn); in MYSQLND_METHOD_PRIVATE()
343 if (conn->error_info) { in MYSQLND_METHOD_PRIVATE()
344 mysqlnd_error_info_free_contents(conn->error_info); in MYSQLND_METHOD_PRIVATE()
345 conn->error_info = NULL; in MYSQLND_METHOD_PRIVATE()
348 if (conn->protocol_frame_codec) { in MYSQLND_METHOD_PRIVATE()
349 mysqlnd_pfc_free(conn->protocol_frame_codec, conn->stats, conn->error_info); in MYSQLND_METHOD_PRIVATE()
350 conn->protocol_frame_codec = NULL; in MYSQLND_METHOD_PRIVATE()
353 if (conn->vio) { in MYSQLND_METHOD_PRIVATE()
354 mysqlnd_vio_free(conn->vio, conn->stats, conn->error_info); in MYSQLND_METHOD_PRIVATE()
355 conn->vio = NULL; in MYSQLND_METHOD_PRIVATE()
358 if (conn->payload_decoder_factory) { in MYSQLND_METHOD_PRIVATE()
359 mysqlnd_protocol_payload_decoder_factory_free(conn->payload_decoder_factory); in MYSQLND_METHOD_PRIVATE()
360 conn->payload_decoder_factory = NULL; in MYSQLND_METHOD_PRIVATE()
363 if (conn->stats) { in MYSQLND_METHOD_PRIVATE()
364 mysqlnd_stats_end(conn->stats, conn->persistent); in MYSQLND_METHOD_PRIVATE()
367 mnd_pefree(conn, conn->persistent); in MYSQLND_METHOD_PRIVATE()
376 MYSQLND_METHOD(mysqlnd_conn_data, set_server_option)(MYSQLND_CONN_DATA * const conn, enum_mysqlnd_s… in MYSQLND_METHOD()
381 if (PASS == conn->m->local_tx_start(conn, this_func)) { in MYSQLND_METHOD()
382 ret = conn->command->set_option(conn, option); in MYSQLND_METHOD()
383 conn->m->local_tx_end(conn, this_func, ret); in MYSQLND_METHOD()
392 MYSQLND_METHOD(mysqlnd_conn_data, restart_psession)(MYSQLND_CONN_DATA * conn) in MYSQLND_METHOD()
395 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_CONNECT_REUSED); in MYSQLND_METHOD()
396 conn->current_result = NULL; in MYSQLND_METHOD()
397 conn->last_message.s = NULL; in MYSQLND_METHOD()
405 MYSQLND_METHOD(mysqlnd_conn_data, end_psession)(MYSQLND_CONN_DATA * conn) in MYSQLND_METHOD()
409 if (conn->current_result) { in MYSQLND_METHOD()
410 conn->current_result->m.free_result(conn->current_result, TRUE); in MYSQLND_METHOD()
411 conn->current_result = NULL; in MYSQLND_METHOD()
413 if (conn->last_message.s) { in MYSQLND_METHOD()
414 mnd_efree(conn->last_message.s); in MYSQLND_METHOD()
415 conn->last_message.s = NULL; in MYSQLND_METHOD()
417 conn->error_info = &conn->error_info_impl; in MYSQLND_METHOD()
443 MYSQLND_METHOD(mysqlnd_conn_data, execute_init_commands)(MYSQLND_CONN_DATA * conn) in MYSQLND_METHOD()
448 if (conn->options->init_commands) { in MYSQLND_METHOD()
450 for (; current_command < conn->options->num_commands; ++current_command) { in MYSQLND_METHOD()
451 const char * const command = conn->options->init_commands[current_command]; in MYSQLND_METHOD()
453 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_INIT_COMMAND_EXECUTED_COUNT); in MYSQLND_METHOD()
454 if (PASS != conn->m->query(conn, command, strlen(command))) { in MYSQLND_METHOD()
455 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_INIT_COMMAND_FAILED_COUNT); in MYSQLND_METHOD()
460 if (conn->last_query_type == QUERY_SELECT) { in MYSQLND_METHOD()
461 MYSQLND_RES * result = conn->m->use_result(conn, 0); in MYSQLND_METHOD()
466 } while (conn->m->next_result(conn) != FAIL); in MYSQLND_METHOD()
477 MYSQLND_METHOD(mysqlnd_conn_data, get_updated_connect_flags)(MYSQLND_CONN_DATA * conn, unsigned int… in MYSQLND_METHOD()
480 MYSQLND_PFC * pfc = conn->protocol_frame_codec; in MYSQLND_METHOD()
482 MYSQLND_VIO * vio = conn->vio; in MYSQLND_METHOD()
489 mysql_flags |= conn->options->flags; /* use the flags from set_client_option() */ in MYSQLND_METHOD()
515 if (conn->options->connect_attr && zend_hash_num_elements(conn->options->connect_attr)) { in MYSQLND_METHOD()
526 MYSQLND_METHOD(mysqlnd_conn_data, connect_handshake)(MYSQLND_CONN_DATA * conn, in MYSQLND_METHOD()
536 …if (PASS == conn->vio->data->m.connect(conn->vio, *scheme, conn->persistent, conn->stats, conn->er… in MYSQLND_METHOD()
537 …PASS == conn->protocol_frame_codec->data->m.reset(conn->protocol_frame_codec, conn->stats, conn->e… in MYSQLND_METHOD()
541 ret = conn->command->handshake(conn, *username, *password, *database, client_flags); in MYSQLND_METHOD()
549 MYSQLND_METHOD(mysqlnd_conn_data, get_scheme)(MYSQLND_CONN_DATA * conn, MYSQLND_CSTRING hostname, M…
586 MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn,
602 MYSQLND_PFC * pfc = conn->protocol_frame_codec;
606 DBG_INF_FMT("conn=%p", conn);
608 if (PASS != conn->m->local_tx_start(conn, this_func)) {
613 SET_EMPTY_ERROR(conn->error_info);
614 UPSERT_STATUS_SET_AFFECTED_ROWS_TO_ERROR(conn->upsert_status);
618 conn? conn->persistent:0, conn? (int)GET_CONNECTION_STATE(&conn->state):-1);
620 if (GET_CONNECTION_STATE(&conn->state) > CONN_ALLOCED) {
623 if (GET_CONNECTION_STATE(&conn->state) < CONN_QUIT_SENT) {
624 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_CLOSE_IMPLICIT);
626 conn->m->send_close(conn);
629 conn->m->free_contents(conn);
645 conn->m->set_client_option(conn, MYSQLND_OPT_MAX_ALLOWED_PACKET, (char *)&max_allowed_size);
670 transport = conn->m->get_scheme(conn, hostname, &socket_or_pipe, port, &unix_socket, &named_pipe);
672 mysql_flags = conn->m->get_updated_connect_flags(conn, mysql_flags);
676 …if (FAIL == conn->m->connect_handshake(conn, &scheme, &username, &password, &database, mysql_flags…
682 SET_CONNECTION_STATE(&conn->state, CONN_READY);
695 conn->scheme.s = mnd_pestrndup(transport.s, transport.l, conn->persistent);
696 conn->scheme.l = transport.l;
702 if (!conn->scheme.s) {
706 conn->username.l = username.l;
707 conn->username.s = mnd_pestrndup(username.s, conn->username.l, conn->persistent);
708 conn->password.l = password.l;
709 conn->password.s = mnd_pestrndup(password.s, conn->password.l, conn->persistent);
710 conn->port = port;
711 conn->connect_or_select_db.l = database.l;
712 …conn->connect_or_select_db.s = mnd_pestrndup(database.s, conn->connect_or_select_db.l, conn->persi…
714 if (!conn->username.s || !conn->password.s|| !conn->connect_or_select_db.s) {
715 SET_OOM_ERROR(conn->error_info);
720 conn->hostname.s = mnd_pestrndup(hostname.s, hostname.l, conn->persistent);
721 if (!conn->hostname.s) {
722 SET_OOM_ERROR(conn->error_info);
725 conn->hostname.l = hostname.l;
728 mnd_sprintf(&p, 0, "%s via TCP/IP", conn->hostname.s);
730 SET_OOM_ERROR(conn->error_info);
733 conn->host_info = mnd_pestrdup(p, conn->persistent);
735 if (!conn->host_info) {
736 SET_OOM_ERROR(conn->error_info);
741 conn->unix_socket.s = mnd_pestrdup(socket_or_pipe.s, conn->persistent);
743 conn->host_info = mnd_pestrdup("Localhost via UNIX socket", conn->persistent);
746 mnd_sprintf(&p, 0, "%s via named pipe", conn->unix_socket.s);
748 SET_OOM_ERROR(conn->error_info);
751 conn->host_info = mnd_pestrdup(p, conn->persistent);
753 if (!conn->host_info) {
754 SET_OOM_ERROR(conn->error_info);
760 if (!conn->unix_socket.s || !conn->host_info) {
761 SET_OOM_ERROR(conn->error_info);
764 conn->unix_socket.l = strlen(conn->unix_socket.s);
767 SET_EMPTY_ERROR(conn->error_info);
769 mysqlnd_local_infile_default(conn);
771 if (FAIL == conn->m->execute_init_commands(conn)) {
775 …MYSQLND_INC_CONN_STATISTIC_W_VALUE2(conn->stats, STAT_CONNECT_SUCCESS, 1, STAT_OPENED_CONNECTIONS,…
779 if (conn->persistent) {
780 …MYSQLND_INC_CONN_STATISTIC_W_VALUE2(conn->stats, STAT_PCONNECT_SUCCESS, 1, STAT_OPENED_PERSISTENT_…
783 DBG_INF_FMT("connection_id=%llu", conn->thread_id);
785 conn->m->local_tx_end(conn, this_func, PASS);
794 …R_FMT("[%u] %.128s (trying to connect via %s)", conn->error_info->error_no, conn->error_info->erro…
795 if (!conn->error_info->error_no) {
796 …SET_CLIENT_ERROR(conn->error_info, CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE, conn->error_info->error);
797 …NING, "[%u] %.128s (trying to connect via %s)", conn->error_info->error_no, conn->error_info->erro…
800 conn->m->free_contents(conn);
801 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_CONNECT_FAILURE);
803 conn->m->local_tx_end(conn, this_func, FAIL);
824 MYSQLND_CONN_DATA * conn = conn_handle->data; local
828 if (PASS == conn->m->local_tx_start(conn, this_func)) {
833 …ret = conn->m->connect(conn, hostname, username, password, database, port, socket_or_pipe, mysql_f…
835 conn->m->local_tx_end(conn, this_func, FAIL);
848 MYSQLND_METHOD(mysqlnd_conn_data, query)(MYSQLND_CONN_DATA * conn, const char * const query, const …
853 DBG_INF_FMT("conn=%p conn=%llu query=%s", conn, conn->thread_id, query);
855 if (PASS == conn->m->local_tx_start(conn, this_func)) {
856 …if (PASS == conn->m->send_query(conn, query, query_len, MYSQLND_SEND_QUERY_IMPLICIT, NULL, NULL) &&
857 PASS == conn->m->reap_query(conn, MYSQLND_REAP_RESULT_IMPLICIT))
860 …if (conn->last_query_type == QUERY_UPSERT && UPSERT_STATUS_GET_AFFECTED_ROWS(conn->upsert_status))…
861 …MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn->stats, STAT_ROWS_AFFECTED_NORMAL, UPSERT_STATUS_GET_AFFEC…
864 conn->m->local_tx_end(conn, this_func, ret);
873 MYSQLND_METHOD(mysqlnd_conn_data, send_query)(MYSQLND_CONN_DATA * conn, const char * const query, c…
879 DBG_INF_FMT("conn=%llu query=%s", conn->thread_id, query);
880 DBG_INF_FMT("conn->server_status=%u", UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status));
882 if (type == MYSQLND_SEND_QUERY_IMPLICIT || PASS == conn->m->local_tx_start(conn, this_func))
886 ret = conn->command->query(conn, query_string);
889 conn->m->local_tx_end(conn, this_func, ret);
892 DBG_INF_FMT("conn->server_status=%u", UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status));
900 MYSQLND_METHOD(mysqlnd_conn_data, reap_query)(MYSQLND_CONN_DATA * conn, enum_mysqlnd_reap_result_ty…
905 DBG_INF_FMT("conn=%llu", conn->thread_id);
907 DBG_INF_FMT("conn->server_status=%u", UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status));
908 if (type == MYSQLND_REAP_RESULT_IMPLICIT || PASS == conn->m->local_tx_start(conn, this_func))
910 ret = conn->command->reap_result(conn);
913 conn->m->local_tx_end(conn, this_func, ret);
916 DBG_INF_FMT("conn->server_status=%u", UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status));
924 MYSQLND_METHOD(mysqlnd_conn_data, list_method)(MYSQLND_CONN_DATA * conn, const char * const query, …
932 DBG_INF_FMT("conn=%llu query=%s wild=%u", conn->thread_id, query, achtung_wild);
934 if (PASS == conn->m->local_tx_start(conn, this_func)) {
949 if (PASS == conn->m->query(conn, show_query, show_query_len)) {
950 result = conn->m->store_result(conn, MYSQLND_STORE_NO_COPY);
955 conn->m->local_tx_end(conn, this_func, result == NULL? FAIL:PASS);
964 MYSQLND_METHOD(mysqlnd_conn_data, err_no)(const MYSQLND_CONN_DATA * const conn)
966 return conn->error_info->error_no;
973 MYSQLND_METHOD(mysqlnd_conn_data, error)(const MYSQLND_CONN_DATA * const conn)
975 return conn->error_info->error;
982 MYSQLND_METHOD(mysqlnd_conn_data, sqlstate)(const MYSQLND_CONN_DATA * const conn)
984 return conn->error_info->sqlstate[0] ? conn->error_info->sqlstate:MYSQLND_SQLSTATE_NULL;
1001 MYSQLND_METHOD(mysqlnd_conn_data, ssl_set)(MYSQLND_CONN_DATA * const conn, const char * key, const …
1006 MYSQLND_VIO * vio = conn->vio;
1009 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1016 conn->m->local_tx_end(conn, this_func, ret);
1025 MYSQLND_METHOD(mysqlnd_conn_data, escape_string)(MYSQLND_CONN_DATA * const conn, char * newstr, con…
1030 DBG_INF_FMT("conn=%llu", conn->thread_id);
1032 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1033 DBG_INF_FMT("server_status=%u", UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status));
1034 if (UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status) & SERVER_STATUS_NO_BACKSLASH_ESCAPES) {
1035 ret = mysqlnd_cset_escape_quotes(conn->charset, newstr, escapestr, escapestr_len);
1037 ret = mysqlnd_cset_escape_slashes(conn->charset, newstr, escapestr, escapestr_len);
1039 conn->m->local_tx_end(conn, this_func, PASS);
1048 MYSQLND_METHOD(mysqlnd_conn_data, dump_debug_info)(MYSQLND_CONN_DATA * const conn)
1053 DBG_INF_FMT("conn=%llu", conn->thread_id);
1054 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1055 ret = conn->command->debug(conn);
1056 conn->m->local_tx_end(conn, this_func, ret);
1066 MYSQLND_METHOD(mysqlnd_conn_data, select_db)(MYSQLND_CONN_DATA * const conn, const char * const db,…
1072 DBG_INF_FMT("conn=%llu db=%s", conn->thread_id, db);
1074 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1077 ret = conn->command->init_db(conn, database);
1078 conn->m->local_tx_end(conn, this_func, ret);
1087 MYSQLND_METHOD(mysqlnd_conn_data, ping)(MYSQLND_CONN_DATA * const conn)
1093 DBG_INF_FMT("conn=%llu", conn->thread_id);
1095 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1096 ret = conn->command->ping(conn);
1097 conn->m->local_tx_end(conn, this_func, ret);
1107 MYSQLND_METHOD(mysqlnd_conn_data, statistic)(MYSQLND_CONN_DATA * conn, zend_string **message)
1113 DBG_INF_FMT("conn=%llu", conn->thread_id);
1115 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1116 ret = conn->command->statistics(conn, message);
1117 conn->m->local_tx_end(conn, this_func, ret);
1126 MYSQLND_METHOD(mysqlnd_conn_data, kill)(MYSQLND_CONN_DATA * conn, unsigned int pid)
1132 DBG_INF_FMT("conn=%llu pid=%u", conn->thread_id, pid);
1134 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1137 const unsigned int read_response = (pid != conn->thread_id);
1139 ret = conn->command->process_kill(conn, process_id, read_response);
1140 conn->m->local_tx_end(conn, this_func, ret);
1149 MYSQLND_METHOD(mysqlnd_conn_data, set_charset)(MYSQLND_CONN_DATA * const conn, const char * const c…
1156 DBG_INF_FMT("conn=%llu cs=%s", conn->thread_id, csname);
1159 SET_CLIENT_ERROR(conn->error_info, CR_CANT_FIND_CHARSET, UNKNOWN_SQLSTATE,
1164 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1168 if (FAIL == (ret = conn->m->query(conn, query, query_len))) {
1170 } else if (conn->error_info->error_no) {
1173 conn->charset = charset;
1177 conn->m->local_tx_end(conn, this_func, ret);
1188 MYSQLND_METHOD(mysqlnd_conn_data, refresh)(MYSQLND_CONN_DATA * const conn, uint8_t options)
1193 DBG_INF_FMT("conn=%llu options=%lu", conn->thread_id, options);
1195 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1196 ret = conn->command->refresh(conn, options);
1197 conn->m->local_tx_end(conn, this_func, ret);
1206 MYSQLND_METHOD(mysqlnd_conn_data, shutdown)(MYSQLND_CONN_DATA * const conn, uint8_t level)
1211 DBG_INF_FMT("conn=%llu level=%lu", conn->thread_id, level);
1213 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1214 ret = conn->command->shutdown(conn, level);
1215 conn->m->local_tx_end(conn, this_func, ret);
1224 MYSQLND_METHOD(mysqlnd_conn_data, send_close)(MYSQLND_CONN_DATA * const conn)
1227 MYSQLND_VIO * vio = conn->vio;
1229 enum mysqlnd_connection_state state = GET_CONNECTION_STATE(&conn->state);
1232 …DBG_INF_FMT("conn=%llu vio->data->stream->abstract=%p", conn->thread_id, net_stream? net_stream->a…
1237 if (conn->persistent) {
1245 ret = conn->command->quit(conn);
1246 vio->data->m.close_stream(vio, conn->stats, conn->error_info);
1248 SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT);
1259 DBG_ERR_FMT("Brutally closing connection [%p][%s]", conn, conn->scheme.s);
1272 SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT);
1276 vio->data->m.close_stream(vio, conn->stats, conn->error_info);
1287 MYSQLND_METHOD_PRIVATE(mysqlnd_conn_data, get_reference)(MYSQLND_CONN_DATA * const conn)
1290 ++conn->refcount;
1291 DBG_INF_FMT("conn=%llu new_refcount=%u", conn->thread_id, conn->refcount);
1292 DBG_RETURN(conn);
1299 MYSQLND_METHOD_PRIVATE(mysqlnd_conn_data, free_reference)(MYSQLND_CONN_DATA * const conn)
1303 DBG_INF_FMT("conn=%llu old_refcount=%u", conn->thread_id, conn->refcount);
1304 if (!(--conn->refcount)) {
1310 ret = conn->m->send_close(conn);
1311 conn->m->dtor(conn);
1320 MYSQLND_METHOD(mysqlnd_conn_data, field_count)(const MYSQLND_CONN_DATA * const conn)
1322 return conn->field_count;
1329 MYSQLND_METHOD(mysqlnd_conn_data, server_status)(const MYSQLND_CONN_DATA * const conn)
1331 return UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status);
1338 MYSQLND_METHOD(mysqlnd_conn_data, insert_id)(const MYSQLND_CONN_DATA * const conn)
1340 return UPSERT_STATUS_GET_LAST_INSERT_ID(conn->upsert_status);
1347 MYSQLND_METHOD(mysqlnd_conn_data, affected_rows)(const MYSQLND_CONN_DATA * const conn)
1349 return UPSERT_STATUS_GET_AFFECTED_ROWS(conn->upsert_status);
1356 MYSQLND_METHOD(mysqlnd_conn_data, warning_count)(const MYSQLND_CONN_DATA * const conn)
1358 return UPSERT_STATUS_GET_WARNINGS(conn->upsert_status);
1365 MYSQLND_METHOD(mysqlnd_conn_data, info)(const MYSQLND_CONN_DATA * const conn)
1367 return conn->last_message.s;
1390 MYSQLND_METHOD(mysqlnd_conn_data, get_server_info)(const MYSQLND_CONN_DATA * const conn)
1392 return conn->server_version;
1399 MYSQLND_METHOD(mysqlnd_conn_data, get_host_info)(const MYSQLND_CONN_DATA * const conn)
1401 return conn->host_info;
1408 MYSQLND_METHOD(mysqlnd_conn_data, get_proto_info)(const MYSQLND_CONN_DATA * const conn)
1410 return conn->protocol_version;
1417 MYSQLND_METHOD(mysqlnd_conn_data, charset_name)(const MYSQLND_CONN_DATA * const conn)
1419 return conn->charset->name;
1426 MYSQLND_METHOD(mysqlnd_conn_data, thread_id)(const MYSQLND_CONN_DATA * const conn)
1428 return conn->thread_id;
1435 MYSQLND_METHOD(mysqlnd_conn_data, get_server_version)(const MYSQLND_CONN_DATA * const conn)
1440 if (!(p = conn->server_version)) {
1446 if (conn->server_capabilities & CLIENT_PLUGIN_AUTH
1465 MYSQLND_METHOD(mysqlnd_conn_data, more_results)(const MYSQLND_CONN_DATA * const conn)
1469 …DBG_RETURN(UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status) & SERVER_MORE_RESULTS_EXISTS? TRUE…
1476 MYSQLND_METHOD(mysqlnd_conn_data, next_result)(MYSQLND_CONN_DATA * const conn)
1482 DBG_INF_FMT("conn=%llu", conn->thread_id);
1484 SET_EMPTY_ERROR(conn->error_info);
1486 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1488 if (GET_CONNECTION_STATE(&conn->state) != CONN_NEXT_RESULT_PENDING) {
1492 UPSERT_STATUS_SET_AFFECTED_ROWS_TO_ERROR(conn->upsert_status);
1497 if (FAIL == (ret = conn->m->query_read_result_set_header(conn, NULL))) {
1502 if (!conn->error_info->error_no) {
1505 SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT);
1506 conn->m->send_close(conn);
1508 …DBG_INF_FMT("Error from the server : (%u) %s", conn->error_info->error_no, conn->error_info->error…
1512 …if (conn->last_query_type == QUERY_UPSERT && UPSERT_STATUS_GET_AFFECTED_ROWS(conn->upsert_status))…
1513 …MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn->stats, STAT_ROWS_AFFECTED_NORMAL, UPSERT_STATUS_GET_AFFEC…
1516 conn->m->local_tx_end(conn, this_func, ret);
1579 MYSQLND_METHOD(mysqlnd_conn_data, change_user)(MYSQLND_CONN_DATA * const conn,
1592 conn->thread_id, user?user:"", passwd?"***":"null", db?db:"", silent == TRUE);
1594 if (PASS != conn->m->local_tx_start(conn, this_func)) {
1598 SET_EMPTY_ERROR(conn->error_info);
1599 UPSERT_STATUS_SET_AFFECTED_ROWS_TO_ERROR(conn->upsert_status);
1613 ret = mysqlnd_run_authentication(conn, user, passwd, passwd_len, db, strlen(db),
1614 conn->authentication_plugin_data, conn->options->auth_protocol,
1615 … 0 /*charset not used*/, conn->options, conn->server_capabilities, silent, TRUE/*is_change*/);
1621 conn->m->local_tx_end(conn, this_func, ret);
1631 MYSQLND_METHOD(mysqlnd_conn_data, set_client_option)(MYSQLND_CONN_DATA * const conn,
1639 DBG_INF_FMT("conn=%llu option=%u", conn->thread_id, option);
1641 if (PASS != conn->m->local_tx_start(conn, this_func)) {
1655 ret = conn->vio->data->m.set_client_option(conn->vio, option, value);
1660 …ret = conn->protocol_frame_codec->data->m.set_client_option(conn->protocol_frame_codec, option, va…
1664 conn->options->int_and_float_native = *(unsigned int*) value;
1669 conn->options->flags |= CLIENT_LOCAL_FILES;
1671 conn->options->flags &= ~CLIENT_LOCAL_FILES;
1680 …ew_init_commands = mnd_perealloc(conn->options->init_commands, sizeof(char *) * (conn->options->nu…
1684 conn->options->init_commands = new_init_commands;
1685 new_command = mnd_pestrdup(value, conn->persistent);
1689 conn->options->init_commands[conn->options->num_commands] = new_command;
1690 ++conn->options->num_commands;
1705 …SET_CLIENT_ERROR(conn->error_info, CR_CANT_FIND_CHARSET, UNKNOWN_SQLSTATE, "Unknown character set"…
1710 new_charset_name = mnd_pestrdup(value, conn->persistent);
1714 if (conn->options->charset_name) {
1715 mnd_pefree(conn->options->charset_name, conn->persistent);
1717 conn->options->charset_name = new_charset_name;
1718 DBG_INF_FMT("charset=%s", conn->options->charset_name);
1722 conn->options->protocol = MYSQL_PROTOCOL_PIPE;
1726 conn->options->protocol = *(unsigned int*) value;
1743 conn->options->max_allowed_packet = *(unsigned int*) value;
1748 char * new_auth_protocol = value? mnd_pestrdup(value, conn->persistent) : NULL;
1752 if (conn->options->auth_protocol) {
1753 mnd_pefree(conn->options->auth_protocol, conn->persistent);
1755 conn->options->auth_protocol = new_auth_protocol;
1756 DBG_INF_FMT("auth_protocol=%s", conn->options->auth_protocol);
1761 conn->options->flags |= CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS;
1763 conn->options->flags &= ~CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS;
1767 if (conn->options->connect_attr) {
1768 … DBG_INF_FMT("Before reset %d attribute(s)", zend_hash_num_elements(conn->options->connect_attr));
1769 zend_hash_clean(conn->options->connect_attr);
1773 if (conn->options->connect_attr && value) {
1774 … DBG_INF_FMT("Before delete %d attribute(s)", zend_hash_num_elements(conn->options->connect_attr));
1775 zend_hash_str_del(conn->options->connect_attr, value, strlen(value));
1776 DBG_INF_FMT("%d left", zend_hash_num_elements(conn->options->connect_attr));
1788 conn->m->local_tx_end(conn, this_func, ret);
1791 SET_OOM_ERROR(conn->error_info);
1792 conn->m->local_tx_end(conn, this_func, FAIL);
1801 MYSQLND_METHOD(mysqlnd_conn_data, set_client_option_2d)(MYSQLND_CONN_DATA * const conn,
1810 DBG_INF_FMT("conn=%llu option=%u", conn->thread_id, option);
1812 if (PASS != conn->m->local_tx_start(conn, this_func)) {
1817 if (!conn->options->connect_attr) {
1819 conn->options->connect_attr = mnd_pemalloc(sizeof(HashTable), conn->persistent);
1820 if (!conn->options->connect_attr) {
1823 …zend_hash_init(conn->options->connect_attr, 0, NULL, conn->persistent ? ZVAL_INTERNAL_PTR_DTOR : Z…
1830 if (conn->persistent) {
1839 zend_hash_update(conn->options->connect_attr, str, &attrz);
1846 conn->m->local_tx_end(conn, this_func, ret);
1849 SET_OOM_ERROR(conn->error_info);
1850 conn->m->local_tx_end(conn, this_func, FAIL);
1859 MYSQLND_METHOD(mysqlnd_conn_data, use_result)(MYSQLND_CONN_DATA * const conn, const unsigned int fl…
1865 DBG_INF_FMT("conn=%llu", conn->thread_id);
1867 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1869 if (!conn->current_result) {
1874 …if (conn->last_query_type != QUERY_SELECT || GET_CONNECTION_STATE(&conn->state) != CONN_FETCHING_D…
1875 …SET_CLIENT_ERROR(conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
1880 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_UNBUFFERED_SETS);
1882 conn->current_result->conn = conn->m->get_reference(conn);
1883 result = conn->current_result->m.use_result(conn->current_result, FALSE);
1886 conn->current_result->m.free_result(conn->current_result, TRUE);
1888 conn->current_result = NULL;
1891 conn->m->local_tx_end(conn, this_func, result == NULL? FAIL:PASS);
1901 MYSQLND_METHOD(mysqlnd_conn_data, store_result)(MYSQLND_CONN_DATA * const conn, const unsigned int …
1907 DBG_INF_FMT("conn=%llu conn=%p", conn->thread_id, conn);
1909 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1912 if (!conn->current_result) {
1917 …if (conn->last_query_type != QUERY_SELECT || GET_CONNECTION_STATE(&conn->state) != CONN_FETCHING_D…
1918 …SET_CLIENT_ERROR(conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
1923 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_BUFFERED_SETS);
1926 if ((conn->m->get_client_api_capabilities(conn) & MYSQLND_CLIENT_KNOWS_RSET_COPY_DATA)) {
1938 SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "Unknown fetch mode");
1942 result = conn->current_result->m.store_result(conn->current_result, conn, f);
1944 conn->current_result->m.free_result(conn->current_result, TRUE);
1946 conn->current_result = NULL;
1949 conn->m->local_tx_end(conn, this_func, result == NULL? FAIL:PASS);
1958 MYSQLND_METHOD(mysqlnd_conn_data, get_connection_stats)(const MYSQLND_CONN_DATA * const conn,
1962 mysqlnd_fill_stats_hash(conn->stats, mysqlnd_stats_values_names, return_value ZEND_FILE_LINE_CC);
1970 MYSQLND_METHOD(mysqlnd_conn_data, set_autocommit)(MYSQLND_CONN_DATA * conn, unsigned int mode)
1976 if (PASS == conn->m->local_tx_start(conn, this_func)) {
1977 …ret = conn->m->query(conn, (mode) ? "SET AUTOCOMMIT=1":"SET AUTOCOMMIT=0", sizeof("SET AUTOCOMMIT=…
1978 conn->m->local_tx_end(conn, this_func, ret);
1988 MYSQLND_METHOD(mysqlnd_conn_data, tx_commit)(MYSQLND_CONN_DATA * conn)
1990 return conn->m->tx_commit_or_rollback(conn, TRUE, TRANS_COR_NO_OPT, NULL);
1997 MYSQLND_METHOD(mysqlnd_conn_data, tx_rollback)(MYSQLND_CONN_DATA * conn)
1999 return conn->m->tx_commit_or_rollback(conn, FALSE, TRANS_COR_NO_OPT, NULL);
2006 MYSQLND_METHOD(mysqlnd_conn_data, tx_cor_options_to_string)(const MYSQLND_CONN_DATA * const conn, s…
2081 MYSQLND_METHOD(mysqlnd_conn_data, tx_commit_or_rollback)(MYSQLND_CONN_DATA * conn, const zend_bool …
2087 if (PASS == conn->m->local_tx_start(conn, this_func)) {
2090 conn->m->tx_cor_options_to_string(conn, &tmp_str, flags);
2107 SET_OOM_ERROR(conn->error_info);
2111 ret = conn->m->query(conn, query, query_len);
2115 conn->m->local_tx_end(conn, this_func, ret);
2125 MYSQLND_METHOD(mysqlnd_conn_data, tx_begin)(MYSQLND_CONN_DATA * conn, const unsigned int mode, cons…
2131 if (PASS == conn->m->local_tx_start(conn, this_func)) {
2163 SET_OOM_ERROR(conn->error_info);
2166 ret = conn->m->query(conn, query, query_len);
2169 mysqlnd_stmt_errno(conn) == 1064) {
2175 conn->m->local_tx_end(conn, this_func, ret);
2185 MYSQLND_METHOD(mysqlnd_conn_data, tx_savepoint)(MYSQLND_CONN_DATA * conn, const char * const name)
2191 if (PASS == conn->m->local_tx_start(conn, this_func)) {
2196 …SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "Savepoint name not provide…
2201 SET_OOM_ERROR(conn->error_info);
2204 ret = conn->m->query(conn, query, query_len);
2207 conn->m->local_tx_end(conn, this_func, ret);
2217 MYSQLND_METHOD(mysqlnd_conn_data, tx_savepoint_release)(MYSQLND_CONN_DATA * conn, const char * cons…
2223 if (PASS == conn->m->local_tx_start(conn, this_func)) {
2228 …SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "Savepoint name not provide…
2233 SET_OOM_ERROR(conn->error_info);
2236 ret = conn->m->query(conn, query, query_len);
2239 conn->m->local_tx_end(conn, this_func, ret);
2249 MYSQLND_METHOD(mysqlnd_conn_data, negotiate_client_api_capabilities)(MYSQLND_CONN_DATA * const conn…
2253 if (conn) {
2254 ret = conn->client_api_capabilities;
2255 conn->client_api_capabilities = flags;
2265 MYSQLND_METHOD(mysqlnd_conn_data, get_client_api_capabilities)(const MYSQLND_CONN_DATA * const conn)
2268 DBG_RETURN(conn? conn->client_api_capabilities : 0);
2275 MYSQLND_METHOD(mysqlnd_conn_data, local_tx_start)(MYSQLND_CONN_DATA * conn, const size_t this_func)
2285 MYSQLND_METHOD(mysqlnd_conn_data, local_tx_end)(MYSQLND_CONN_DATA * conn, const size_t this_func, c…
2295 MYSQLND_METHOD(mysqlnd_conn_data, stmt_init)(MYSQLND_CONN_DATA * const conn)
2299 ret = conn->object_factory.get_prepared_statement(conn);
2397 MYSQLND_METHOD(mysqlnd_conn, clone_object)(MYSQLND * const conn)
2401 ret = conn->data->object_factory.clone_connection_object(conn);
2409 MYSQLND_METHOD_PRIVATE(mysqlnd_conn, dtor)(MYSQLND * conn)
2412 DBG_INF_FMT("conn=%llu", conn->data->thread_id);
2414 conn->data->m->free_reference(conn->data);
2416 mnd_pefree(conn, conn->persistent);
2428 MYSQLND_CONN_DATA * conn = conn_handle->data; local
2432 DBG_INF_FMT("conn=%llu", conn->thread_id);
2434 if (PASS == conn->m->local_tx_start(conn, this_func)) {
2435 if (GET_CONNECTION_STATE(&conn->state) >= CONN_READY) {
2441 MYSQLND_INC_CONN_STATISTIC(conn->stats, close_type_to_stat_map[close_type]);
2448 ret = conn->m->send_close(conn);
2451 conn->m->local_tx_end(conn, this_func, ret);