~drizzle-trunk/drizzle/development

323 by Brian Aker
Updated proto file for table (not FRM work).
1
package drizzle;
2
3
message Table {
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
4
5
  enum TableType {
6
    STANDARD = 0;
7
    TEMPORARY = 1;
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;
26
  }
27
28
  message TableOptions {
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;
38
  }
39
40
  message ForeignKeyConstraint {
41
    required string name = 1;
42
    required Field dependent = 2;
43
    required Field parent = 3;
44
    /** @TODO Finish this off... */
45
  }
46
323 by Brian Aker
Updated proto file for table (not FRM work).
47
  message Field {
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
48
49
    enum FieldType {
50
      DOUBLE = 0;
51
      VARCHAR = 1;
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;
66
    }
352.1.2 by Jay Pipes
Working reader and writer for table.proto definitions now
67
68
    message FieldOptions {
69
      optional string default_value = 2;
70
    }
71
72
    message TimestampFieldOptions {
73
      optional bool auto_updates = 1 [default = false];
74
    }
75
76
    message FieldConstraints {
77
      required bool is_nullable = 1 [default = false];
78
      optional bool is_unsigned = 2 [default = false];
79
      repeated string expression = 16; /* Reserve 0-15 for frequenty accessed attributes */
80
    }
81
82
    message NumericFieldOptions {
83
      optional bool is_autoincrement = 1 [default = false];
84
      optional int32 length = 2;
85
      optional int32 scale = 3;
86
      optional int32 precision = 4;
87
    }
88
89
    message StringFieldOptions {
90
      optional bool is_fixed_width = 1 [default = false];
91
      optional int32 length = 2;
92
      optional string charset = 3; /* Perhaps this can go away soon...*/
93
      optional string collation = 4;
94
    }
95
96
    message SetFieldOptions {
97
      required int32 count_elements = 1;
98
      repeated string value = 2;
99
    }
100
323 by Brian Aker
Updated proto file for table (not FRM work).
101
    required string name = 1;
102
    required FieldType type = 2;
352.1.2 by Jay Pipes
Working reader and writer for table.proto definitions now
103
    optional FieldOptions options = 3;
104
    optional FieldConstraints constraints = 4;
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
105
    optional NumericFieldOptions numeric_options = 5;
106
    optional StringFieldOptions string_options = 6;
107
    optional string comment = 16; /* Reserve 0-15 for frequently accessed attributes */
108
    optional SetFieldOptions set_options = 17;
109
    optional TimestampFieldOptions timestamp_options = 18;
110
  }
111
323 by Brian Aker
Updated proto file for table (not FRM work).
112
  message Index {
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
113
114
    enum IndexType {
352.1.2 by Jay Pipes
Working reader and writer for table.proto definitions now
115
      UNKNOWN = 0;
116
      HASH = 1;
117
      BTREE = 2;
118
      RTREE = 3;
119
      FULLTEXT = 4;
120
    }
121
122
    message IndexPart {
123
      required Field field = 1;
124
      optional int32 compare_length = 2;
125
      optional bool in_reverse_order = 3 [default = false];
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
126
    }
127
323 by Brian Aker
Updated proto file for table (not FRM work).
128
    required string name = 1;
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
129
    required bool is_primary = 2;
130
    required bool is_unique = 3;
352.1.2 by Jay Pipes
Working reader and writer for table.proto definitions now
131
    required IndexType type = 4 [default = UNKNOWN];
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
132
    repeated IndexPart index_part = 5;
323 by Brian Aker
Updated proto file for table (not FRM work).
133
  }
134
352.1.1 by Jay Pipes
New table definition and updated reader and writer test programs
135
  required string name = 1;
136
  required TableType type = 5;
137
  required StorageEngine engine = 2;
138
  repeated Field field = 3;
139
  repeated Index index = 4;
140
141
  repeated ForeignKeyConstraint fk_constraint = 8;
142
  optional TableOptions options = 9;
143
  optional TableStats stats = 10;
144
145
  optional string comment = 16;
323 by Brian Aker
Updated proto file for table (not FRM work).
146
}
147
148
message TableList {
149
  repeated Table table = 1;
150
}