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
|
package drizzle;
message Table {
enum TableType {
STANDARD = 0;
TEMPORARY = 1;
}
message StorageEngine {
message EngineOption {
enum EngineOptionType {
BOOL = 0;
INTEGER = 1;
STRING = 2;
}
required string name = 1;
required string value = 2;
required EngineOptionType 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 table_options = 10;
optional uint32 avg_row_length = 11;
optional uint32 used_fields = 12;
optional uint32 key_block_size = 13;
optional uint32 block_size = 14;
optional string comment = 15;
}
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;
TEXT = 2;
BLOB = 3;
ENUM = 4;
INTEGER = 5;
BIGINT = 6;
DECIMAL = 7;
DATE = 8;
TIME = 9;
TIMESTAMP = 10;
DATETIME = 11;
TINYINT = 12;
}
message FieldOptions {
optional string default_value = 1;
}
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;
repeated string value = 2;
}
required string name = 1;
required FieldType type = 2;
optional FieldOptions options = 3;
optional FieldConstraints constraints = 4;
optional NumericFieldOptions numeric_options = 5;
optional StringFieldOptions string_options = 6;
optional string comment = 16; /* Reserve 0-15 for frequently accessed attributes */
optional SetFieldOptions set_options = 17;
optional TimestampFieldOptions timestamp_options = 18;
}
message Index {
enum IndexType {
UNKNOWN_INDEX = 0;
HASH = 1;
BTREE = 2;
}
message IndexPart {
required Field field = 1;
optional int32 compare_length = 2;
optional bool in_reverse_order = 3 [default = false];
}
required string name = 1;
required bool is_primary = 2;
required bool is_unique = 3;
required IndexType type = 4 [default = UNKNOWN_INDEX];
repeated IndexPart index_part = 5;
optional string comment = 6;
}
required string name = 1;
required TableType type = 5;
required StorageEngine engine = 2;
repeated Field field = 3;
repeated Index index = 4;
repeated ForeignKeyConstraint fk_constraint = 8;
optional TableOptions options = 9;
optional TableStats stats = 10;
}
message TableList {
repeated Table table = 1;
}
|