MySQL 9.3.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
query_rest_sp.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2021, 2025, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
26#ifndef ROUTER_SRC_REST_MRS_SRC_MRS_DATABASE_QUERY_REST_SP_H_
27#define ROUTER_SRC_REST_MRS_SRC_MRS_DATABASE_QUERY_REST_SP_H_
28
29#include <memory>
30#include <optional>
31#include <string>
32#include <vector>
33
35#include "helper/mysql_column.h"
39#include "mrs/gtid_manager.h"
41
42namespace mrs {
43namespace database {
44
45class QueryRestSP : private Query {
46 using Row = Query::Row;
48
49 public:
50 explicit QueryRestSP(JsonTemplateFactory *factory = nullptr);
51
53 const std::string &schema,
54 const std::string &object, const std::string &url,
55 const std::string &ignore_column,
56 const mysqlrouter::sqlstring &values = {},
57 std::vector<MYSQL_BIND> pt = {},
58 const ResultSets &rs = {},
61 mrs::GtidManager *gtid_manager = nullptr);
62
63 const char *get_sql_state();
64 std::string response;
65
66 protected:
67 std::shared_ptr<JsonTemplate> create_template(JsonTemplateType type);
68
70 bool has_out_params_{false};
73 std::shared_ptr<JsonTemplate> response_template_;
74 std::vector<helper::Column> columns_;
76 const char *ignore_column_{nullptr};
77 std::string url_;
78 const ResultSets *rs_{nullptr};
79 uint32_t resultset_{0};
81
82 void columns_set(unsigned number, MYSQL_FIELD *fields);
83
84 void on_row(const ResultRow &r) override;
85 void on_metadata(unsigned int number, MYSQL_FIELD *fields) override;
86};
87
88} // namespace database
89} // namespace mrs
90
91#endif // ROUTER_SRC_REST_MRS_SRC_MRS_DATABASE_QUERY_REST_SP_H_
Definition: counted_mysql_session.h:38
Definition: gtid_manager.h:50
Definition: json_template.h:85
Definition: query.h:37
MySQLSession::ResultRow ResultRow
Definition: query.h:41
MySQLSession::Row Row
Definition: query.h:40
Definition: query_rest_sp.h:45
const char * get_sql_state()
Definition: query_rest_sp.cc:189
std::shared_ptr< JsonTemplate > create_template(JsonTemplateType type)
Definition: query_rest_sp.cc:179
void on_row(const ResultRow &r) override
Definition: query_rest_sp.cc:238
virtual void query_entries(collector::CountedMySQLSession *session, const std::string &schema, const std::string &object, const std::string &url, const std::string &ignore_column, const mysqlrouter::sqlstring &values={}, std::vector< MYSQL_BIND > pt={}, const ResultSets &rs={}, const JsonTemplateType type=JsonTemplateType::kObjectNestedOutParameters, mrs::GtidManager *gtid_manager=nullptr)
Definition: query_rest_sp.cc:194
bool items_started_
Definition: query_rest_sp.h:69
uint64_t number_of_resultsets_
Definition: query_rest_sp.h:72
std::string response
Definition: query_rest_sp.h:64
std::vector< helper::Column > columns_
Definition: query_rest_sp.h:74
std::shared_ptr< JsonTemplate > response_template_
Definition: query_rest_sp.h:73
bool has_out_params_
Definition: query_rest_sp.h:70
uint32_t resultset_
Definition: query_rest_sp.h:79
JsonTemplateFactory * factory_
Definition: query_rest_sp.h:80
entry::ResultSets ResultSets
Definition: query_rest_sp.h:47
void on_metadata(unsigned int number, MYSQL_FIELD *fields) override
Definition: query_rest_sp.cc:242
QueryRestSP(JsonTemplateFactory *factory=nullptr)
Definition: query_rest_sp.cc:149
const ResultSets * rs_
Definition: query_rest_sp.h:78
const char * ignore_column_
Definition: query_rest_sp.h:76
uint64_t items_in_resultset_
Definition: query_rest_sp.h:71
std::string columns_items_type_
Definition: query_rest_sp.h:75
void columns_set(unsigned number, MYSQL_FIELD *fields)
Definition: query_rest_sp.cc:151
std::string url_
Definition: query_rest_sp.h:77
Definition: utils_sqlstring.h:67
JsonTemplateType
Definition: json_template.h:79
mrs::database::entry::ResultSets ResultSets
Definition: handler_db_object_script.cc:83
Definition: authorize_manager.h:48
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:86
required string type
Definition: replication_group_member_actions.proto:34
Definition: mysql.h:121