MySQL 26.10.0
Source Code Documentation
health_monitor_query.h
Go to the documentation of this file.
1/* Copyright (c) 2023, 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#pragma once
25
26#include <string>
27#include <vector>
28
29namespace hm {
30
31typedef std::string Field;
32typedef std::vector<std::string> Row;
33typedef std::vector<Row> Result_Set;
34
35struct Query {
36 Query() = default;
37 explicit Query(const char *query_text) : query{query_text} {}
38 explicit Query(std::string query_text) : query{std::move(query_text)} {}
39 Query(std::string query_title, std::string query_text)
40 : title{std::move(query_title)}, query{std::move(query_text)} {}
41
42 const std::string title;
43 const std::string query;
44 int run(Result_Set &r) const;
45};
46
47/**
48 Query processor
49*/
51 public:
52 Query_Manager() = default;
53 ~Query_Manager() = default;
54 Query_Manager(const Query_Manager &) = delete;
58
59 static int run_query(const Query &query_info, Result_Set &result_set);
60 static int run_query(const Query &&query_info, Result_Set &result_set);
61 static int run_query(const Query &query_info);
62 static int run_query(const Query &&query_info);
63};
64
65} // namespace hm
Query processor.
Definition: health_monitor_query.h:50
Query_Manager(const Query_Manager &)=delete
~Query_Manager()=default
static int run_query(const Query &query_info, Result_Set &result_set)
Establish a connection to the server then execute all report queries.
Definition: health_monitor_query.cc:52
Query_Manager & operator=(Query_Manager &&)=delete
Query_Manager & operator=(const Query_Manager &)=delete
Query_Manager(Query_Manager &&)=delete
Query_Manager()=default
Definition: component_command.h:29
std::vector< std::string > Row
Definition: health_monitor_query.h:32
std::vector< Row > Result_Set
Definition: health_monitor_query.h:33
std::string Field
Definition: health_monitor_query.h:31
static mysql_service_status_t result_set(UDF_INIT *, const char *, void *) noexcept
Definition: mysql_udf_metadata_all_empty.cc:53
Define std::hash<Gtid>.
Definition: gtid.h:355
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:86
Definition: health_monitor_query.h:35
const std::string query
Definition: health_monitor_query.h:43
int run(Result_Set &r) const
Default way to execute queries.
Definition: health_monitor_query.cc:42
Query(const char *query_text)
Definition: health_monitor_query.h:37
Query(std::string query_title, std::string query_text)
Definition: health_monitor_query.h:39
Query()=default
Query(std::string query_text)
Definition: health_monitor_query.h:38
const std::string title
Definition: health_monitor_query.h:42