forked from vitessio/vitess
/
constants.go
214 lines (165 loc) · 4.89 KB
/
constants.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
package replication
// This file contains the constant definitions for this package.
// This is the data type for a field.
// Values taken from include/mysql/mysql_com.h
// FIXME(alainjobart) this is the same info as constants describes in
// the go/mysql package. We will remove that package, and merge this
// package with go/mysqlconn as asoon as we can.
const (
// TypeDecimal is MYSQL_TYPE_DECIMAL. It is deprecated.
TypeDecimal = 0
// TypeTiny is MYSQL_TYPE_TINY
TypeTiny = 1
// TypeShort is MYSQL_TYPE_SHORT
TypeShort = 2
// TypeLong is MYSQL_TYPE_LONG
TypeLong = 3
// TypeFloat is MYSQL_TYPE_FLOAT
TypeFloat = 4
// TypeDouble is MYSQL_TYPE_DOUBLE
TypeDouble = 5
// TypeNull is MYSQL_TYPE_NULL
TypeNull = 6
// TypeTimestamp is MYSQL_TYPE_TIMESTAMP
TypeTimestamp = 7
// TypeLongLong is MYSQL_TYPE_LONGLONG
TypeLongLong = 8
// TypeInt24 is MYSQL_TYPE_INT24
TypeInt24 = 9
// TypeDate is MYSQL_TYPE_DATE
TypeDate = 10
// TypeTime is MYSQL_TYPE_TIME
TypeTime = 11
// TypeDateTime is MYSQL_TYPE_DATETIME
TypeDateTime = 12
// TypeYear is MYSQL_TYPE_YEAR
TypeYear = 13
// TypeNewDate is MYSQL_TYPE_NEWDATE
TypeNewDate = 14
// TypeVarchar is MYSQL_TYPE_VARCHAR
TypeVarchar = 15
// TypeBit is MYSQL_TYPE_BIT
TypeBit = 16
// TypeTimestamp2 is MYSQL_TYPE_TIMESTAMP2
TypeTimestamp2 = 17
// TypeDateTime2 is MYSQL_TYPE_DATETIME2
TypeDateTime2 = 18
// TypeTime2 is MYSQL_TYPE_TIME2
TypeTime2 = 19
// TypeJSON is MYSQL_TYPE_JSON
TypeJSON = 245
// TypeNewDecimal is MYSQL_TYPE_NEWDECIMAL
TypeNewDecimal = 246
// TypeEnum is MYSQL_TYPE_ENUM
TypeEnum = 247
// TypeSet is MYSQL_TYPE_SET
TypeSet = 248
// TypeTinyBlob is MYSQL_TYPE_TINY_BLOB
TypeTinyBlob = 249
// TypeMediumBlob is MYSQL_TYPE_MEDIUM_BLOB
TypeMediumBlob = 250
// TypeLongBlob is MYSQL_TYPE_LONG_BLOB
TypeLongBlob = 251
// TypeBlob is MYSQL_TYPE_BLOB
TypeBlob = 252
// TypeVarString is MYSQL_TYPE_VAR_STRING
TypeVarString = 253
// TypeString is MYSQL_TYPE_STRING
TypeString = 254
// TypeGeometry is MYSQL_TYPE_GEOMETRY
TypeGeometry = 255
)
// Constants for the type of an INTVAR_EVENT.
const (
// IntVarInvalidInt is INVALID_INT_EVENT
IntVarInvalidInt = 0
// IntVarLastInsertID is LAST_INSERT_ID_EVENT
IntVarLastInsertID = 1
// IntVarInsertID is INSERT_ID_EVENT
IntVarInsertID = 2
)
// Name of the variable represented by an IntVar.
var (
// IntVarNames maps a InVar type to the variable name it represents.
IntVarNames = map[byte]string{
IntVarLastInsertID: "LAST_INSERT_ID",
IntVarInsertID: "INSERT_ID",
}
)
// Constants about the type of checksum in a packet.
// These constants are common between MariaDB 10.0 and MySQL 5.6.
const (
// BinlogChecksumAlgOff indicates that checksums are supported but off.
BinlogChecksumAlgOff = 0
// BinlogChecksumAlgCRC32 indicates that CRC32 checksums are used.
BinlogChecksumAlgCRC32 = 1
// BinlogChecksumAlgUndef indicates that checksums are not supported.
BinlogChecksumAlgUndef = 255
)
// These constants describe the event types.
// See: http://dev.mysql.com/doc/internals/en/binlog-event-type.html
const (
eUnknownEvent = 0
eStartEventV3 = 1
eQueryEvent = 2
eStopEvent = 3
eRotateEvent = 4
eIntVarEvent = 5
eLoadEvent = 6
eSlaveEvent = 7
eCreateFileEvent = 8
eAppendBlockEvent = 9
eExecLoadEvent = 10
eDeleteFileEvent = 11
eNewLoadEvent = 12
eRandEvent = 13
eUserVarEvent = 14
eFormatDescriptionEvent = 15
eXIDEvent = 16
eBeginLoadQueryEvent = 17
eExecuteLoadQueryEvent = 18
eTableMapEvent = 19
eWriteRowsEventV0 = 20
eUpdateRowsEventV0 = 21
eDeleteRowsEventV0 = 22
eWriteRowsEventV1 = 23
eUpdateRowsEventV1 = 24
eDeleteRowsEventV1 = 25
eIncidentEvent = 26
eHeartbeatEvent = 27
eIgnorableEvent = 28
eRowsQueryEvent = 29
eWriteRowsEventV2 = 30
eUpdateRowsEventV2 = 31
eDeleteRowsEventV2 = 32
eGTIDEvent = 33
eAnonymousGTIDEvent = 34
ePreviousGTIDsEvent = 35
// MySQL 5.7 events
eTransactionContextEvent = 36
eViewChangeEvent = 37
eXAPrepareLogEvent = 38
// MariaDB specific values. They start at 160.
eMariaAnnotateRowsEvent = 160
eMariaBinlogCheckpointEvent = 161
eMariaGTIDEvent = 162
eMariaGTIDListEvent = 163
eMariaStartEncryptionEvent = 164
)
// These constants describe the type of status variables in q Query packet.
const (
// QFlags2Code is Q_FLAGS2_CODE
QFlags2Code = 0
// QSQLModeCode is Q_SQL_MODE_CODE
QSQLModeCode = 1
// QCatalog is Q_CATALOG
QCatalog = 2
// QAutoIncrement is Q_AUTO_INCREMENT
QAutoIncrement = 3
// QCharsetCode is Q_CHARSET_CODE
QCharsetCode = 4
// QTimeZoneCode is Q_TIME_ZONE_CODE
QTimeZoneCode = 5
// QCatalogNZCode is Q_CATALOG_NZ_CODE
QCatalogNZCode = 6
)