1/*
2 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License, version 2.0,
6 * as published by the Free Software Foundation.
7 *
8 * This program is also distributed with certain software (including
9 * but not limited to OpenSSL) that is licensed under separate terms,
10 * as designated in a particular file or component or in included license
11 * documentation.  The authors of MySQL hereby grant you an additional
12 * permission to link the program and your derivative works with the
13 * separately licensed software that they have included with MySQL.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License, version 2.0, for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
23 */
24
25// tell protobuf 3.0 to use protobuf 2.x rules
26syntax = "proto2";
27
28// ifdef PROTOBUF_LITE: option optimize_for = LITE_RUNTIME;
29
30package Mysqlx;
31option java_package = "com.mysql.cj.x.protobuf";
32
33import "google/protobuf/descriptor.proto"; // comment_out_if PROTOBUF_LITE
34
35// style-guide:
36//
37// see https://developers.google.com/protocol-buffers/docs/style
38//
39// message CamelCaseMsg {
40//   enum CamelCaseEnum {
41//     FIRST_VALUE = 1;
42//   }
43//   required CamelCaseEnum some_enum = 1;
44// }
45//
46
47
48// IDs of messages that can be sent from client to the server
49//
50// .. note::
51//   this message is never sent on the wire. It is only used to let ``protoc``
52//
53//   * generate constants
54//   * check for uniqueness
55message ClientMessages {
56  enum Type {
57    CON_CAPABILITIES_GET = 1;
58    CON_CAPABILITIES_SET = 2;
59    CON_CLOSE = 3;
60
61    SESS_AUTHENTICATE_START = 4;
62    SESS_AUTHENTICATE_CONTINUE  = 5;
63    SESS_RESET = 6;
64    SESS_CLOSE = 7;
65
66    SQL_STMT_EXECUTE = 12;
67
68    CRUD_FIND = 17;
69    CRUD_INSERT = 18;
70    CRUD_UPDATE = 19;
71    CRUD_DELETE = 20;
72
73    EXPECT_OPEN = 24;
74    EXPECT_CLOSE = 25;
75
76    CRUD_CREATE_VIEW = 30;
77    CRUD_MODIFY_VIEW = 31;
78    CRUD_DROP_VIEW = 32;
79
80    PREPARE_PREPARE = 40;
81    PREPARE_EXECUTE = 41;
82    PREPARE_DEALLOCATE = 42;
83
84    CURSOR_OPEN = 43;
85    CURSOR_CLOSE = 44;
86    CURSOR_FETCH = 45;
87
88    COMPRESSION = 46;
89  }
90}
91
92// IDs of messages that can be sent from server to client
93//
94// .. note::
95//   this message is never sent on the wire. It is only used to let ``protoc``
96//
97//   * generate constants
98//   * check for uniqueness
99message ServerMessages {
100  enum Type {
101    OK = 0;
102    ERROR = 1;
103
104    CONN_CAPABILITIES = 2;
105
106    SESS_AUTHENTICATE_CONTINUE = 3;
107    SESS_AUTHENTICATE_OK = 4;
108
109    // NOTICE has to stay at 11 forever
110    NOTICE = 11;
111
112    RESULTSET_COLUMN_META_DATA = 12;
113    RESULTSET_ROW = 13;
114    RESULTSET_FETCH_DONE = 14;
115    RESULTSET_FETCH_SUSPENDED = 15;
116    RESULTSET_FETCH_DONE_MORE_RESULTSETS = 16;
117
118    SQL_STMT_EXECUTE_OK = 17;
119    RESULTSET_FETCH_DONE_MORE_OUT_PARAMS = 18;
120
121    COMPRESSION = 19;
122  }
123}
124// ifndef PROTOBUF_LITE
125extend google.protobuf.MessageOptions {
126  optional ClientMessages.Type client_message_id = 100001;
127  optional ServerMessages.Type server_message_id = 100002;
128}
129// endif
130
131// generic Ok message
132message Ok {
133  optional string msg = 1;
134
135  option (server_message_id) = OK; // comment_out_if PROTOBUF_LITE
136}
137
138
139// generic Error message
140//
141// A ``severity`` of ``ERROR`` indicates the current message sequence is
142// aborted for the given error and the session is ready for more.
143//
144// In case of a ``FATAL`` error message the client should not expect
145// the server to continue handling any further messages and should
146// close the connection.
147//
148// :param severity: severity of the error message
149// :param code: error-code
150// :param sql_state: SQL state
151// :param msg: human readable error message
152message Error {
153  optional Severity severity = 1 [ default = ERROR ];
154  required uint32 code = 2;
155  required string sql_state = 4;
156  required string msg = 3;
157
158  enum Severity {
159    ERROR = 0;
160    FATAL = 1;
161  }
162
163  option (server_message_id) = ERROR; // comment_out_if PROTOBUF_LITE
164}
165