MySQL 26.7.0
Source Code Documentation
mysql_command_session_state.h
Go to the documentation of this file.
1/* Copyright (c) 2026, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is designed to work with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have either included with
13the program or referenced in the documentation.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License, version 2.0, for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef MYSQL_COMMAND_SESSION_STATE_H
25#define MYSQL_COMMAND_SESSION_STATE_H
26
30#include <stddef.h>
31
32/**
33 @ingroup group_components_services_inventory
34
35 Provide iterator access to session-tracker data cached in the MYSQL handle
36 used by command services.
37
38 init() creates an iterator snapshot for the requested tracker type from the
39 cached session-tracker data of the most recent command executed through this
40 MYSQL_H. The iterator owns its traversal state and must be released with
41 deinit().
42
43 get_next() copies data into caller-provided storage and returns the actual
44 item length through @p length. If @p buffer is NULL or @p buffer_length is too
45 small, MYSQL_COMMAND_SESSION_STATE_BUFFER_TOO_SMALL is returned and the
46 iterator is not advanced.
47
48 The cache is populated only when the active text consumer advertises
49 CLIENT_SESSION_TRACK.
50
51 For MYSQL_COMMAND_SESSION_TRACK_SYSTEM_VARIABLES, iteration returns
52 alternating variable name and variable value entries, matching
53 mysql_session_track_get_first() and mysql_session_track_get_next().
54*/
56
57BEGIN_SERVICE_DEFINITION(mysql_command_session_state)
58
59/**
60 Initializes an iterator for a session-tracker type.
61
62 @param mysql_h Command-service handle.
63 @param type Session-tracker type to read.
64 @param[out] iterator Iterator handle.
65
66 @return
67 @retval MYSQL_COMMAND_SESSION_STATE_OK Success. @p iterator must be released
68 with deinit().
69 @retval MYSQL_COMMAND_SESSION_STATE_END No item available for this tracker
70 type.
71 @retval MYSQL_COMMAND_SESSION_STATE_INVALID Invalid input.
72 @retval MYSQL_COMMAND_SESSION_STATE_ERROR Internal error.
73*/
77
78/**
79 Copies the next iterator item into a caller-provided buffer.
80
81 @param iterator Iterator handle returned by init().
82 @param[out] buffer Output buffer, or NULL to query actual item length.
83 @param buffer_length Output buffer length in bytes.
84 @param[out] length Actual item length in bytes.
85
86 @return
87 @retval MYSQL_COMMAND_SESSION_STATE_OK Success. The iterator advances.
88 @retval MYSQL_COMMAND_SESSION_STATE_END No further item is available.
89 @retval MYSQL_COMMAND_SESSION_STATE_INVALID Invalid input.
90 @retval MYSQL_COMMAND_SESSION_STATE_BUFFER_TOO_SMALL The buffer is NULL or
91 too small. @p length contains the actual item length. The iterator
92 is not advanced.
93 @retval MYSQL_COMMAND_SESSION_STATE_ERROR Internal error.
94*/
97 size_t buffer_length, size_t *length));
98
99/**
100 Releases an iterator returned by init().
101
102 @param iterator Iterator handle.
103*/
105
106END_SERVICE_DEFINITION(mysql_command_session_state)
107
108#endif /* MYSQL_COMMAND_SESSION_STATE_H */
static mysql_service_status_t deinit()
Component deinitialization.
Definition: audit_api_message_emit.cc:575
static mysql_service_status_t init()
Component initialization.
Definition: audit_api_message_emit.cc:566
struct MYSQL_COMMAND_SESSION_STATE_ITERATOR_H_imp * MYSQL_COMMAND_SESSION_STATE_ITERATOR_H
Provide iterator access to session-tracker data cached in the MYSQL handle used by command services.
Definition: mysql_command_session_state.h:55
struct MYSQL_H_imp * MYSQL_H
Definition: mysql_command_services.h:33
int mysql_command_session_state_type
Definition: mysql_command_session_state_bits.h:29
mysql_command_session_state_status
Status codes returned by mysql_command_session_state service methods.
Definition: mysql_command_session_state_bits.h:34
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
required string type
Definition: replication_group_member_actions.proto:34
#define DECLARE_METHOD(retval, name, args)
Declares a method as a part of the Service definition.
Definition: service.h:103
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:91
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:86
#define DEFINE_SERVICE_HANDLE(name)
Defines an object type that is meant for carrying handles to the implementation-specific objects used...
Definition: service.h:129