MySQL 9.1.0
Source Code Documentation
object_table_definition.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef DD__OBJECT_TABLE_DEFINITION_INCLUDED
25#define DD__OBJECT_TABLE_DEFINITION_INCLUDED
26
27#include <vector>
28
29#include "my_inttypes.h"
30#include "sql/dd/string_type.h" // dd::String_type
31
32namespace dd {
33
34///////////////////////////////////////////////////////////////////////////
35
36class Properties;
37class Table;
38
39///////////////////////////////////////////////////////////////////////////
40
41/**
42 The purpose of this interface is to enable retrieving the SQL statements
43 necessary to create and populate a DD table. An Object_table instance
44 may use one or more instances implementing this interface to keep track
45 of the table definitions corresponding to the supported DD versions.
46*/
47
49 public:
50 virtual ~Object_table_definition() = default;
51
52 /**
53 Set the name of the table.
54
55 @param name Table name.
56 */
57 virtual void set_table_name(const String_type &name) = 0;
58
59 /**
60 Add a field to the object table definition.
61
62 @param field_number Positional index of the field.
63 @param field_name Label which can be used to refer to the field.
64 @param field_definition Complete field definition with name, type etc.
65 */
66 virtual void add_field(int field_number, const String_type &field_name,
67 const String_type field_definition) = 0;
68
69 /**
70 Add an index to the object table definition.
71
72 @param index_number Positional index (sic!) of the index.
73 @param index_name Label which can be used to refer to the index.
74 @param index_definition Complete index definition.
75 */
76 virtual void add_index(int index_number, const String_type &index_name,
77 const String_type &index_definition) = 0;
78
79 /**
80 Get the SQL DDL statement for creating the dictionary table.
81
82 @return String containing the SQL DDL statement for the target table.
83 */
84 virtual String_type get_ddl() const = 0;
85
86 /**
87 Get the SQL DML statements for populating the table.
88
89 @return Vector of strings containing SQL DML statements
90 */
91 virtual const std::vector<String_type> &get_dml() const = 0;
92
93 /**
94 Store the elements of the object table definition into a property
95 object.
96
97 @param [out] table_def_properties Properties object containing the
98 definition.
99 */
101 Properties *table_def_properties) const = 0;
102
103 /**
104 Restore the elements of the object table definition from a property
105 object.
106
107 @param table_def_properties Properties object containing the
108 definition.
109 @return Operation outcome, false if no error.
110 */
112 const Properties &table_def_properties) = 0;
113};
114
115///////////////////////////////////////////////////////////////////////////
116
117} // namespace dd
118
119#endif // DD__OBJECT_TABLE_DEFINITION_INCLUDED
The purpose of this interface is to enable retrieving the SQL statements necessary to create and popu...
Definition: object_table_definition.h:48
virtual const std::vector< String_type > & get_dml() const =0
Get the SQL DML statements for populating the table.
virtual void store_into_properties(Properties *table_def_properties) const =0
Store the elements of the object table definition into a property object.
virtual String_type get_ddl() const =0
Get the SQL DDL statement for creating the dictionary table.
virtual void set_table_name(const String_type &name)=0
Set the name of the table.
virtual void add_field(int field_number, const String_type &field_name, const String_type field_definition)=0
Add a field to the object table definition.
virtual ~Object_table_definition()=default
virtual void add_index(int index_number, const String_type &index_name, const String_type &index_definition)=0
Add an index to the object table definition.
virtual bool restore_from_properties(const Properties &table_def_properties)=0
Restore the elements of the object table definition from a property object.
The Properties class defines an interface for storing key=value pairs, where both key and value may b...
Definition: properties.h:74
Some integer typedefs for easier portability.
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:51
case opt name
Definition: sslopt-case.h:29