forked from alibaba/AliSQL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtable_stat_impl.h
More file actions
250 lines (187 loc) · 8.08 KB
/
Copy pathtable_stat_impl.h
File metadata and controls
250 lines (187 loc) · 8.08 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
/* Copyright (c) 2014, 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 DD__TABLE_STAT_IMPL_INCLUDED
#define DD__TABLE_STAT_IMPL_INCLUDED
#include <memory>
#include <new>
#include <string>
#include "my_inttypes.h"
#include "sql/dd/impl/raw/raw_record.h"
#include "sql/dd/impl/types/entity_object_impl.h" // dd::Entity_object_impl
#include "sql/dd/object_id.h"
#include "sql/dd/string_type.h"
#include "sql/dd/types/entity_object_table.h"
#include "sql/dd/types/table_stat.h" // dd::Table_stat
namespace dd {
///////////////////////////////////////////////////////////////////////////
class Charset;
class Object_key;
class Object_table;
class Open_dictionary_tables_ctx;
class Raw_table;
class Transaction;
class Weak_object;
class Object_table;
///////////////////////////////////////////////////////////////////////////
class Table_stat_impl : public Entity_object_impl, public Table_stat {
public:
Table_stat_impl()
: m_table_rows(0),
m_avg_row_length(0),
m_data_length(0),
m_max_data_length(0),
m_index_length(0),
m_data_free(0),
m_auto_increment(0),
m_checksum(0),
m_update_time(0),
m_check_time(0),
m_cached_time(0) {}
public:
void debug_print(String_type &outb) const override;
const Object_table &object_table() const override;
bool validate() const override;
bool restore_attributes(const Raw_record &r) override;
bool store_attributes(Raw_record *r) override;
public:
static void register_tables(Open_dictionary_tables_ctx *otx);
/////////////////////////////////////////////////////////////////////////
// schema name.
/////////////////////////////////////////////////////////////////////////
const String_type &schema_name() const override { return m_schema_name; }
void set_schema_name(const String_type &schema_name) override {
m_schema_name = schema_name;
}
/////////////////////////////////////////////////////////////////////////
// table name.
/////////////////////////////////////////////////////////////////////////
const String_type &table_name() const override { return m_table_name; }
void set_table_name(const String_type &table_name) override {
m_table_name = table_name;
}
/////////////////////////////////////////////////////////////////////////
// table_rows.
/////////////////////////////////////////////////////////////////////////
ulonglong table_rows() const override { return m_table_rows; }
void set_table_rows(ulonglong table_rows) override {
m_table_rows = table_rows;
}
/////////////////////////////////////////////////////////////////////////
// avg_row_length.
/////////////////////////////////////////////////////////////////////////
ulonglong avg_row_length() const override { return m_avg_row_length; }
void set_avg_row_length(ulonglong avg_row_length) override {
m_avg_row_length = avg_row_length;
}
/////////////////////////////////////////////////////////////////////////
// data_length.
/////////////////////////////////////////////////////////////////////////
ulonglong data_length() const override { return m_data_length; }
void set_data_length(ulonglong data_length) override {
m_data_length = data_length;
}
/////////////////////////////////////////////////////////////////////////
// max_data_length.
/////////////////////////////////////////////////////////////////////////
ulonglong max_data_length() const override { return m_max_data_length; }
void set_max_data_length(ulonglong max_data_length) override {
m_max_data_length = max_data_length;
}
/////////////////////////////////////////////////////////////////////////
// index_length.
/////////////////////////////////////////////////////////////////////////
ulonglong index_length() const override { return m_index_length; }
void set_index_length(ulonglong index_length) override {
m_index_length = index_length;
}
/////////////////////////////////////////////////////////////////////////
// data_free.
/////////////////////////////////////////////////////////////////////////
ulonglong data_free() const override { return m_data_free; }
void set_data_free(ulonglong data_free) override { m_data_free = data_free; }
/////////////////////////////////////////////////////////////////////////
// auto_increment.
/////////////////////////////////////////////////////////////////////////
ulonglong auto_increment() const override { return m_auto_increment; }
void set_auto_increment(ulonglong auto_increment) override {
m_auto_increment = auto_increment;
}
/////////////////////////////////////////////////////////////////////////
// checksum.
/////////////////////////////////////////////////////////////////////////
ulonglong checksum() const override { return m_checksum; }
void set_checksum(ulonglong checksum) override { m_checksum = checksum; }
/////////////////////////////////////////////////////////////////////////
// update_time.
/////////////////////////////////////////////////////////////////////////
ulonglong update_time() const override { return m_update_time; }
void set_update_time(ulonglong update_time) override {
m_update_time = update_time;
}
/////////////////////////////////////////////////////////////////////////
// check_time.
/////////////////////////////////////////////////////////////////////////
ulonglong check_time() const override { return m_check_time; }
void set_check_time(ulonglong check_time) override {
m_check_time = check_time;
}
/////////////////////////////////////////////////////////////////////////
// cached_time.
/////////////////////////////////////////////////////////////////////////
ulonglong cached_time() const override { return m_cached_time; }
void set_cached_time(ulonglong cached_time) override {
m_cached_time = cached_time;
}
public:
Object_key *create_primary_key() const override;
bool has_new_primary_key() const override;
// Fix "inherits ... via dominance" warnings
Entity_object_impl *impl() override { return Entity_object_impl::impl(); }
const Entity_object_impl *impl() const override {
return Entity_object_impl::impl();
}
Object_id id() const override { return Entity_object_impl::id(); }
bool is_persistent() const override {
return Entity_object_impl::is_persistent();
}
const String_type &name() const override {
return Entity_object_impl::name();
}
void set_name(const String_type &name) override {
Entity_object_impl::set_name(name);
}
private:
// Fields
String_type m_schema_name;
String_type m_table_name;
ulonglong m_table_rows;
ulonglong m_avg_row_length;
ulonglong m_data_length;
ulonglong m_max_data_length;
ulonglong m_index_length;
ulonglong m_data_free;
ulonglong m_auto_increment;
ulonglong m_checksum;
ulonglong m_update_time;
ulonglong m_check_time;
ulonglong m_cached_time;
};
///////////////////////////////////////////////////////////////////////////
} // namespace dd
#endif // DD__TABLE_STAT_IMPL_INCLUDED