- Notifications
You must be signed in to change notification settings - Fork 4k
/
Copy pathadmin_cmd_index.h
98 lines (81 loc) · 3.52 KB
/
admin_cmd_index.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
* Copyright (c) 2017, 2025, Oracle and/or its affiliates.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2.0,
* as published by the Free Software Foundation.
*
* This program is designed to work with certain software (including
* but not limited to OpenSSL) that is licensed under separate terms,
* as designated in a particular file or component or in included license
* documentation. The authors of MySQL hereby grant you an additional
* permission to link the program and your derivative works with the
* separately licensed software that they have either included with
* the program or referenced in the documentation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License, version 2.0, for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef PLUGIN_X_SRC_ADMIN_CMD_INDEX_H_
#definePLUGIN_X_SRC_ADMIN_CMD_INDEX_H_
#include<limits>
#include<string>
#include<vector>
#include"plugin/x/src/admin_cmd_handler.h"
#include"plugin/x/src/interface/admin_command_arguments.h"
namespacexpl {
classQuery_string_builder;
classAdmin_command_index {
public:
using Command_arguments = iface::Admin_command_arguments;
using Argument_appearance = Command_arguments::Appearance_type;
explicitAdmin_command_index(iface::Session *session) : m_session(session) {}
ngs::Error_code create(Command_arguments *args);
ngs::Error_code drop(Command_arguments *args);
structIndex_field_info {
std::string m_path;
std::string m_type;
bool m_is_required{false};
uint64_t m_options{std::numeric_limits<uint64_t>::max()};
uint64_t m_srid{std::numeric_limits<uint64_t>::max()};
};
classIndex_field_interface {
public:
virtual~Index_field_interface() = default;
virtual ngs::Error_code add_column_if_necessary(
iface::Sql_session *sql_session, const std::string &schema,
const std::string &collection, Query_string_builder *qb) const = 0;
virtualvoidadd_field(Query_string_builder *qb) const = 0;
virtualboolis_required() const = 0;
};
protected:
enumclassIndex_type_id {
k_index,
k_spatial,
k_fulltext,
k_unsupported = 99
};
Index_type_id get_type_id(const std::string &type_name) const;
std::string get_default_field_type(const Index_type_id id,
constbool is_array) const;
ngs::Error_code get_index_generated_column_names(
const std::string &schema, const std::string &collection,
const std::string &index_name,
std::vector<std::string> *column_names) const;
boolis_table_support_virtual_columns(const std::string &schema_name,
const std::string &table_name,
ngs::Error_code *error) const;
const Index_field_interface *create_field(constbool is_virtual_allowed,
const Index_type_id &index_type,
Command_arguments *constraint,
ngs::Error_code *error) const;
iface::Session *m_session;
};
} // namespace xpl
#endif// PLUGIN_X_SRC_ADMIN_CMD_INDEX_H_