/* Copyright (c) 2014, 2024, 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 */ #include "sql/dd/dd.h" #include "sql/dd/cache/object_registry.h" #include "sql/dd/impl/cache/shared_dictionary_cache.h" // dd::cache::Shared_... #include "sql/dd/impl/dictionary_impl.h" // dd::Dictionary_impl #include "sql/dd/impl/system_registry.h" // dd::System_tables #include "sql/dd/impl/types/charset_impl.h" #include "sql/dd/impl/types/collation_impl.h" #include "sql/dd/impl/types/column_impl.h" #include "sql/dd/impl/types/column_statistics_impl.h" #include "sql/dd/impl/types/column_type_element_impl.h" #include "sql/dd/impl/types/entity_object_impl.h" #include "sql/dd/impl/types/event_impl.h" #include "sql/dd/impl/types/foreign_key_element_impl.h" #include "sql/dd/impl/types/foreign_key_impl.h" #include "sql/dd/impl/types/function_impl.h" #include "sql/dd/impl/types/index_element_impl.h" #include "sql/dd/impl/types/index_impl.h" #include "sql/dd/impl/types/index_stat_impl.h" #include "sql/dd/impl/types/partition_impl.h" #include "sql/dd/impl/types/partition_index_impl.h" #include "sql/dd/impl/types/partition_value_impl.h" #include "sql/dd/impl/types/procedure_impl.h" #include "sql/dd/impl/types/resource_group_impl.h" #include "sql/dd/impl/types/schema_impl.h" #include "sql/dd/impl/types/spatial_reference_system_impl.h" #include "sql/dd/impl/types/table_impl.h" #include "sql/dd/impl/types/table_stat_impl.h" #include "sql/dd/impl/types/tablespace_file_impl.h" #include "sql/dd/impl/types/tablespace_impl.h" #include "sql/dd/impl/types/view_impl.h" namespace dd { bool init(enum_dd_init_type dd_init) { if (dd_init == enum_dd_init_type::DD_INITIALIZE || dd_init == enum_dd_init_type::DD_RESTART_OR_UPGRADE) { cache::Shared_dictionary_cache::init(); System_tables::instance()->add_inert_dd_tables(); System_views::instance()->init(); } return Dictionary_impl::init(dd_init); } /////////////////////////////////////////////////////////////////////////// bool shutdown() { cache::Shared_dictionary_cache::shutdown(); return Dictionary_impl::shutdown(); } Dictionary *get_dictionary() { return Dictionary_impl::instance(); } template X *create_object() { return dynamic_cast(new (std::nothrow) typename X::Impl()); } template Charset_impl *create_object(); template Collation *create_object(); template Collation_impl *create_object(); template Column *create_object(); template Column_statistics *create_object(); template Column_type_element *create_object(); template Event *create_object(); template Function *create_object(); template Foreign_key *create_object(); template Foreign_key_element *create_object(); template Index *create_object(); template Index_element *create_object(); template Index_stat *create_object(); template Partition *create_object(); template Partition_index *create_object(); template Partition_value *create_object(); template Procedure *create_object(); template Resource_group *create_object(); template Schema *create_object(); template Spatial_reference_system *create_object(); template Table *create_object(); template Table_stat *create_object(); template Tablespace *create_object(); template Tablespace_file *create_object(); template View *create_object(); namespace cache { template void Object_registry::create_map(std::unique_ptr *map) { map->reset(new T); } template void Object_registry::create_map( std::unique_ptr> *map); template void Object_registry::create_map( std::unique_ptr> *map); template void Object_registry::create_map( std::unique_ptr> *map); template void Object_registry::create_map( std::unique_ptr> *map); template void Object_registry::create_map( std::unique_ptr> *map); template void Object_registry::create_map( std::unique_ptr> *map); template void Object_registry::create_map( std::unique_ptr> *map); template void Object_registry::create_map( std::unique_ptr> *map); template void Object_registry::create_map( std::unique_ptr> *map); template void Object_registry::create_map( std::unique_ptr> *map); } // namespace cache } // namespace dd