~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/message/table.proto

  • Committer: Stewart Smith
  • Date: 2009-10-19 03:27:43 UTC
  • mto: This revision was merged to the branch mainline in revision 1188.
  • Revision ID: stewart@flamingspork.com-20091019032743-xajbflq0ktpe9vw2
remove --disable-warnings in func_in_null_scan.test

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;
25
33
    optional string data_file_name = 5;
28
36
    optional uint64 min_rows = 8;
29
37
    optional uint64 auto_increment_value = 9;
30
38
    optional uint32 avg_row_length = 11;
 
39
    optional uint32 key_block_size = 12;
31
40
    optional uint32 block_size = 13;
32
41
    optional string comment = 14;
 
42
    optional bool pack_keys = 15;
33
43
    optional bool pack_record = 16;
34
44
    optional bool checksum = 17;
35
45
    optional bool page_checksum = 18;
36
46
    optional bool delay_key_write = 19;
 
47
 
 
48
    enum RowType {
 
49
         ROW_TYPE_DEFAULT = 0;
 
50
         ROW_TYPE_FIXED = 1;
 
51
         ROW_TYPE_DYNAMIC = 2;
 
52
         ROW_TYPE_COMPRESSED = 3;
 
53
         ROW_TYPE_REDUNDANT = 4;
 
54
         ROW_TYPE_COMPACT = 5;
 
55
         ROW_TYPE_PAGE = 6;
 
56
    }
 
57
 
 
58
    optional RowType row_type = 20;
 
59
  }
 
60
 
 
61
  message TableStats {
 
62
    optional uint32 avg_row_length = 1;
 
63
    optional uint64 max_rows = 2;
 
64
    optional uint32 min_rows = 3;
37
65
  }
38
66
 
39
67
  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 ];
 
68
    required string name = 1;
 
69
    required Field dependent = 2;
 
70
    required Field parent = 3;
 
71
    /** @TODO Finish this off... */
64
72
  }
65
73
 
66
74
  message Field {
74
82
      BIGINT = 5;
75
83
      DECIMAL = 6;
76
84
      DATE = 7;
77
 
      EPOCH = 9;
 
85
      TIME = 8;
 
86
      TIMESTAMP = 9;
78
87
      DATETIME = 10;
79
 
      UUID = 11;
80
 
      TIME = 12;
81
 
      BOOLEAN = 13;
 
88
    }
 
89
 
 
90
    enum FieldFormatType {
 
91
      DefaultFormat= 0;
 
92
      FixedFormat= 1;
 
93
      DynamicFormat= 2;
82
94
    }
83
95
 
84
96
    message FieldOptions {
86
98
      optional string update_value = 2;
87
99
      optional bool default_null = 3 [default = false];
88
100
      optional bytes default_bin_value = 4;
89
 
      optional string default_expression = 5;
90
 
      optional string update_expression = 6;
 
101
 
 
102
      optional int32 length = 100; /* TODO: should go away */
 
103
    }
 
104
 
 
105
    message TimestampFieldOptions {
 
106
      optional bool auto_updates = 1 [default = false];
91
107
    }
92
108
 
93
109
    message FieldConstraints {
94
 
      optional bool is_nullable = 1 [default = true]; // Dead option, do not use
 
110
      required bool is_nullable = 1 [default = false];
95
111
      optional bool is_unsigned = 2 [default = false];
96
 
      optional bool is_notnull = 3 [default = false];
97
 
      optional bool is_unique = 4 [default = false];
98
112
      repeated string expression = 16; /* Reserve 0-15 for frequenty accessed attributes */
99
113
    }
100
114
 
101
115
    message NumericFieldOptions {
102
116
      optional bool is_autoincrement = 1 [default = false];
103
 
      optional uint32 scale = 2;
104
 
      optional uint32 precision = 3;
 
117
      optional int32 length = 2;
 
118
      optional int32 scale = 3;
 
119
      optional int32 precision = 4;
105
120
    }
106
121
 
107
122
    message StringFieldOptions {
108
123
      optional bool is_fixed_width = 1 [default = false];
109
 
      optional uint32 length = 2;
 
124
      optional int32 length = 2;
110
125
      optional uint32 collation_id = 3;
111
126
      optional string collation = 4;
112
127
    }
113
128
 
114
 
    message EnumerationValues {
 
129
    message SetFieldOptions {
 
130
      required int32 count_elements = 1;
115
131
      optional uint32 collation_id = 2;
116
132
      optional string collation = 3;
117
 
      repeated string field_value = 4;
118
 
    }
119
 
 
120
 
    /*
121
 
      Do we store microseconds or timezone.
122
 
    */
123
 
    message TimeFieldOptions {
124
 
      optional bool microseconds = 1;
 
133
      repeated bytes field_value = 4;
125
134
    }
126
135
 
127
136
    required string name = 1;
128
137
    required FieldType type = 2;
 
138
    optional FieldFormatType format = 3;
129
139
    optional FieldOptions options = 4;
130
140
    optional FieldConstraints constraints = 5;
131
141
    optional NumericFieldOptions numeric_options = 6;
132
142
    optional StringFieldOptions string_options = 7;
133
 
    optional TimeFieldOptions time_options = 8;
134
143
 
135
144
    optional string comment = 16; /* Reserve 0-15 for frequently accessed attributes */
136
 
    optional EnumerationValues enumeration_values = 17;
 
145
    optional SetFieldOptions set_options = 17;
 
146
    optional TimestampFieldOptions timestamp_options = 18;
137
147
  }
138
148
 
139
149
  message Index {
140
150
 
141
151
    enum IndexType {
142
 
    /* Kept in sync with enum ha_key_alg if only for stewart sanity. */
 
152
    /* Kept in sync with enum ha_key_alg if only for stewart's sanity. */
143
153
      UNKNOWN_INDEX = 0;
144
154
      BTREE = 1;
145
155
      RTREE = 2;
149
159
 
150
160
    message IndexPart {
151
161
      required uint32 fieldnr = 1;
152
 
      optional uint32 compare_length = 2;
 
162
      optional int32 compare_length = 2;
153
163
      optional bool in_reverse_order = 3 [default = false];
 
164
 
 
165
      optional uint32 key_type = 101; /* THIS MUST DIE. Along with pack_flag*/
154
166
    }
155
167
 
156
 
    message Options {
 
168
    message IndexOptions {
157
169
      optional bool pack_key = 1;
158
170
      optional bool binary_pack_key = 2;
159
171
      optional bool var_length_key = 3;
169
181
    required IndexType type = 4 [default = UNKNOWN_INDEX];
170
182
    required uint32 key_length = 5;
171
183
    repeated IndexPart index_part = 6;
172
 
    optional Options options= 7;
 
184
    optional IndexOptions options= 7;
173
185
    optional string comment = 8;
174
186
  }
175
187
 
176
188
  required string name = 1;
177
 
  required string schema = 6;
178
189
  required TableType type = 5;
179
 
  required Engine engine = 2;
 
190
  required StorageEngine engine = 2;
180
191
  repeated Field field = 3;
181
192
  repeated Index indexes = 4;
182
193
 
183
194
  repeated ForeignKeyConstraint fk_constraint = 8;
184
195
  optional TableOptions options = 9;
185
 
  required uint64 creation_timestamp= 11 [default = 0];
186
 
  required uint64 update_timestamp= 12 [default = 0];
187
 
  optional string catalog = 13;
188
 
  optional string uuid = 14;
189
 
  /*
190
 
    A version value of 0, means that it was never set.
191
 
    */
192
 
  optional uint64 version = 15;
193
 
}
194
 
 
195
 
message AlterTable {
196
 
  repeated Table.Field added_field = 1;
 
196
  optional TableStats stats = 10;
197
197
}