~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/message/table.proto

Monty fixes pluss a few from me for charset.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
  Message format for tables.
3
 
*/
4
1
package drizzled.message;
5
2
option optimize_for = SPEED;
6
3
 
7
 
option java_package = "org.drizzle.messages";
8
 
option java_outer_classname = "TableMessage";
9
 
 
10
 
import "engine.proto";
11
 
 
12
4
message Table {
13
5
 
14
6
  enum TableType {
15
7
    STANDARD = 0;
16
8
    TEMPORARY = 1;
17
 
    INTERNAL = 2;
18
 
    FUNCTION = 3;
 
9
  }
 
10
 
 
11
  message StorageEngine {
 
12
 
 
13
    message EngineOption {
 
14
      enum EngineOptionType {
 
15
        BOOL = 0;
 
16
        INTEGER = 1;
 
17
        STRING = 2;
 
18
      }
 
19
 
 
20
      required string option_name = 1;
 
21
      required string option_value = 2;
 
22
      required EngineOptionType option_type = 3;
 
23
    }
 
24
 
 
25
    required string name = 1;
 
26
    repeated EngineOption option = 2;
19
27
  }
20
28
 
21
29
  message TableOptions {
22
 
    optional bool has_user_set_auto_increment_value = 1;
 
30
    optional uint64 auto_increment = 1;
23
31
    optional string collation = 2;
24
32
    optional uint32 collation_id = 3;
 
33
    optional string connect_string = 4;
25
34
    optional string data_file_name = 5;
26
35
    optional string index_file_name = 6;
27
36
    optional uint64 max_rows = 7;
28
37
    optional uint64 min_rows = 8;
29
38
    optional uint64 auto_increment_value = 9;
30
39
    optional uint32 avg_row_length = 11;
 
40
    optional uint32 key_block_size = 12;
31
41
    optional uint32 block_size = 13;
32
42
    optional string comment = 14;
 
43
    optional bool pack_keys = 15;
33
44
    optional bool pack_record = 16;
34
45
    optional bool checksum = 17;
35
46
    optional bool page_checksum = 18;
36
47
    optional bool delay_key_write = 19;
 
48
 
 
49
    enum RowType {
 
50
         ROW_TYPE_DEFAULT = 0;
 
51
         ROW_TYPE_FIXED = 1;
 
52
         ROW_TYPE_DYNAMIC = 2;
 
53
         ROW_TYPE_COMPRESSED = 3;
 
54
         ROW_TYPE_REDUNDANT = 4;
 
55
         ROW_TYPE_COMPACT = 5;
 
56
         ROW_TYPE_PAGE = 6;
 
57
    }
 
58
 
 
59
    optional RowType row_type = 20;
 
60
  }
 
61
 
 
62
  message TableStats {
 
63
    optional uint32 avg_row_length = 1;
 
64
    optional uint64 max_rows = 2;
 
65
    optional uint32 min_rows = 3;
37
66
  }
38
67
 
39
68
  message ForeignKeyConstraint {
40
 
    optional string name = 1;
41
 
    repeated string column_names = 2;
42
 
    required string references_table_name = 3;
43
 
    repeated string references_columns = 4;
44
 
 
45
 
    enum ForeignKeyMatchOption {
46
 
      MATCH_UNDEFINED = 0;
47
 
      MATCH_FULL = 1;
48
 
      MATCH_PARTIAL = 2;
49
 
      MATCH_SIMPLE = 3;
50
 
    }
51
 
    required ForeignKeyMatchOption match = 5;
52
 
 
53
 
    enum ForeignKeyOption {
54
 
      OPTION_UNDEF = 0;
55
 
      OPTION_RESTRICT = 1;
56
 
      OPTION_CASCADE = 2;
57
 
      OPTION_SET_NULL = 3;
58
 
      OPTION_NO_ACTION = 4;
59
 
      OPTION_SET_DEFAULT = 5;
60
 
    }
61
 
 
62
 
    required ForeignKeyOption update_option = 6 [ default = OPTION_UNDEF ];
63
 
    required ForeignKeyOption delete_option = 7 [ default = OPTION_UNDEF ];
 
69
    required string name = 1;
 
70
    required Field dependent = 2;
 
71
    required Field parent = 3;
 
72
    /** @TODO Finish this off... */
64
73
  }
65
74
 
66
75
  message Field {
74
83
      BIGINT = 5;
75
84
      DECIMAL = 6;
76
85
      DATE = 7;
 
86
      TIME = 8;
77
87
      TIMESTAMP = 9;
78
88
      DATETIME = 10;
79
 
      UUID = 11;
 
89
      TINYINT = 11;
 
90
      VIRTUAL = 12;
 
91
    }
 
92
 
 
93
    enum FieldFormatType {
 
94
      DefaultFormat= 0;
 
95
      FixedFormat= 1;
 
96
      DynamicFormat= 2;
80
97
    }
81
98
 
82
99
    message FieldOptions {
84
101
      optional string update_value = 2;
85
102
      optional bool default_null = 3 [default = false];
86
103
      optional bytes default_bin_value = 4;
87
 
      optional string default_expression = 5;
88
 
      optional string update_expression = 6;
 
104
 
 
105
      optional int32 length = 100; /* TODO: should go away */
 
106
    }
 
107
 
 
108
    message TimestampFieldOptions {
 
109
      optional bool auto_updates = 1 [default = false];
89
110
    }
90
111
 
91
112
    message FieldConstraints {
92
 
      required bool is_nullable = 1 [default = true];
 
113
      required bool is_nullable = 1 [default = false];
93
114
      optional bool is_unsigned = 2 [default = false];
94
115
      repeated string expression = 16; /* Reserve 0-15 for frequenty accessed attributes */
95
116
    }
96
117
 
97
118
    message NumericFieldOptions {
98
119
      optional bool is_autoincrement = 1 [default = false];
99
 
      optional uint32 scale = 2;
100
 
      optional uint32 precision = 3;
 
120
      optional int32 length = 2;
 
121
      optional int32 scale = 3;
 
122
      optional int32 precision = 4;
101
123
    }
102
124
 
103
125
    message StringFieldOptions {
104
126
      optional bool is_fixed_width = 1 [default = false];
105
 
      optional uint32 length = 2;
 
127
      optional int32 length = 2;
106
128
      optional uint32 collation_id = 3;
107
129
      optional string collation = 4;
108
130
    }
109
131
 
110
 
    message EnumerationValues {
 
132
    message SetFieldOptions {
 
133
      required int32 count_elements = 1;
111
134
      optional uint32 collation_id = 2;
112
135
      optional string collation = 3;
113
 
      repeated string field_value = 4;
 
136
      repeated bytes field_value = 4;
 
137
    }
 
138
 
 
139
    message VirtualFieldOptions {
 
140
      required FieldType type = 1;
 
141
      required bool physically_stored = 2;
 
142
      /* optional as we could optimise some cases in future */
 
143
      optional string expression = 3;
114
144
    }
115
145
 
116
146
    required string name = 1;
117
147
    required FieldType type = 2;
 
148
    optional FieldFormatType format = 3;
118
149
    optional FieldOptions options = 4;
119
150
    optional FieldConstraints constraints = 5;
120
151
    optional NumericFieldOptions numeric_options = 6;
121
152
    optional StringFieldOptions string_options = 7;
 
153
    optional VirtualFieldOptions virtual_options = 8;
122
154
 
123
155
    optional string comment = 16; /* Reserve 0-15 for frequently accessed attributes */
124
 
    optional EnumerationValues enumeration_values = 17;
 
156
    optional SetFieldOptions set_options = 17;
 
157
    optional TimestampFieldOptions timestamp_options = 18;
 
158
 
 
159
    optional uint32 pack_flag = 100; /* MUST DIE */
125
160
  }
126
161
 
127
162
  message Index {
128
163
 
129
164
    enum IndexType {
130
 
    /* Kept in sync with enum ha_key_alg if only for stewart sanity. */
 
165
    /* Kept in sync with enum ha_key_alg if only for stewart's sanity. */
131
166
      UNKNOWN_INDEX = 0;
132
167
      BTREE = 1;
133
168
      RTREE = 2;
137
172
 
138
173
    message IndexPart {
139
174
      required uint32 fieldnr = 1;
140
 
      optional uint32 compare_length = 2;
 
175
      optional int32 compare_length = 2;
141
176
      optional bool in_reverse_order = 3 [default = false];
 
177
 
 
178
      optional uint32 key_type = 101; /* THIS MUST DIE. Along with pack_flag*/
142
179
    }
143
180
 
144
 
    message Options {
 
181
    message IndexOptions {
145
182
      optional bool pack_key = 1;
146
183
      optional bool binary_pack_key = 2;
147
184
      optional bool var_length_key = 3;
157
194
    required IndexType type = 4 [default = UNKNOWN_INDEX];
158
195
    required uint32 key_length = 5;
159
196
    repeated IndexPart index_part = 6;
160
 
    optional Options options= 7;
 
197
    optional IndexOptions options= 7;
161
198
    optional string comment = 8;
162
199
  }
163
200
 
164
201
  required string name = 1;
165
 
  required string schema = 6;
166
202
  required TableType type = 5;
167
 
  required Engine engine = 2;
 
203
  required StorageEngine engine = 2;
168
204
  repeated Field field = 3;
169
205
  repeated Index indexes = 4;
170
206
 
171
207
  repeated ForeignKeyConstraint fk_constraint = 8;
172
208
  optional TableOptions options = 9;
173
 
  required uint64 creation_timestamp= 11 [default = 0];
174
 
  required uint64 update_timestamp= 12 [default = 0];
175
 
  optional string catalog = 13;
176
 
  optional string uuid = 14;
177
 
  /*
178
 
    A version value of 0, means that it was never set.
179
 
    */
180
 
  optional uint64 version = 15;
181
 
}
182
 
 
183
 
message AlterTable {
184
 
  repeated Table.Field added_field = 1;
 
209
  optional TableStats stats = 10;
185
210
}