mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-02 22:56:30 +00:00
142 lines
2.5 KiB
Go
142 lines
2.5 KiB
Go
// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
|
|
//
|
|
// Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved.
|
|
//
|
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
// You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
package mysql
|
|
|
|
const (
|
|
minProtocolVersion byte = 10
|
|
maxPacketSize = 1<<24 - 1
|
|
timeFormat = "2006-01-02 15:04:05"
|
|
)
|
|
|
|
// MySQL constants documentation:
|
|
// http://dev.mysql.com/doc/internals/en/client-server-protocol.html
|
|
|
|
const (
|
|
iOK byte = 0x00
|
|
iLocalInFile byte = 0xfb
|
|
iEOF byte = 0xfe
|
|
iERR byte = 0xff
|
|
)
|
|
|
|
type clientFlag uint32
|
|
|
|
const (
|
|
clientLongPassword clientFlag = 1 << iota
|
|
clientFoundRows
|
|
clientLongFlag
|
|
clientConnectWithDB
|
|
clientNoSchema
|
|
clientCompress
|
|
clientODBC
|
|
clientLocalFiles
|
|
clientIgnoreSpace
|
|
clientProtocol41
|
|
clientInteractive
|
|
clientSSL
|
|
clientIgnoreSIGPIPE
|
|
clientTransactions
|
|
clientReserved
|
|
clientSecureConn
|
|
clientMultiStatements
|
|
clientMultiResults
|
|
)
|
|
|
|
const (
|
|
comQuit byte = iota + 1
|
|
comInitDB
|
|
comQuery
|
|
comFieldList
|
|
comCreateDB
|
|
comDropDB
|
|
comRefresh
|
|
comShutdown
|
|
comStatistics
|
|
comProcessInfo
|
|
comConnect
|
|
comProcessKill
|
|
comDebug
|
|
comPing
|
|
comTime
|
|
comDelayedInsert
|
|
comChangeUser
|
|
comBinlogDump
|
|
comTableDump
|
|
comConnectOut
|
|
comRegiserSlave
|
|
comStmtPrepare
|
|
comStmtExecute
|
|
comStmtSendLongData
|
|
comStmtClose
|
|
comStmtReset
|
|
comSetOption
|
|
comStmtFetch
|
|
)
|
|
|
|
const (
|
|
fieldTypeDecimal byte = iota
|
|
fieldTypeTiny
|
|
fieldTypeShort
|
|
fieldTypeLong
|
|
fieldTypeFloat
|
|
fieldTypeDouble
|
|
fieldTypeNULL
|
|
fieldTypeTimestamp
|
|
fieldTypeLongLong
|
|
fieldTypeInt24
|
|
fieldTypeDate
|
|
fieldTypeTime
|
|
fieldTypeDateTime
|
|
fieldTypeYear
|
|
fieldTypeNewDate
|
|
fieldTypeVarChar
|
|
fieldTypeBit
|
|
)
|
|
const (
|
|
fieldTypeNewDecimal byte = iota + 0xf6
|
|
fieldTypeEnum
|
|
fieldTypeSet
|
|
fieldTypeTinyBLOB
|
|
fieldTypeMediumBLOB
|
|
fieldTypeLongBLOB
|
|
fieldTypeBLOB
|
|
fieldTypeVarString
|
|
fieldTypeString
|
|
fieldTypeGeometry
|
|
)
|
|
|
|
type fieldFlag uint16
|
|
|
|
const (
|
|
flagNotNULL fieldFlag = 1 << iota
|
|
flagPriKey
|
|
flagUniqueKey
|
|
flagMultipleKey
|
|
flagBLOB
|
|
flagUnsigned
|
|
flagZeroFill
|
|
flagBinary
|
|
flagEnum
|
|
flagAutoIncrement
|
|
flagTimestamp
|
|
flagSet
|
|
flagUnknown1
|
|
flagUnknown2
|
|
flagUnknown3
|
|
flagUnknown4
|
|
)
|
|
|
|
const (
|
|
collation_ascii_general_ci byte = 11
|
|
collation_utf8_general_ci byte = 33
|
|
collation_utf8mb4_general_ci byte = 45
|
|
collation_utf8mb4_bin byte = 46
|
|
collation_latin1_general_ci byte = 48
|
|
collation_binary byte = 63
|
|
collation_utf8mb4_unicode_ci byte = 224
|
|
)
|