24#ifndef DD_SYSTEM_VIEWS__SYSTEM_VIEW_DEFINITION_IMPL_INCLUDED
25#define DD_SYSTEM_VIEWS__SYSTEM_VIEW_DEFINITION_IMPL_INCLUDED
36namespace system_views {
76 return " COLLATE utf8mb4_bin";
101 bool add_quotes =
false) {
111 if (field_name ==
"*") {
115 assert(field_definition.find(
'\'') == String_type::npos);
116 ss <<
'\'' << field_definition <<
'\'';
118 ss << field_definition;
120 ss <<
" AS " << field_name;
193 for (Field_definitions::const_iterator field =
197 ss <<
" " << field->second;
207 ss <<
"\n " << *from;
215 ss <<
"\n " << *
where;
225 ss <<
"CREATE OR REPLACE DEFINER=`mysql.infoschema`@`localhost` VIEW "
269 bool first_query_block =
true;
274 if (first_query_block) {
275 ss <<
"CREATE OR REPLACE DEFINER=`mysql.infoschema`@`localhost` VIEW "
276 <<
"information_schema." <<
view_name() <<
" AS "
277 <<
"(" << select->build_select_query() <<
")";
278 first_query_block =
false;
281 <<
"(" << select->build_select_query() <<
")";
Definition: system_view_definition_impl.h:38
virtual void set_view_name(const String_type &name)
Set view name.
Definition: system_view_definition_impl.h:50
String_type build_ddl_create_view() const override=0
Build CREATE VIEW DDL statement for the system view.
static const String_type fs_name_collation()
Get collation clause to append to view definition for some view columns based on lower_case_table_nam...
Definition: system_view_definition_impl.h:58
static const String_type fs_name_collation_utf8mb4()
Get collation clause to append to view definition for some utf8mb4 view columns that depend on lower_...
Definition: system_view_definition_impl.h:74
String_type m_view_name
Definition: system_view_definition_impl.h:83
virtual const String_type & view_name() const
Get view name.
Definition: system_view_definition_impl.h:45
Definition: system_view_definition.h:37
Definition: system_view_definition_impl.h:86
virtual int field_number(const String_type &field_name) const
Get the field ordinal position number for the given field name.
Definition: system_view_definition_impl.h:173
virtual void add_field(int field_number, const String_type &field_name, const String_type &field_definition, bool add_quotes=false)
Add a field definition for the SELECT projection.
Definition: system_view_definition_impl.h:99
virtual void add_where(const String_type &where)
Add WHERE clause for the SELECT.
Definition: system_view_definition_impl.h:144
String_type build_select_query() const
Build the SELECT query that is used in the CREATE VIEW command.
Definition: system_view_definition_impl.h:183
virtual void add_from(const String_type &from)
Add FROM clause for the SELECT.
Definition: system_view_definition_impl.h:133
virtual void add_cte_expression(const String_type &cte)
Add CTE expression before SELECT.
Definition: system_view_definition_impl.h:153
Where_clauses m_where_clauses
Definition: system_view_definition_impl.h:247
std::map< String_type, int > Field_numbers
Definition: system_view_definition_impl.h:233
Field_definitions m_field_definitions
Definition: system_view_definition_impl.h:245
virtual void add_star()
Indicates selection of all field (SELECT '*').
Definition: system_view_definition_impl.h:165
virtual void add_distinct()
Indicates that we should add DISTINCT clause to SELECT.
Definition: system_view_definition_impl.h:160
std::map< int, String_type > Field_definitions
Definition: system_view_definition_impl.h:236
From_clauses m_from_clauses
Definition: system_view_definition_impl.h:246
bool m_is_distinct
Definition: system_view_definition_impl.h:249
dd::String_type m_cte_expression
Definition: system_view_definition_impl.h:248
Field_numbers m_field_numbers
Definition: system_view_definition_impl.h:244
String_type build_ddl_create_view() const override
Build CREATE VIEW DDL statement for the system view.
Definition: system_view_definition_impl.h:223
bool m_add_star
Definition: system_view_definition_impl.h:250
std::vector< String_type > From_clauses
Definition: system_view_definition_impl.h:239
std::vector< String_type > Where_clauses
Definition: system_view_definition_impl.h:242
Definition: system_view_definition_impl.h:254
std::unique_ptr< System_view_select_definition_impl > Select_definition
Definition: system_view_definition_impl.h:289
System_view_select_definition_impl & get_query_block()
Get the object for a SELECT definition to be used in the UNION.
Definition: system_view_definition_impl.h:261
std::vector< Select_definition > m_selects
Definition: system_view_definition_impl.h:292
String_type build_ddl_create_view() const override
Build CREATE VIEW DDL statement for the system view.
Definition: system_view_definition_impl.h:267
uint lower_case_table_names
Definition: mysqld.cc:1354
static char * where
Definition: mysqldump.cc:153
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
Char_stringstream_template< String_type_allocator > Stringstream_type
Instantiation of std::basic_stringstream with the same allocator as String_type.
Definition: string_type.h:72
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:51
case opt name
Definition: sslopt-case.h:29