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
|
package drizzled.message;
option optimize_for = SPEED;
message Table {
enum TableType {
STANDARD = 0;
TEMPORARY = 1;
}
message StorageEngine {
message EngineOption {
enum EngineOptionType {
BOOL = 0;
INTEGER = 1;
STRING = 2;
}
required string option_name = 1;
required string option_value = 2;
required EngineOptionType option_type = 3;
}
required string name = 1;
repeated EngineOption option = 2;
}
message TableOptions {
optional uint64 auto_increment = 1;
optional string collation = 2;
optional uint32 collation_id = 3;
optional string connect_string = 4;
optional string data_file_name = 5;
optional string index_file_name = 6;
optional uint64 max_rows = 7;
optional uint64 min_rows = 8;
optional uint64 auto_increment_value = 9;
optional uint32 avg_row_length = 11;
optional uint32 key_block_size = 12;
optional uint32 block_size = 13;
optional string comment = 14;
optional bool pack_keys = 15;
optional bool pack_record = 16;
optional bool checksum = 17;
optional bool page_checksum = 18;
optional bool delay_key_write = 19;
enum RowType {
ROW_TYPE_DEFAULT = 0;
ROW_TYPE_FIXED = 1;
ROW_TYPE_DYNAMIC = 2;
ROW_TYPE_COMPRESSED = 3;
ROW_TYPE_REDUNDANT = 4;
ROW_TYPE_COMPACT = 5;
ROW_TYPE_PAGE = 6;
}
optional RowType row_type = 20;
}
message TableStats {
optional uint32 avg_row_length = 1;
optional uint64 max_rows = 2;
optional uint32 min_rows = 3;
}
message ForeignKeyConstraint {
required string name = 1;
required Field dependent = 2;
required Field parent = 3;
/** @TODO Finish this off... */
}
message Field {
enum FieldType {
DOUBLE = 0;
VARCHAR = 1;
BLOB = 2;
ENUM = 3;
INTEGER = 4;
BIGINT = 5;
DECIMAL = 6;
DATE = 7;
TIME = 8;
TIMESTAMP = 9;
DATETIME = 10;
TINYINT = 11;
VIRTUAL = 12;
}
enum FieldFormatType {
DefaultFormat= 0;
FixedFormat= 1;
DynamicFormat= 2;
}
message FieldOptions {
optional string default_value = 1;
optional string update_value = 2;
optional bool default_null = 3 [default = false];
optional bytes default_bin_value = 4;
optional int32 length = 100; /* TODO: should go away */
}
message TimestampFieldOptions {
optional bool auto_updates = 1 [default = false];
}
message FieldConstraints {
required bool is_nullable = 1 [default = false];
optional bool is_unsigned = 2 [default = false];
repeated string expression = 16; /* Reserve 0-15 for frequenty accessed attributes */
}
message NumericFieldOptions {
optional bool is_autoincrement = 1 [default = false];
optional int32 length = 2;
optional int32 scale = 3;
optional int32 precision = 4;
}
message StringFieldOptions {
optional bool is_fixed_width = 1 [default = false];
optional int32 length = 2;
optional uint32 collation_id = 3;
optional string collation = 4;
}
message SetFieldOptions {
required int32 count_elements = 1;
optional uint32 collation_id = 2;
optional string collation = 3;
repeated bytes field_value = 4;
}
message VirtualFieldOptions {
required FieldType type = 1;
required bool physically_stored = 2;
/* optional as we could optimise some cases in future */
optional string expression = 3;
}
required string name = 1;
required FieldType type = 2;
optional FieldFormatType format = 3;
optional FieldOptions options = 4;
optional FieldConstraints constraints = 5;
optional NumericFieldOptions numeric_options = 6;
optional StringFieldOptions string_options = 7;
optional VirtualFieldOptions virtual_options = 8;
optional string comment = 16; /* Reserve 0-15 for frequently accessed attributes */
optional SetFieldOptions set_options = 17;
optional TimestampFieldOptions timestamp_options = 18;
optional uint32 pack_flag = 100; /* MUST DIE */
}
message Index {
enum IndexType {
/* Kept in sync with enum ha_key_alg if only for stewart's sanity. */
UNKNOWN_INDEX = 0;
BTREE = 1;
RTREE = 2;
HASH = 3;
FULLTEXT = 4;
}
message IndexPart {
required uint32 fieldnr = 1;
optional int32 compare_length = 2;
optional bool in_reverse_order = 3 [default = false];
optional uint32 key_type = 101; /* THIS MUST DIE. Along with pack_flag*/
}
message IndexOptions {
optional bool pack_key = 1;
optional bool binary_pack_key = 2;
optional bool var_length_key = 3;
optional bool null_part_key = 4;
optional uint32 key_block_size = 5;
optional bool has_partial_segments =6;
optional bool auto_generated_key = 7;
}
required string name = 1;
required bool is_primary = 2;
required bool is_unique = 3;
required IndexType type = 4 [default = UNKNOWN_INDEX];
required uint32 key_length = 5;
repeated IndexPart index_part = 6;
optional IndexOptions options= 7;
optional string comment = 8;
}
required string name = 1;
required TableType type = 5;
required StorageEngine engine = 2;
repeated Field field = 3;
repeated Index indexes = 4;
repeated ForeignKeyConstraint fk_constraint = 8;
optional TableOptions options = 9;
optional TableStats stats = 10;
}
message TableList {
repeated Table table = 1;
}
|