vitess.io/vitess@v0.16.2/go/mysql/replication_constants.go (about)

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