~drizzle-trunk/drizzle/development

323 by Brian Aker
Updated proto file for table (not FRM work).
1
package drizzle;
919.2.5 by Monty Taylor
Changed protos to be optmized for speed. INCOMPATIBLE CHANGE - .dfe files created prior to this will no longer work.
2
option optimize_for = SPEED;
323 by Brian Aker
Updated proto file for table (not FRM work).
3
4
message Table {
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
5
6
  enum TableType {
7
    STANDARD = 0;
8
    TEMPORARY = 1;
9
  }
10
11
  message StorageEngine {
12
13
    message EngineOption {
14
      enum EngineOptionType {
15
        BOOL = 0;
16
        INTEGER = 1;
17
        STRING = 2;
18
      }
19
820.1.8 by Stewart Smith
start reading table definition from proto instead of FRM.
20
      required string option_name = 1;
21
      required string option_value = 2;
22
      required EngineOptionType option_type = 3;
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
23
    }
24
25
    required string name = 1;
26
    repeated EngineOption option = 2;
27
  }
28
29
  message TableOptions {
30
    optional uint64 auto_increment = 1;
584.2.2 by Stewart Smith
Brian's table(_reader|_writer|.proto) fixes
31
    optional string collation = 2;
32
    optional uint32 collation_id = 3;
33
    optional string connect_string = 4;
34
    optional string data_file_name = 5;
35
    optional string index_file_name = 6;
36
    optional uint64 max_rows = 7;
37
    optional uint64 min_rows = 8;
38
    optional uint64 auto_increment_value = 9;
39
    optional uint32 avg_row_length = 11;
820.1.8 by Stewart Smith
start reading table definition from proto instead of FRM.
40
    optional uint32 key_block_size = 12;
41
    optional uint32 block_size = 13;
42
    optional string comment = 14;
43
    optional bool pack_keys = 15;
869.1.24 by Stewart Smith
Generate all the info needed to get a record size on proto read instead of FRM create time.
44
    optional bool pack_record = 16;
45
    optional bool checksum = 17;
46
    optional bool page_checksum = 18;
47
    optional bool delay_key_write = 19;
820.1.8 by Stewart Smith
start reading table definition from proto instead of FRM.
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
869.1.24 by Stewart Smith
Generate all the info needed to get a record size on proto read instead of FRM create time.
59
    optional RowType row_type = 20;
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
60
  }
61
62
  message TableStats {
63
    optional uint32 avg_row_length = 1;
64
    optional uint64 max_rows = 2;
65
    optional uint32 min_rows = 3;
66
  }
67
68
  message ForeignKeyConstraint {
69
    required string name = 1;
70
    required Field dependent = 2;
71
    required Field parent = 3;
72
    /** @TODO Finish this off... */
73
  }
74
323 by Brian Aker
Updated proto file for table (not FRM work).
75
  message Field {
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
76
77
    enum FieldType {
78
      DOUBLE = 0;
79
      VARCHAR = 1;
896.3.6 by Stewart Smith
Read Fields out of proto instead of FRM.
80
      BLOB = 2;
81
      ENUM = 3;
82
      INTEGER = 4;
83
      BIGINT = 5;
84
      DECIMAL = 6;
85
      DATE = 7;
86
      TIME = 8;
87
      TIMESTAMP = 9;
88
      DATETIME = 10;
89
      TINYINT = 11;
90
      VIRTUAL = 12;
869.1.10 by Stewart Smith
Add some missing things to field storage in proto
91
    }
92
93
    enum FieldFormatType {
94
      DefaultFormat= 0;
95
      FixedFormat= 1;
96
      DynamicFormat= 2;
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
97
    }
352.1.2 by Jay Pipes
Working reader and writer for table.proto definitions now
98
99
    message FieldOptions {
584.2.2 by Stewart Smith
Brian's table(_reader|_writer|.proto) fixes
100
      optional string default_value = 1;
869.1.10 by Stewart Smith
Add some missing things to field storage in proto
101
      optional string update_value = 2;
896.3.3 by Stewart Smith
Start generating a record buffer with default values in proto read path instead of FRM write path.
102
      optional bool default_null = 3 [default = false];
896.3.4 by Stewart Smith
Create default_values record from proto instead of reading from FRM. assert if different to FRM.
103
      optional bytes default_bin_value = 4;
104
896.3.3 by Stewart Smith
Start generating a record buffer with default values in proto read path instead of FRM write path.
105
      optional int32 length = 100; /* TODO: should go away */
352.1.2 by Jay Pipes
Working reader and writer for table.proto definitions now
106
    }
107
108
    message TimestampFieldOptions {
109
      optional bool auto_updates = 1 [default = false];
110
    }
111
112
    message FieldConstraints {
113
      required bool is_nullable = 1 [default = false];
114
      optional bool is_unsigned = 2 [default = false];
115
      repeated string expression = 16; /* Reserve 0-15 for frequenty accessed attributes */
116
    }
117
118
    message NumericFieldOptions {
119
      optional bool is_autoincrement = 1 [default = false];
120
      optional int32 length = 2;
121
      optional int32 scale = 3;
122
      optional int32 precision = 4;
123
    }
124
125
    message StringFieldOptions {
126
      optional bool is_fixed_width = 1 [default = false];
127
      optional int32 length = 2;
584.2.2 by Stewart Smith
Brian's table(_reader|_writer|.proto) fixes
128
      optional uint32 collation_id = 3;
352.1.2 by Jay Pipes
Working reader and writer for table.proto definitions now
129
      optional string collation = 4;
130
    }
131
132
    message SetFieldOptions {
133
      required int32 count_elements = 1;
896.3.6 by Stewart Smith
Read Fields out of proto instead of FRM.
134
      optional uint32 collation_id = 2;
135
      optional string collation = 3;
910.6.1 by Stewart Smith
enum values can be set of bytes, not just utf8 string. causing type_enum failure on debian/sparc
136
      repeated bytes field_value = 4;
352.1.2 by Jay Pipes
Working reader and writer for table.proto definitions now
137
    }
138
869.1.10 by Stewart Smith
Add some missing things to field storage in proto
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;
144
    }
145
323 by Brian Aker
Updated proto file for table (not FRM work).
146
    required string name = 1;
147
    required FieldType type = 2;
869.1.10 by Stewart Smith
Add some missing things to field storage in proto
148
    optional FieldFormatType format = 3;
149
    optional FieldOptions options = 4;
150
    optional FieldConstraints constraints = 5;
151
    optional NumericFieldOptions numeric_options = 6;
152
    optional StringFieldOptions string_options = 7;
153
    optional VirtualFieldOptions virtual_options = 8;
154
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
155
    optional string comment = 16; /* Reserve 0-15 for frequently accessed attributes */
156
    optional SetFieldOptions set_options = 17;
157
    optional TimestampFieldOptions timestamp_options = 18;
896.3.3 by Stewart Smith
Start generating a record buffer with default values in proto read path instead of FRM write path.
158
159
    optional uint32 pack_flag = 100; /* MUST DIE */
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
160
  }
161
323 by Brian Aker
Updated proto file for table (not FRM work).
162
  message Index {
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
163
164
    enum IndexType {
820.1.15 by Stewart Smith
Read (nearly the whole) index information (key and key parts) out of the proto, not FRM.
165
    /* Kept in sync with enum ha_key_alg if only for stewart's sanity. */
584.2.8 by Stewart Smith
(mostly) revert previous patch that tried to get rid of the UNKNOWN define in item_cmpfunc.h
166
      UNKNOWN_INDEX = 0;
820.1.15 by Stewart Smith
Read (nearly the whole) index information (key and key parts) out of the proto, not FRM.
167
      BTREE = 1;
168
      RTREE = 2;
169
      HASH  = 3;
170
      FULLTEXT = 4;
352.1.2 by Jay Pipes
Working reader and writer for table.proto definitions now
171
    }
172
173
    message IndexPart {
820.1.15 by Stewart Smith
Read (nearly the whole) index information (key and key parts) out of the proto, not FRM.
174
      required uint32 fieldnr = 1;
352.1.2 by Jay Pipes
Working reader and writer for table.proto definitions now
175
      optional int32 compare_length = 2;
176
      optional bool in_reverse_order = 3 [default = false];
896.3.13 by Stewart Smith
compute key_part->offset instead of storing in proto.
177
896.3.1 by Stewart Smith
removal final 2 values in indexes from being read from FRM.
178
      optional uint32 key_type = 101; /* THIS MUST DIE. Along with pack_flag*/
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
179
    }
180
820.1.15 by Stewart Smith
Read (nearly the whole) index information (key and key parts) out of the proto, not FRM.
181
    message IndexOptions {
182
      optional bool pack_key = 1;
183
      optional bool binary_pack_key = 2;
184
      optional bool var_length_key = 3;
185
      optional bool null_part_key = 4;
186
      optional uint32 key_block_size = 5;
187
      optional bool has_partial_segments =6;
188
      optional bool auto_generated_key = 7;
189
    }      
190
323 by Brian Aker
Updated proto file for table (not FRM work).
191
    required string name = 1;
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
192
    required bool is_primary = 2;
193
    required bool is_unique = 3;
584.2.8 by Stewart Smith
(mostly) revert previous patch that tried to get rid of the UNKNOWN define in item_cmpfunc.h
194
    required IndexType type = 4 [default = UNKNOWN_INDEX];
820.1.15 by Stewart Smith
Read (nearly the whole) index information (key and key parts) out of the proto, not FRM.
195
    required uint32 key_length = 5;
196
    repeated IndexPart index_part = 6;
197
    optional IndexOptions options= 7;
198
    optional string comment = 8;
323 by Brian Aker
Updated proto file for table (not FRM work).
199
  }
200
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
201
  required string name = 1;
202
  required TableType type = 5;
203
  required StorageEngine engine = 2;
204
  repeated Field field = 3;
820.1.8 by Stewart Smith
start reading table definition from proto instead of FRM.
205
  repeated Index indexes = 4;
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
206
207
  repeated ForeignKeyConstraint fk_constraint = 8;
208
  optional TableOptions options = 9;
209
  optional TableStats stats = 10;
323 by Brian Aker
Updated proto file for table (not FRM work).
210
}
211
212
message TableList {
213
  repeated Table table = 1;
214
}