func (m SQLMode) HasPipesAsConcatMode() bool {
	return m&ModePipesAsConcat == ModePipesAsConcat
}
HasPipesAsConcatMode detects if 'PIPES_AS_CONCAT' mode is set in SQLMode
package mysql
import (
	"fmt"
	"strings"
)
func newInvalidModeErr(s string) error {
	return NewErr(ErrWrongValueForVar, "sql_mode", s)
}
var (
	TiDBReleaseVersion = "None"
	ServerVersion = fmt.Sprintf("5.7.10-TiDB-%s", TiDBReleaseVersion)
)
const (
	OKHeader          byte = 0x00
	ErrHeader         byte = 0xff
	EOFHeader         byte = 0xfe
	LocalInFileHeader byte = 0xfb
)
const (
	ServerStatusInTrans            uint16 = 0x0001
	ServerStatusAutocommit         uint16 = 0x0002
	ServerMoreResultsExists        uint16 = 0x0008
	ServerStatusNoGoodIndexUsed    uint16 = 0x0010
	ServerStatusNoIndexUsed        uint16 = 0x0020
	ServerStatusCursorExists       uint16 = 0x0040
	ServerStatusLastRowSend        uint16 = 0x0080
	ServerStatusDBDropped          uint16 = 0x0100
	ServerStatusNoBackslashEscaped uint16 = 0x0200
	ServerStatusMetadataChanged    uint16 = 0x0400
	ServerStatusWasSlow            uint16 = 0x0800
	ServerPSOutParams              uint16 = 0x1000
)
func HasCursorExistsFlag(serverStatus uint16) bool {
	return serverStatus&ServerStatusCursorExists > 0
}
const (
	MaxPayloadLen = 1<<24 - 1
	MaxTableNameLength = 64
	MaxDatabaseNameLength = 64
	MaxColumnNameLength = 64
	MaxKeyParts = 16
	MaxIndexIdentifierLen = 64
	MaxConstraintIdentifierLen = 64
	MaxViewIdentifierLen = 64
	MaxAliasIdentifierLen = 256
	MaxUserDefinedVariableLen = 64
)
const ErrTextLength = 80
const (
	ComSleep byte = iota
	ComQuit
	ComInitDB
	ComQuery
	ComFieldList
	ComCreateDB
	ComDropDB
	ComRefresh
	ComShutdown
	ComStatistics
	ComProcessInfo
	ComConnect
	ComProcessKill
	ComDebug
	ComPing
	ComTime
	ComDelayedInsert
	ComChangeUser
	ComBinlogDump
	ComTableDump
	ComConnectOut
	ComRegisterSlave
	ComStmtPrepare
	ComStmtExecute
	ComStmtSendLongData
	ComStmtClose
	ComStmtReset
	ComSetOption
	ComStmtFetch
	ComDaemon
	ComBinlogDumpGtid
	ComResetConnection
	ComEnd
)
const (
	ClientLongPassword uint32 = 1 << iota
	ClientFoundRows
	ClientLongFlag
	ClientConnectWithDB
	ClientNoSchema
	ClientCompress
	ClientODBC
	ClientLocalFiles
	ClientIgnoreSpace
	ClientProtocol41
	ClientInteractive
	ClientSSL
	ClientIgnoreSigpipe
	ClientTransactions
	ClientReserved
	ClientSecureConnection
	ClientMultiStatements
	ClientMultiResults
	ClientPSMultiResults
	ClientPluginAuth
	ClientConnectAtts
	ClientPluginAuthLenencClientData
)
const (
	TypeNoCache byte = 0xff
)
const (
	AuthName = "mysql_native_password"
)
const (
	SystemDB = "mysql"
	UserTable = "User"
	DBTable = "DB"
	TablePrivTable = "Tables_priv"
	ColumnPrivTable = "Columns_priv"
	GlobalVariablesTable = "GLOBAL_VARIABLES"
	GlobalStatusTable = "GLOBAL_STATUS"
	TiDBTable = "tidb"
)
type PrivilegeType uint32
const (
	_ PrivilegeType = 1 << iota
	CreatePriv
	SelectPriv
	InsertPriv
	UpdatePriv
	DeletePriv
	ShowDBPriv
	SuperPriv
	CreateUserPriv
	TriggerPriv
	DropPriv
	ProcessPriv
	GrantPriv
	ReferencesPriv
	AlterPriv
	ExecutePriv
	IndexPriv
	AllPriv
)
const AllPrivMask = AllPriv - 1
const (
	NotFixedDec = 31
	MaxIntWidth             = 20
	MaxRealWidth            = 23
	MaxFloatingTypeScale    = 30
	MaxFloatingTypeWidth    = 255
	MaxDecimalScale         = 30
	MaxDecimalWidth         = 65
	MaxDateWidth            = 10  
	MaxDatetimeWidthNoFsp   = 19  
	MaxDatetimeWidthWithFsp = 26  
	MaxDatetimeFullWidth    = 29  
	MaxDurationWidthNoFsp   = 10  
	MaxDurationWidthWithFsp = 15  
	MaxBlobWidth            = 16777216
)
const (
	MaxFieldCharLength    = 255
	MaxFieldVarCharLength = 65535
)
const MaxTypeSetMembers = 64
const PWDHashLen = 40
var Priv2UserCol = map[PrivilegeType]string{
	CreatePriv:     "Create_priv",
	SelectPriv:     "Select_priv",
	InsertPriv:     "Insert_priv",
	UpdatePriv:     "Update_priv",
	DeletePriv:     "Delete_priv",
	ShowDBPriv:     "Show_db_priv",
	SuperPriv:      "Super_priv",
	CreateUserPriv: "Create_user_priv",
	TriggerPriv:    "Trigger_priv",
	DropPriv:       "Drop_priv",
	ProcessPriv:    "Process_priv",
	GrantPriv:      "Grant_priv",
	ReferencesPriv: "References_priv",
	AlterPriv:      "Alter_priv",
	ExecutePriv:    "Execute_priv",
	IndexPriv:      "Index_priv",
}
var Command2Str = map[byte]string{
	ComSleep:            "Sleep",
	ComQuit:             "Quit",
	ComInitDB:           "Init DB",
	ComQuery:            "Query",
	ComFieldList:        "Field List",
	ComCreateDB:         "Create DB",
	ComDropDB:           "Drop DB",
	ComRefresh:          "Refresh",
	ComShutdown:         "Shutdown",
	ComStatistics:       "Statistics",
	ComProcessInfo:      "Processlist",
	ComConnect:          "Connect",
	ComProcessKill:      "Kill",
	ComDebug:            "Debug",
	ComPing:             "Ping",
	ComTime:             "Time",
	ComDelayedInsert:    "Delayed Insert",
	ComChangeUser:       "Change User",
	ComBinlogDump:       "Binlog Dump",
	ComTableDump:        "Table Dump",
	ComConnectOut:       "Connect out",
	ComRegisterSlave:    "Register Slave",
	ComStmtPrepare:      "Prepare",
	ComStmtExecute:      "Execute",
	ComStmtSendLongData: "Long Data",
	ComStmtClose:        "Close stmt",
	ComStmtReset:        "Reset stmt",
	ComSetOption:        "Set option",
	ComStmtFetch:        "Fetch",
	ComDaemon:           "Daemon",
	ComBinlogDumpGtid:   "Binlog Dump",
	ComResetConnection:  "Reset connect",
}
var Col2PrivType = map[string]PrivilegeType{
	"Create_priv":      CreatePriv,
	"Select_priv":      SelectPriv,
	"Insert_priv":      InsertPriv,
	"Update_priv":      UpdatePriv,
	"Delete_priv":      DeletePriv,
	"Show_db_priv":     ShowDBPriv,
	"Super_priv":       SuperPriv,
	"Create_user_priv": CreateUserPriv,
	"Trigger_priv":     TriggerPriv,
	"Drop_priv":        DropPriv,
	"Process_priv":     ProcessPriv,
	"Grant_priv":       GrantPriv,
	"References_priv":  ReferencesPriv,
	"Alter_priv":       AlterPriv,
	"Execute_priv":     ExecutePriv,
	"Index_priv":       IndexPriv,
}
var AllGlobalPrivs = []PrivilegeType{SelectPriv, InsertPriv, UpdatePriv, DeletePriv, CreatePriv, DropPriv, ProcessPriv, GrantPriv, ReferencesPriv, AlterPriv, ShowDBPriv, SuperPriv, ExecutePriv, IndexPriv, CreateUserPriv, TriggerPriv}
var Priv2Str = map[PrivilegeType]string{
	CreatePriv:     "Create",
	SelectPriv:     "Select",
	InsertPriv:     "Insert",
	UpdatePriv:     "Update",
	DeletePriv:     "Delete",
	ShowDBPriv:     "Show Databases",
	SuperPriv:      "Super",
	CreateUserPriv: "Create User",
	TriggerPriv:    "Trigger",
	DropPriv:       "Drop",
	ProcessPriv:    "Process",
	GrantPriv:      "Grant Option",
	ReferencesPriv: "References",
	AlterPriv:      "Alter",
	ExecutePriv:    "Execute",
	IndexPriv:      "Index",
}
var Priv2SetStr = map[PrivilegeType]string{
	CreatePriv:  "Create",
	SelectPriv:  "Select",
	InsertPriv:  "Insert",
	UpdatePriv:  "Update",
	DeletePriv:  "Delete",
	DropPriv:    "Drop",
	GrantPriv:   "Grant",
	AlterPriv:   "Alter",
	ExecutePriv: "Execute",
	IndexPriv:   "Index",
}
var SetStr2Priv = map[string]PrivilegeType{
	"Create":  CreatePriv,
	"Select":  SelectPriv,
	"Insert":  InsertPriv,
	"Update":  UpdatePriv,
	"Delete":  DeletePriv,
	"Drop":    DropPriv,
	"Grant":   GrantPriv,
	"Alter":   AlterPriv,
	"Execute": ExecutePriv,
	"Index":   IndexPriv,
}
var AllDBPrivs = []PrivilegeType{SelectPriv, InsertPriv, UpdatePriv, DeletePriv, CreatePriv, DropPriv, GrantPriv, AlterPriv, ExecutePriv, IndexPriv}
var AllTablePrivs = []PrivilegeType{SelectPriv, InsertPriv, UpdatePriv, DeletePriv, CreatePriv, DropPriv, GrantPriv, AlterPriv, IndexPriv}
var AllColumnPrivs = []PrivilegeType{SelectPriv, InsertPriv, UpdatePriv}
const AllPrivilegeLiteral = "ALL PRIVILEGES"
const DefaultSQLMode = "ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
var DefaultLengthOfMysqlTypes = map[byte]int{
	TypeYear:      1,
	TypeDate:      3,
	TypeDuration:  3,
	TypeDatetime:  8,
	TypeTimestamp: 4,
	TypeTiny:     1,
	TypeShort:    2,
	TypeInt24:    3,
	TypeLong:     4,
	TypeLonglong: 8,
	TypeFloat:    4,
	TypeDouble:   8,
	TypeEnum:   2,
	TypeString: 1,
	TypeSet:    8,
}
var DefaultLengthOfTimeFraction = map[int]int{
	0: 0,
	1: 1,
	2: 1,
	3: 2,
	4: 2,
	5: 3,
	6: 3,
}
type SQLMode int
func (m SQLMode) HasNoZeroDateMode() bool {
	return m&ModeNoZeroDate == ModeNoZeroDate
}
func (m SQLMode) HasNoZeroInDateMode() bool {
	return m&ModeNoZeroInDate == ModeNoZeroInDate
}
func (m SQLMode) HasErrorForDivisionByZeroMode() bool {
	return m&ModeErrorForDivisionByZero == ModeErrorForDivisionByZero
}
func (m SQLMode) HasOnlyFullGroupBy() bool {
	return m&ModeOnlyFullGroupBy == ModeOnlyFullGroupBy
}
func (m SQLMode) HasStrictMode() bool {
	return m&ModeStrictTransTables == ModeStrictTransTables || m&ModeStrictAllTables == ModeStrictAllTables
}