Lines Matching refs:conn

220 MYSQLND_METHOD(mysqlnd_conn_data, free_options)(MYSQLND_CONN_DATA * conn)  in MYSQLND_METHOD()
222 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()
254 if (conn->options->local_infile_directory) { in MYSQLND_METHOD()
255 mnd_pefree(conn->options->local_infile_directory, pers); in MYSQLND_METHOD()
256 conn->options->local_infile_directory = NULL; in MYSQLND_METHOD()
264 MYSQLND_METHOD(mysqlnd_conn_data, free_contents)(MYSQLND_CONN_DATA * conn) in MYSQLND_METHOD()
266 bool pers = conn->persistent; in MYSQLND_METHOD()
270 if (conn->current_result) { in MYSQLND_METHOD()
271 conn->current_result->m.free_result(conn->current_result, TRUE); in MYSQLND_METHOD()
272 conn->current_result = NULL; in MYSQLND_METHOD()
275 if (conn->protocol_frame_codec) { in MYSQLND_METHOD()
276 conn->protocol_frame_codec->data->m.free_contents(conn->protocol_frame_codec); in MYSQLND_METHOD()
279 if (conn->vio) { in MYSQLND_METHOD()
280 conn->vio->data->m.free_contents(conn->vio); in MYSQLND_METHOD()
285 mysqlnd_set_persistent_string(&conn->hostname, NULL, 0, pers); in MYSQLND_METHOD()
286 mysqlnd_set_persistent_string(&conn->username, NULL, 0, pers); in MYSQLND_METHOD()
287 mysqlnd_set_persistent_string(&conn->password, NULL, 0, pers); in MYSQLND_METHOD()
288 mysqlnd_set_persistent_string(&conn->connect_or_select_db, NULL, 0, pers); in MYSQLND_METHOD()
289 mysqlnd_set_persistent_string(&conn->unix_socket, NULL, 0, pers); in MYSQLND_METHOD()
290 DBG_INF_FMT("scheme=%s", conn->scheme.s); in MYSQLND_METHOD()
291 mysqlnd_set_persistent_string(&conn->scheme, NULL, 0, pers); in MYSQLND_METHOD()
293 if (conn->server_version) { in MYSQLND_METHOD()
294 mnd_pefree(conn->server_version, pers); in MYSQLND_METHOD()
295 conn->server_version = NULL; in MYSQLND_METHOD()
297 if (conn->host_info) { in MYSQLND_METHOD()
298 mnd_pefree(conn->host_info, pers); in MYSQLND_METHOD()
299 conn->host_info = NULL; in MYSQLND_METHOD()
301 mysqlnd_set_persistent_string(&conn->authentication_plugin_data, NULL, 0, pers); in MYSQLND_METHOD()
302 mysqlnd_set_string(&conn->last_message, NULL, 0); in MYSQLND_METHOD()
304 conn->charset = NULL; in MYSQLND_METHOD()
305 conn->greet_charset = NULL; in MYSQLND_METHOD()
314 MYSQLND_METHOD_PRIVATE(mysqlnd_conn_data, dtor)(MYSQLND_CONN_DATA * conn) in MYSQLND_METHOD_PRIVATE()
317 DBG_INF_FMT("conn=%" PRIu64, conn->thread_id); in MYSQLND_METHOD_PRIVATE()
319 conn->m->free_contents(conn); in MYSQLND_METHOD_PRIVATE()
320 conn->m->free_options(conn); in MYSQLND_METHOD_PRIVATE()
322 if (conn->error_info) { in MYSQLND_METHOD_PRIVATE()
323 mysqlnd_error_info_free_contents(conn->error_info); in MYSQLND_METHOD_PRIVATE()
324 conn->error_info = NULL; in MYSQLND_METHOD_PRIVATE()
327 if (conn->protocol_frame_codec) { in MYSQLND_METHOD_PRIVATE()
328 mysqlnd_pfc_free(conn->protocol_frame_codec, conn->stats, conn->error_info); in MYSQLND_METHOD_PRIVATE()
329 conn->protocol_frame_codec = NULL; in MYSQLND_METHOD_PRIVATE()
332 if (conn->vio) { in MYSQLND_METHOD_PRIVATE()
333 mysqlnd_vio_free(conn->vio, conn->stats, conn->error_info); in MYSQLND_METHOD_PRIVATE()
334 conn->vio = NULL; in MYSQLND_METHOD_PRIVATE()
337 if (conn->payload_decoder_factory) { in MYSQLND_METHOD_PRIVATE()
338 mysqlnd_protocol_payload_decoder_factory_free(conn->payload_decoder_factory); in MYSQLND_METHOD_PRIVATE()
339 conn->payload_decoder_factory = NULL; in MYSQLND_METHOD_PRIVATE()
342 if (conn->stats) { in MYSQLND_METHOD_PRIVATE()
343 mysqlnd_stats_end(conn->stats, conn->persistent); in MYSQLND_METHOD_PRIVATE()
346 mnd_pefree(conn, conn->persistent); in MYSQLND_METHOD_PRIVATE()
355 MYSQLND_METHOD(mysqlnd_conn_data, set_server_option)(MYSQLND_CONN_DATA * const conn, enum_mysqlnd_s… in MYSQLND_METHOD()
358 DBG_RETURN(conn->command->set_option(conn, option)); in MYSQLND_METHOD()
365 MYSQLND_METHOD(mysqlnd_conn_data, restart_psession)(MYSQLND_CONN_DATA * conn) in MYSQLND_METHOD()
368 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_CONNECT_REUSED); in MYSQLND_METHOD()
369 conn->current_result = NULL; in MYSQLND_METHOD()
370 conn->last_message.s = NULL; in MYSQLND_METHOD()
378 MYSQLND_METHOD(mysqlnd_conn_data, end_psession)(MYSQLND_CONN_DATA * conn) in MYSQLND_METHOD()
382 if (conn->current_result) { in MYSQLND_METHOD()
383 conn->current_result->m.free_result(conn->current_result, TRUE); in MYSQLND_METHOD()
384 conn->current_result = NULL; in MYSQLND_METHOD()
386 mysqlnd_set_string(&conn->last_message, NULL, 0); in MYSQLND_METHOD()
387 conn->error_info = &conn->error_info_impl; in MYSQLND_METHOD()
413 MYSQLND_METHOD(mysqlnd_conn_data, execute_init_commands)(MYSQLND_CONN_DATA * conn) in MYSQLND_METHOD()
418 if (conn->options->init_commands) { in MYSQLND_METHOD()
420 for (; current_command < conn->options->num_commands; ++current_command) { in MYSQLND_METHOD()
421 const char * const command = conn->options->init_commands[current_command]; in MYSQLND_METHOD()
423 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_INIT_COMMAND_EXECUTED_COUNT); in MYSQLND_METHOD()
424 if (PASS != conn->m->query(conn, command, strlen(command))) { in MYSQLND_METHOD()
425 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_INIT_COMMAND_FAILED_COUNT); in MYSQLND_METHOD()
430 if (conn->last_query_type == QUERY_SELECT) { in MYSQLND_METHOD()
431 MYSQLND_RES * result = conn->m->use_result(conn); in MYSQLND_METHOD()
436 } while (conn->m->next_result(conn) != FAIL); in MYSQLND_METHOD()
447 MYSQLND_METHOD(mysqlnd_conn_data, get_updated_connect_flags)(MYSQLND_CONN_DATA * conn, unsigned int… in MYSQLND_METHOD()
450 MYSQLND_PFC * pfc = conn->protocol_frame_codec; in MYSQLND_METHOD()
452 MYSQLND_VIO * vio = conn->vio; in MYSQLND_METHOD()
459 mysql_flags |= conn->options->flags; /* use the flags from set_client_option() */ in MYSQLND_METHOD()
485 if (conn->options->connect_attr && zend_hash_num_elements(conn->options->connect_attr)) { in MYSQLND_METHOD()
496 MYSQLND_METHOD(mysqlnd_conn_data, connect_handshake)(MYSQLND_CONN_DATA * conn, in MYSQLND_METHOD()
506 …if (PASS == conn->vio->data->m.connect(conn->vio, *scheme, conn->persistent, conn->stats, conn->er… in MYSQLND_METHOD()
507conn->protocol_frame_codec->data->m.reset(conn->protocol_frame_codec, conn->stats, conn->error_inf… in MYSQLND_METHOD()
510 ret = conn->command->handshake(conn, *username, *password, *database, client_flags); in MYSQLND_METHOD()
518 MYSQLND_METHOD(mysqlnd_conn_data, get_scheme)(MYSQLND_CONN_DATA * conn, MYSQLND_CSTRING hostname, M…
555 MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn,
569 MYSQLND_PFC * pfc = conn->protocol_frame_codec;
573 DBG_INF_FMT("conn=%p", conn);
575 SET_EMPTY_ERROR(conn->error_info);
576 UPSERT_STATUS_SET_AFFECTED_ROWS_TO_ERROR(conn->upsert_status);
580 conn->persistent, (int)GET_CONNECTION_STATE(&conn->state));
582 if (GET_CONNECTION_STATE(&conn->state) > CONN_ALLOCED) {
585 if (GET_CONNECTION_STATE(&conn->state) < CONN_QUIT_SENT) {
586 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_CLOSE_IMPLICIT);
588 conn->m->send_close(conn);
591 conn->m->free_contents(conn);
607 conn->m->set_client_option(conn, MYSQLND_OPT_MAX_ALLOWED_PACKET, (char *)&max_allowed_size);
632 transport = conn->m->get_scheme(conn, hostname, &socket_or_pipe, port, &unix_socket, &named_pipe);
634 mysql_flags = conn->m->get_updated_connect_flags(conn, mysql_flags);
638 …if (FAIL == conn->m->connect_handshake(conn, &scheme, &username, &password, &database, mysql_flags…
644 SET_CONNECTION_STATE(&conn->state, CONN_READY);
657 mysqlnd_set_persistent_string(&conn->scheme, transport.s, transport.l, conn->persistent);
663 if (!conn->scheme.s) {
667 mysqlnd_set_persistent_string(&conn->username, username.s, username.l, conn->persistent);
668 mysqlnd_set_persistent_string(&conn->password, username.s, password.l, conn->persistent);
669 conn->port = port;
670 …mysqlnd_set_persistent_string(&conn->connect_or_select_db, database.s, database.l, conn->persisten…
673 mysqlnd_set_persistent_string(&conn->hostname, hostname.s, hostname.l, conn->persistent);
676 mnd_sprintf(&p, 0, "%s via TCP/IP", conn->hostname.s);
678 SET_OOM_ERROR(conn->error_info);
681 conn->host_info = mnd_pestrdup(p, conn->persistent);
685 conn->unix_socket.s = mnd_pestrdup(socket_or_pipe.s, conn->persistent);
687 conn->host_info = mnd_pestrdup("Localhost via UNIX socket", conn->persistent);
690 mnd_sprintf(&p, 0, "%s via named pipe", conn->unix_socket.s);
692 SET_OOM_ERROR(conn->error_info);
695 conn->host_info = mnd_pestrdup(p, conn->persistent);
700 if (!conn->unix_socket.s || !conn->host_info) {
701 SET_OOM_ERROR(conn->error_info);
704 conn->unix_socket.l = strlen(conn->unix_socket.s);
707 SET_EMPTY_ERROR(conn->error_info);
709 mysqlnd_local_infile_default(conn);
711 if (FAIL == conn->m->execute_init_commands(conn)) {
715 …MYSQLND_INC_CONN_STATISTIC_W_VALUE2(conn->stats, STAT_CONNECT_SUCCESS, 1, STAT_OPENED_CONNECTIONS,…
719 if (conn->persistent) {
720 …MYSQLND_INC_CONN_STATISTIC_W_VALUE2(conn->stats, STAT_PCONNECT_SUCCESS, 1, STAT_OPENED_PERSISTENT_…
723 DBG_INF_FMT("connection_id=%" PRIu64, conn->thread_id);
728 …128s (trying to connect via %s)", conn->error_info->error_no, conn->error_info->error, transport.s…
729 if (!conn->error_info->error_no) {
732 …sg, 0, "Unknown error while trying to connect via %s", transport.s ? transport.s : conn->scheme.s);
733 SET_CLIENT_ERROR(conn->error_info, CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE, msg);
742 conn->m->free_contents(conn);
743 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_CONNECT_FAILURE);
760 MYSQLND_CONN_DATA * conn = conn_handle->data; local
768 …DBG_RETURN(conn->m->connect(conn, hostname, username, password, database, port, socket_or_pipe, my…
779 MYSQLND_METHOD(mysqlnd_conn_data, query)(MYSQLND_CONN_DATA * conn, const char * const query, const …
783 DBG_INF_FMT("conn=%p conn=%" PRIu64 " query=%s", conn, conn->thread_id, query);
785 if (PASS == conn->m->send_query(conn, query, query_len, NULL, NULL) &&
786 PASS == conn->m->reap_query(conn))
789 …if (conn->last_query_type == QUERY_UPSERT && UPSERT_STATUS_GET_AFFECTED_ROWS(conn->upsert_status))…
790 …MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn->stats, STAT_ROWS_AFFECTED_NORMAL, UPSERT_STATUS_GET_AFFEC…
801 MYSQLND_CONN_DATA * conn, const char * const query, const size_t query_len,
805 DBG_INF_FMT("conn=%" PRIu64 " query=%s", conn->thread_id, query);
806 DBG_INF_FMT("conn->server_status=%u", UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status));
809 enum_func_status ret = conn->command->query(conn, query_string);
810 DBG_INF_FMT("conn->server_status=%u", UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status));
818 MYSQLND_METHOD(mysqlnd_conn_data, reap_query)(MYSQLND_CONN_DATA * conn)
821 DBG_INF_FMT("conn=%" PRIu64, conn->thread_id);
823 DBG_INF_FMT("conn->server_status=%u", UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status));
824 enum_func_status ret = conn->command->reap_result(conn);
825 DBG_INF_FMT("conn->server_status=%u", UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status));
833 MYSQLND_METHOD(mysqlnd_conn_data, list_method)(MYSQLND_CONN_DATA * conn, const char * const query, …
840 DBG_INF_FMT("conn=%" PRIu64 " query=%s wild=%p", conn->thread_id, query, achtung_wild);
856 if (PASS == conn->m->query(conn, show_query, show_query_len)) {
857 result = conn->m->store_result(conn);
869 MYSQLND_METHOD(mysqlnd_conn_data, err_no)(const MYSQLND_CONN_DATA * const conn)
871 return conn->error_info->error_no;
878 MYSQLND_METHOD(mysqlnd_conn_data, error)(const MYSQLND_CONN_DATA * const conn)
880 return conn->error_info->error;
887 MYSQLND_METHOD(mysqlnd_conn_data, sqlstate)(const MYSQLND_CONN_DATA * const conn)
889 return conn->error_info->sqlstate[0] ? conn->error_info->sqlstate:MYSQLND_SQLSTATE_NULL;
906 MYSQLND_METHOD(mysqlnd_conn_data, ssl_set)(MYSQLND_CONN_DATA * const conn, const char * key, const …
909 MYSQLND_VIO * vio = conn->vio;
925 MYSQLND_METHOD(mysqlnd_conn_data, escape_string)(MYSQLND_CONN_DATA * const conn, char * newstr, con…
929 DBG_INF_FMT("conn=%" PRIu64, conn->thread_id);
931 DBG_INF_FMT("server_status=%u", UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status));
932 if (UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status) & SERVER_STATUS_NO_BACKSLASH_ESCAPES) {
933 ret = mysqlnd_cset_escape_quotes(conn->charset, newstr, escapestr, escapestr_len);
935 ret = mysqlnd_cset_escape_slashes(conn->charset, newstr, escapestr, escapestr_len);
944 MYSQLND_METHOD(mysqlnd_conn_data, dump_debug_info)(MYSQLND_CONN_DATA * const conn)
947 DBG_INF_FMT("conn=%" PRIu64, conn->thread_id);
948 DBG_RETURN(conn->command->debug(conn));
955 MYSQLND_METHOD(mysqlnd_conn_data, select_db)(MYSQLND_CONN_DATA * const conn, const char * const db,…
958 DBG_INF_FMT("conn=%" PRIu64 " db=%s", conn->thread_id, db);
961 DBG_RETURN(conn->command->init_db(conn, database));
968 MYSQLND_METHOD(mysqlnd_conn_data, ping)(MYSQLND_CONN_DATA * const conn)
971 DBG_INF_FMT("conn=%" PRIu64, conn->thread_id);
973 enum_func_status ret = conn->command->ping(conn);
982 MYSQLND_METHOD(mysqlnd_conn_data, statistic)(MYSQLND_CONN_DATA * conn, zend_string **message)
985 DBG_INF_FMT("conn=%" PRIu64, conn->thread_id);
986 DBG_RETURN(conn->command->statistics(conn, message));
993 MYSQLND_METHOD(mysqlnd_conn_data, kill)(MYSQLND_CONN_DATA * conn, unsigned int pid)
996 DBG_INF_FMT("conn=%" PRIu64 " pid=%u", conn->thread_id, pid);
1000 const unsigned int read_response = (pid != conn->thread_id);
1002 DBG_RETURN(conn->command->process_kill(conn, process_id, read_response));
1009 MYSQLND_METHOD(mysqlnd_conn_data, set_charset)(MYSQLND_CONN_DATA * const conn, const char * const c…
1015 DBG_INF_FMT("conn=%" PRIu64 " cs=%s", conn->thread_id, csname);
1018 …SET_CLIENT_ERROR(conn->error_info, CR_CANT_FIND_CHARSET, UNKNOWN_SQLSTATE, "Invalid character set …
1025 if (FAIL == (ret = conn->m->query(conn, query, query_len)) || conn->error_info->error_no) {
1028 conn->charset = charset;
1040 MYSQLND_METHOD(mysqlnd_conn_data, refresh)(MYSQLND_CONN_DATA * const conn, uint8_t options)
1043 DBG_INF_FMT("conn=%" PRIu64 " options=%u", conn->thread_id, options);
1044 DBG_RETURN(conn->command->refresh(conn, options));
1051 MYSQLND_METHOD(mysqlnd_conn_data, send_close)(MYSQLND_CONN_DATA * const conn)
1054 MYSQLND_VIO * vio = conn->vio;
1056 enum mysqlnd_connection_state state = GET_CONNECTION_STATE(&conn->state);
1059 …DBG_INF_FMT("conn=%" PRIu64 " vio->data->stream->abstract=%p", conn->thread_id, net_stream? net_st…
1064 if (conn->persistent) {
1072 ret = conn->command->quit(conn);
1073 vio->data->m.close_stream(vio, conn->stats, conn->error_info);
1075 SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT);
1086 DBG_ERR_FMT("Brutally closing connection [%p][%s]", conn, conn->scheme.s);
1099 SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT);
1103 vio->data->m.close_stream(vio, conn->stats, conn->error_info);
1114 MYSQLND_METHOD_PRIVATE(mysqlnd_conn_data, get_reference)(MYSQLND_CONN_DATA * const conn)
1117 ++conn->refcount;
1118 DBG_INF_FMT("conn=%" PRIu64 " new_refcount=%u", conn->thread_id, conn->refcount);
1119 DBG_RETURN(conn);
1126 MYSQLND_METHOD_PRIVATE(mysqlnd_conn_data, free_reference)(MYSQLND_CONN_DATA * const conn)
1130 DBG_INF_FMT("conn=%" PRIu64 " old_refcount=%u", conn->thread_id, conn->refcount);
1131 if (!(--conn->refcount)) {
1137 ret = conn->m->send_close(conn);
1138 conn->m->dtor(conn);
1147 MYSQLND_METHOD(mysqlnd_conn_data, field_count)(const MYSQLND_CONN_DATA * const conn)
1149 return conn->field_count;
1156 MYSQLND_METHOD(mysqlnd_conn_data, server_status)(const MYSQLND_CONN_DATA * const conn)
1158 return UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status);
1165 MYSQLND_METHOD(mysqlnd_conn_data, insert_id)(const MYSQLND_CONN_DATA * const conn)
1167 return UPSERT_STATUS_GET_LAST_INSERT_ID(conn->upsert_status);
1174 MYSQLND_METHOD(mysqlnd_conn_data, affected_rows)(const MYSQLND_CONN_DATA * const conn)
1176 return UPSERT_STATUS_GET_AFFECTED_ROWS(conn->upsert_status);
1183 MYSQLND_METHOD(mysqlnd_conn_data, warning_count)(const MYSQLND_CONN_DATA * const conn)
1185 return UPSERT_STATUS_GET_WARNINGS(conn->upsert_status);
1192 MYSQLND_METHOD(mysqlnd_conn_data, info)(const MYSQLND_CONN_DATA * const conn)
1194 return conn->last_message.s;
1217 MYSQLND_METHOD(mysqlnd_conn_data, get_server_info)(const MYSQLND_CONN_DATA * const conn)
1219 return conn->server_version;
1226 MYSQLND_METHOD(mysqlnd_conn_data, get_host_info)(const MYSQLND_CONN_DATA * const conn)
1228 return conn->host_info;
1235 MYSQLND_METHOD(mysqlnd_conn_data, get_proto_info)(const MYSQLND_CONN_DATA * const conn)
1237 return conn->protocol_version;
1244 MYSQLND_METHOD(mysqlnd_conn_data, charset_name)(const MYSQLND_CONN_DATA * const conn)
1246 return conn->charset->name;
1253 MYSQLND_METHOD(mysqlnd_conn_data, thread_id)(const MYSQLND_CONN_DATA * const conn)
1255 return conn->thread_id;
1262 MYSQLND_METHOD(mysqlnd_conn_data, get_server_version)(const MYSQLND_CONN_DATA * const conn)
1267 if (!(p = conn->server_version)) {
1284 MYSQLND_METHOD(mysqlnd_conn_data, more_results)(const MYSQLND_CONN_DATA * const conn)
1288 …DBG_RETURN(UPSERT_STATUS_GET_SERVER_STATUS(conn->upsert_status) & SERVER_MORE_RESULTS_EXISTS? TRUE…
1295 MYSQLND_METHOD(mysqlnd_conn_data, next_result)(MYSQLND_CONN_DATA * const conn)
1298 DBG_INF_FMT("conn=%" PRIu64 "", conn->thread_id);
1300 SET_EMPTY_ERROR(conn->error_info);
1302 if (GET_CONNECTION_STATE(&conn->state) != CONN_NEXT_RESULT_PENDING) {
1306 UPSERT_STATUS_SET_AFFECTED_ROWS_TO_ERROR(conn->upsert_status);
1311 enum_func_status ret = conn->m->query_read_result_set_header(conn, NULL);
1317 if (!conn->error_info->error_no) {
1320 SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT);
1321 conn->m->send_close(conn);
1323 …DBG_INF_FMT("Error from the server : (%u) %s", conn->error_info->error_no, conn->error_info->error…
1327 …if (conn->last_query_type == QUERY_UPSERT && UPSERT_STATUS_GET_AFFECTED_ROWS(conn->upsert_status))…
1328 …MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn->stats, STAT_ROWS_AFFECTED_NORMAL, UPSERT_STATUS_GET_AFFEC…
1337 MYSQLND_METHOD(mysqlnd_conn_data, change_user)(MYSQLND_CONN_DATA * const conn,
1349 conn->thread_id, user?user:"", passwd?"***":"null", db?db:"", silent == TRUE);
1351 SET_EMPTY_ERROR(conn->error_info);
1352 UPSERT_STATUS_SET_AFFECTED_ROWS_TO_ERROR(conn->upsert_status);
1366 ret = mysqlnd_run_authentication(conn, user, passwd, passwd_len, db, strlen(db),
1367 conn->authentication_plugin_data, conn->options->auth_protocol,
1368 … 0 /*charset not used*/, conn->options, conn->server_capabilities, silent, TRUE/*is_change*/);
1382 MYSQLND_METHOD(mysqlnd_conn_data, set_client_option)(MYSQLND_CONN_DATA * const conn,
1389 DBG_INF_FMT("conn=%" PRIu64 " option=%u", conn->thread_id, option);
1402 ret = conn->vio->data->m.set_client_option(conn->vio, option, value);
1407 …ret = conn->protocol_frame_codec->data->m.set_client_option(conn->protocol_frame_codec, option, va…
1410 conn->options->int_and_float_native = *(unsigned int*) value;
1414 conn->options->flags |= CLIENT_LOCAL_FILES;
1416 conn->options->flags &= ~CLIENT_LOCAL_FILES;
1421 if (conn->options->local_infile_directory) {
1422 mnd_pefree(conn->options->local_infile_directory, conn->persistent);
1426 conn->options->local_infile_directory = NULL;
1428 conn->options->local_infile_directory = mnd_pestrdup(value, conn->persistent);
1438 …ew_init_commands = mnd_perealloc(conn->options->init_commands, sizeof(char *) * (conn->options->nu…
1439 conn->options->init_commands = new_init_commands;
1440 new_command = mnd_pestrdup(value, conn->persistent);
1441 conn->options->init_commands[conn->options->num_commands] = new_command;
1442 ++conn->options->num_commands;
1453 …SET_CLIENT_ERROR(conn->error_info, CR_CANT_FIND_CHARSET, UNKNOWN_SQLSTATE, "Unknown character set"…
1458 new_charset_name = mnd_pestrdup(value, conn->persistent);
1459 if (conn->options->charset_name) {
1460 mnd_pefree(conn->options->charset_name, conn->persistent);
1462 conn->options->charset_name = new_charset_name;
1463 DBG_INF_FMT("charset=%s", conn->options->charset_name);
1467 conn->options->protocol = MYSQL_PROTOCOL_PIPE;
1471 conn->options->protocol = *(unsigned int*) value;
1476 conn->options->max_allowed_packet = *(unsigned int*) value;
1481 char * new_auth_protocol = value? mnd_pestrdup(value, conn->persistent) : NULL;
1482 if (conn->options->auth_protocol) {
1483 mnd_pefree(conn->options->auth_protocol, conn->persistent);
1485 conn->options->auth_protocol = new_auth_protocol;
1486 DBG_INF_FMT("auth_protocol=%s", conn->options->auth_protocol);
1491 conn->options->flags |= CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS;
1493 conn->options->flags &= ~CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS;
1497 if (conn->options->connect_attr) {
1498 … DBG_INF_FMT("Before reset %d attribute(s)", zend_hash_num_elements(conn->options->connect_attr));
1499 zend_hash_clean(conn->options->connect_attr);
1503 if (conn->options->connect_attr && value) {
1504 … DBG_INF_FMT("Before delete %d attribute(s)", zend_hash_num_elements(conn->options->connect_attr));
1505 zend_hash_str_del(conn->options->connect_attr, value, strlen(value));
1506 DBG_INF_FMT("%d left", zend_hash_num_elements(conn->options->connect_attr));
1519 MYSQLND_METHOD(mysqlnd_conn_data, set_client_option_2d)(MYSQLND_CONN_DATA * const conn,
1527 DBG_INF_FMT("conn=%" PRIu64 " option=%u", conn->thread_id, option);
1531 if (!conn->options->connect_attr) {
1533 conn->options->connect_attr = mnd_pemalloc(sizeof(HashTable), conn->persistent);
1534 …zend_hash_init(conn->options->connect_attr, 0, NULL, conn->persistent ? ZVAL_INTERNAL_PTR_DTOR : Z…
1541 if (conn->persistent) {
1550 zend_hash_update(conn->options->connect_attr, str, &attrz);
1564 MYSQLND_METHOD(mysqlnd_conn_data, use_result)(MYSQLND_CONN_DATA * const conn)
1567 DBG_INF_FMT("conn=%" PRIu64, conn->thread_id);
1569 if (!conn->current_result) {
1574 …if (conn->last_query_type != QUERY_SELECT || GET_CONNECTION_STATE(&conn->state) != CONN_FETCHING_D…
1575 …SET_CLIENT_ERROR(conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
1580 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_UNBUFFERED_SETS);
1582 conn->current_result->conn = conn->m->get_reference(conn);
1584 MYSQLND_RES *result = conn->current_result->m.use_result(conn->current_result, FALSE);
1586 conn->current_result->m.free_result(conn->current_result, TRUE);
1588 conn->current_result = NULL;
1596 MYSQLND_METHOD(mysqlnd_conn_data, store_result)(MYSQLND_CONN_DATA * const conn)
1599 DBG_INF_FMT("conn=%" PRIu64 " conn=%p", conn->thread_id, conn);
1601 if (!conn->current_result) {
1606 …if (conn->last_query_type != QUERY_SELECT || GET_CONNECTION_STATE(&conn->state) != CONN_FETCHING_D…
1607 …SET_CLIENT_ERROR(conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
1612 MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_BUFFERED_SETS);
1613 MYSQLND_RES *result = conn->current_result->m.store_result(conn->current_result, conn, NULL);
1615 conn->current_result->m.free_result(conn->current_result, TRUE);
1617 conn->current_result = NULL;
1625 MYSQLND_METHOD(mysqlnd_conn_data, get_connection_stats)(const MYSQLND_CONN_DATA * const conn,
1629 mysqlnd_fill_stats_hash(conn->stats, mysqlnd_stats_values_names, return_value ZEND_FILE_LINE_CC);
1637 MYSQLND_METHOD(mysqlnd_conn_data, set_autocommit)(MYSQLND_CONN_DATA * conn, unsigned int mode)
1640 …DBG_RETURN(conn->m->query(conn, (mode) ? "SET AUTOCOMMIT=1":"SET AUTOCOMMIT=0", sizeof("SET AUTOCO…
1647 MYSQLND_METHOD(mysqlnd_conn_data, tx_commit)(MYSQLND_CONN_DATA * conn)
1649 return conn->m->tx_commit_or_rollback(conn, TRUE, TRANS_COR_NO_OPT, NULL);
1656 MYSQLND_METHOD(mysqlnd_conn_data, tx_rollback)(MYSQLND_CONN_DATA * conn)
1658 return conn->m->tx_commit_or_rollback(conn, FALSE, TRANS_COR_NO_OPT, NULL);
1665 MYSQLND_METHOD(mysqlnd_conn_data, tx_cor_options_to_string)(const MYSQLND_CONN_DATA * const conn, s…
1740 MYSQLND_METHOD(mysqlnd_conn_data, tx_commit_or_rollback)(MYSQLND_CONN_DATA * conn, const bool commi…
1745 conn->m->tx_cor_options_to_string(conn, &tmp_str, flags);
1760 SET_OOM_ERROR(conn->error_info);
1764 enum_func_status ret = conn->m->query(conn, query, query_len);
1773 MYSQLND_METHOD(mysqlnd_conn_data, tx_begin)(MYSQLND_CONN_DATA * conn, const unsigned int mode, cons…
1806 SET_OOM_ERROR(conn->error_info);
1810 enum_func_status ret = conn->m->query(conn, query, query_len);
1812 …if (ret && mode & (TRANS_START_READ_WRITE | TRANS_START_READ_ONLY) && mysqlnd_stmt_errno(conn) == …
1813 SET_CLIENT_ERROR(conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE,
1824 MYSQLND_METHOD(mysqlnd_conn_data, tx_savepoint)(MYSQLND_CONN_DATA * conn, const char * const name)
1829 …SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "Savepoint name not provide…
1836 SET_OOM_ERROR(conn->error_info);
1840 enum_func_status ret = conn->m->query(conn, query, query_len);
1849 MYSQLND_METHOD(mysqlnd_conn_data, tx_savepoint_release)(MYSQLND_CONN_DATA * conn, const char * cons…
1854 …SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "Savepoint name not provide…
1861 SET_OOM_ERROR(conn->error_info);
1865 enum_func_status ret = conn->m->query(conn, query, query_len);
1874 MYSQLND_METHOD(mysqlnd_conn_data, negotiate_client_api_capabilities)(MYSQLND_CONN_DATA * const conn
1878 if (conn) {
1879 ret = conn->client_api_capabilities;
1880 conn->client_api_capabilities = flags;
1890 MYSQLND_METHOD(mysqlnd_conn_data, get_client_api_capabilities)(const MYSQLND_CONN_DATA * const conn)
1893 DBG_RETURN(conn? conn->client_api_capabilities : 0);
1900 MYSQLND_METHOD(mysqlnd_conn_data, stmt_init)(MYSQLND_CONN_DATA * const conn)
1904 ret = conn->object_factory.get_prepared_statement(conn);
1999 MYSQLND_METHOD(mysqlnd_conn, clone_object)(MYSQLND * const conn)
2003 ret = conn->data->object_factory.clone_connection_object(conn);
2011 MYSQLND_METHOD_PRIVATE(mysqlnd_conn, dtor)(MYSQLND * conn)
2014 DBG_INF_FMT("conn=%" PRIu64, conn->data->thread_id);
2016 conn->data->m->free_reference(conn->data);
2018 mnd_pefree(conn, conn->persistent);
2029 MYSQLND_CONN_DATA * conn = conn_handle->data; local
2032 DBG_INF_FMT("conn=%" PRIu64, conn->thread_id);
2034 if (GET_CONNECTION_STATE(&conn->state) >= CONN_READY) {
2040 MYSQLND_INC_CONN_STATISTIC(conn->stats, close_type_to_stat_map[close_type]);
2047 enum_func_status ret = conn->m->send_close(conn);