~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/serialize/table.proto

  • Committer: Lee
  • Date: 2008-10-30 22:02:01 UTC
  • mto: (572.1.2 devel)
  • mto: This revision was merged to the branch mainline in revision 573.
  • Revision ID: lbieber@lbieber-desktop-20081030220201-elb6qprbzpn7c5a4
add my name to the AUTHORS file

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
  Message format for tables.
3
 
*/
4
 
package drizzled.message;
5
 
option optimize_for = SPEED;
6
 
 
7
 
option java_package = "org.drizzle.messages";
8
 
option java_outer_classname = "TableMessage";
9
 
 
10
 
import "engine.proto";
 
1
package drizzle;
11
2
 
12
3
message Table {
13
4
 
14
5
  enum TableType {
15
6
    STANDARD = 0;
16
7
    TEMPORARY = 1;
17
 
    INTERNAL = 2;
18
 
    FUNCTION = 3;
 
8
  }
 
9
 
 
10
  message StorageEngine {
 
11
 
 
12
    message EngineOption {
 
13
      enum EngineOptionType {
 
14
        BOOL = 0;
 
15
        INTEGER = 1;
 
16
        STRING = 2;
 
17
      }
 
18
 
 
19
      required string name = 1;
 
20
      required string value = 2;
 
21
      required EngineOptionType type = 3;
 
22
    }
 
23
 
 
24
    required string name = 1;
 
25
    repeated EngineOption option = 2;
19
26
  }
20
27
 
21
28
  message TableOptions {
22
 
    optional bool has_user_set_auto_increment_value = 1;
23
 
    optional string collation = 2;
24
 
    optional uint32 collation_id = 3;
25
 
    optional string data_file_name = 5;
26
 
    optional string index_file_name = 6;
27
 
    optional uint64 max_rows = 7;
28
 
    optional uint64 min_rows = 8;
29
 
    optional uint64 auto_increment_value = 9;
30
 
    optional uint32 avg_row_length = 11;
31
 
    optional uint32 block_size = 13;
32
 
    optional string comment = 14;
33
 
    optional bool pack_record = 16;
34
 
    optional bool checksum = 17;
35
 
    optional bool page_checksum = 18;
36
 
    optional bool delay_key_write = 19;
 
29
    optional uint64 auto_increment = 1;
 
30
    optional string charset = 2;
 
31
    optional string collation = 3;
 
32
  }
 
33
 
 
34
  message TableStats {
 
35
    optional uint32 avg_row_length = 1;
 
36
    optional uint64 max_rows = 2;
 
37
    optional uint32 min_rows = 3;
37
38
  }
38
39
 
39
40
  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 ];
 
41
    required string name = 1;
 
42
    required Field dependent = 2;
 
43
    required Field parent = 3;
 
44
    /** @TODO Finish this off... */
64
45
  }
65
46
 
66
47
  message Field {
68
49
    enum FieldType {
69
50
      DOUBLE = 0;
70
51
      VARCHAR = 1;
71
 
      BLOB = 2;
72
 
      ENUM = 3;
73
 
      INTEGER = 4;
74
 
      BIGINT = 5;
75
 
      DECIMAL = 6;
76
 
      DATE = 7;
77
 
      EPOCH = 9;
78
 
      DATETIME = 10;
79
 
      UUID = 11;
80
 
      TIME = 12;
81
 
      BOOLEAN = 13;
 
52
      TEXT = 2;
 
53
      BLOB = 3;
 
54
      ENUM = 4;
 
55
      SET = 5;
 
56
      TINYINT = 6;
 
57
      SMALLINT = 7;
 
58
      INTEGER = 8;
 
59
      BIGINT = 9;
 
60
      DECIMAL = 10;
 
61
      VARBINARY = 11;
 
62
      DATE = 12;
 
63
      TIME = 13;
 
64
      TIMESTAMP = 14;
 
65
      DATETIME = 15;
82
66
    }
83
67
 
84
68
    message FieldOptions {
85
 
      optional string default_value = 1;
86
 
      optional string update_value = 2;
87
 
      optional bool default_null = 3 [default = false];
88
 
      optional bytes default_bin_value = 4;
89
 
      optional string default_expression = 5;
90
 
      optional string update_expression = 6;
 
69
      optional string default_value = 2;
 
70
    }
 
71
 
 
72
    message TimestampFieldOptions {
 
73
      optional bool auto_updates = 1 [default = false];
91
74
    }
92
75
 
93
76
    message FieldConstraints {
94
 
      optional bool is_nullable = 1 [default = true]; // Dead option, do not use
 
77
      required bool is_nullable = 1 [default = false];
95
78
      optional bool is_unsigned = 2 [default = false];
96
 
      optional bool is_notnull = 3 [default = false];
97
 
      optional bool is_unique = 4 [default = false];
98
79
      repeated string expression = 16; /* Reserve 0-15 for frequenty accessed attributes */
99
80
    }
100
81
 
101
82
    message NumericFieldOptions {
102
83
      optional bool is_autoincrement = 1 [default = false];
103
 
      optional uint32 scale = 2;
104
 
      optional uint32 precision = 3;
 
84
      optional int32 length = 2;
 
85
      optional int32 scale = 3;
 
86
      optional int32 precision = 4;
105
87
    }
106
88
 
107
89
    message StringFieldOptions {
108
90
      optional bool is_fixed_width = 1 [default = false];
109
 
      optional uint32 length = 2;
110
 
      optional uint32 collation_id = 3;
 
91
      optional int32 length = 2;
 
92
      optional string charset = 3; /* Perhaps this can go away soon...*/
111
93
      optional string collation = 4;
112
94
    }
113
95
 
114
 
    message EnumerationValues {
115
 
      optional uint32 collation_id = 2;
116
 
      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;
 
96
    message SetFieldOptions {
 
97
      required int32 count_elements = 1;
 
98
      repeated string value = 2;
125
99
    }
126
100
 
127
101
    required string name = 1;
128
102
    required FieldType type = 2;
129
 
    optional FieldOptions options = 4;
130
 
    optional FieldConstraints constraints = 5;
131
 
    optional NumericFieldOptions numeric_options = 6;
132
 
    optional StringFieldOptions string_options = 7;
133
 
    optional TimeFieldOptions time_options = 8;
134
 
 
 
103
    optional FieldOptions options = 3;
 
104
    optional FieldConstraints constraints = 4;
 
105
    optional NumericFieldOptions numeric_options = 5;
 
106
    optional StringFieldOptions string_options = 6;
135
107
    optional string comment = 16; /* Reserve 0-15 for frequently accessed attributes */
136
 
    optional EnumerationValues enumeration_values = 17;
 
108
    optional SetFieldOptions set_options = 17;
 
109
    optional TimestampFieldOptions timestamp_options = 18;
137
110
  }
138
111
 
139
112
  message Index {
140
113
 
141
114
    enum IndexType {
142
 
    /* Kept in sync with enum ha_key_alg if only for stewart sanity. */
143
 
      UNKNOWN_INDEX = 0;
144
 
      BTREE = 1;
145
 
      RTREE = 2;
146
 
      HASH  = 3;
 
115
      UNKNOWN = 0;
 
116
      HASH = 1;
 
117
      BTREE = 2;
 
118
      RTREE = 3;
147
119
      FULLTEXT = 4;
148
120
    }
149
121
 
150
122
    message IndexPart {
151
 
      required uint32 fieldnr = 1;
152
 
      optional uint32 compare_length = 2;
 
123
      required Field field = 1;
 
124
      optional int32 compare_length = 2;
153
125
      optional bool in_reverse_order = 3 [default = false];
154
126
    }
155
127
 
156
 
    message Options {
157
 
      optional bool pack_key = 1;
158
 
      optional bool binary_pack_key = 2;
159
 
      optional bool var_length_key = 3;
160
 
      optional bool null_part_key = 4;
161
 
      optional uint32 key_block_size = 5;
162
 
      optional bool has_partial_segments =6;
163
 
      optional bool auto_generated_key = 7;
164
 
    }      
165
 
 
166
128
    required string name = 1;
167
129
    required bool is_primary = 2;
168
130
    required bool is_unique = 3;
169
 
    required IndexType type = 4 [default = UNKNOWN_INDEX];
170
 
    required uint32 key_length = 5;
171
 
    repeated IndexPart index_part = 6;
172
 
    optional Options options= 7;
173
 
    optional string comment = 8;
 
131
    required IndexType type = 4 [default = UNKNOWN];
 
132
    repeated IndexPart index_part = 5;
174
133
  }
175
134
 
176
135
  required string name = 1;
177
 
  required string schema = 6;
178
136
  required TableType type = 5;
179
 
  required Engine engine = 2;
 
137
  required StorageEngine engine = 2;
180
138
  repeated Field field = 3;
181
 
  repeated Index indexes = 4;
 
139
  repeated Index index = 4;
182
140
 
183
141
  repeated ForeignKeyConstraint fk_constraint = 8;
184
142
  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;
 
143
  optional TableStats stats = 10;
 
144
 
 
145
  optional string comment = 16;
193
146
}
194
147
 
195
 
message AlterTable {
196
 
  repeated Table.Field added_field = 1;
 
148
message TableList {
 
149
  repeated Table table = 1;
197
150
}