const.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. // Go MySQL Driver - A MySQL-Driver for Go's database/sql package
  2. //
  3. // Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved.
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public
  6. // License, v. 2.0. If a copy of the MPL was not distributed with this file,
  7. // You can obtain one at http://mozilla.org/MPL/2.0/.
  8. package mysql
  9. const (
  10. minProtocolVersion byte = 10
  11. maxPacketSize = 1<<24 - 1
  12. )
  13. // MySQL constants documentation:
  14. // http://dev.mysql.com/doc/internals/en/client-server-protocol.html
  15. const (
  16. iOK byte = 0x00
  17. iLocalInFile byte = 0xfb
  18. iEOF byte = 0xfe
  19. iERR byte = 0xff
  20. )
  21. type clientFlag uint32
  22. const (
  23. clientLongPassword clientFlag = 1 << iota
  24. clientFoundRows
  25. clientLongFlag
  26. clientConnectWithDB
  27. clientNoSchema
  28. clientCompress
  29. clientODBC
  30. clientLocalFiles
  31. clientIgnoreSpace
  32. clientProtocol41
  33. clientInteractive
  34. clientSSL
  35. clientIgnoreSIGPIPE
  36. clientTransactions
  37. clientReserved
  38. clientSecureConn
  39. clientMultiStatements
  40. clientMultiResults
  41. )
  42. const (
  43. comQuit byte = iota + 1
  44. comInitDB
  45. comQuery
  46. comFieldList
  47. comCreateDB
  48. comDropDB
  49. comRefresh
  50. comShutdown
  51. comStatistics
  52. comProcessInfo
  53. comConnect
  54. comProcessKill
  55. comDebug
  56. comPing
  57. comTime
  58. comDelayedInsert
  59. comChangeUser
  60. comBinlogDump
  61. comTableDump
  62. comConnectOut
  63. comRegiserSlave
  64. comStmtPrepare
  65. comStmtExecute
  66. comStmtSendLongData
  67. comStmtClose
  68. comStmtReset
  69. comSetOption
  70. comStmtFetch
  71. )
  72. const (
  73. fieldTypeDecimal byte = iota
  74. fieldTypeTiny
  75. fieldTypeShort
  76. fieldTypeLong
  77. fieldTypeFloat
  78. fieldTypeDouble
  79. fieldTypeNULL
  80. fieldTypeTimestamp
  81. fieldTypeLongLong
  82. fieldTypeInt24
  83. fieldTypeDate
  84. fieldTypeTime
  85. fieldTypeDateTime
  86. fieldTypeYear
  87. fieldTypeNewDate
  88. fieldTypeVarChar
  89. fieldTypeBit
  90. )
  91. const (
  92. fieldTypeNewDecimal byte = iota + 0xf6
  93. fieldTypeEnum
  94. fieldTypeSet
  95. fieldTypeTinyBLOB
  96. fieldTypeMediumBLOB
  97. fieldTypeLongBLOB
  98. fieldTypeBLOB
  99. fieldTypeVarString
  100. fieldTypeString
  101. fieldTypeGeometry
  102. )
  103. type fieldFlag uint16
  104. const (
  105. flagNotNULL fieldFlag = 1 << iota
  106. flagPriKey
  107. flagUniqueKey
  108. flagMultipleKey
  109. flagBLOB
  110. flagUnsigned
  111. flagZeroFill
  112. flagBinary
  113. flagEnum
  114. flagAutoIncrement
  115. flagTimestamp
  116. flagSet
  117. flagUnknown1
  118. flagUnknown2
  119. flagUnknown3
  120. flagUnknown4
  121. )