const.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. timeFormat = "2006-01-02 15:04:05.999999"
  13. )
  14. // MySQL constants documentation:
  15. // http://dev.mysql.com/doc/internals/en/client-server-protocol.html
  16. const (
  17. iOK byte = 0x00
  18. iLocalInFile byte = 0xfb
  19. iEOF byte = 0xfe
  20. iERR byte = 0xff
  21. )
  22. type clientFlag uint32
  23. const (
  24. clientLongPassword clientFlag = 1 << iota
  25. clientFoundRows
  26. clientLongFlag
  27. clientConnectWithDB
  28. clientNoSchema
  29. clientCompress
  30. clientODBC
  31. clientLocalFiles
  32. clientIgnoreSpace
  33. clientProtocol41
  34. clientInteractive
  35. clientSSL
  36. clientIgnoreSIGPIPE
  37. clientTransactions
  38. clientReserved
  39. clientSecureConn
  40. clientMultiStatements
  41. clientMultiResults
  42. clientPSMultiResults
  43. clientPluginAuth
  44. )
  45. const (
  46. comQuit byte = iota + 1
  47. comInitDB
  48. comQuery
  49. comFieldList
  50. comCreateDB
  51. comDropDB
  52. comRefresh
  53. comShutdown
  54. comStatistics
  55. comProcessInfo
  56. comConnect
  57. comProcessKill
  58. comDebug
  59. comPing
  60. comTime
  61. comDelayedInsert
  62. comChangeUser
  63. comBinlogDump
  64. comTableDump
  65. comConnectOut
  66. comRegisterSlave
  67. comStmtPrepare
  68. comStmtExecute
  69. comStmtSendLongData
  70. comStmtClose
  71. comStmtReset
  72. comSetOption
  73. comStmtFetch
  74. )
  75. const (
  76. fieldTypeDecimal byte = iota
  77. fieldTypeTiny
  78. fieldTypeShort
  79. fieldTypeLong
  80. fieldTypeFloat
  81. fieldTypeDouble
  82. fieldTypeNULL
  83. fieldTypeTimestamp
  84. fieldTypeLongLong
  85. fieldTypeInt24
  86. fieldTypeDate
  87. fieldTypeTime
  88. fieldTypeDateTime
  89. fieldTypeYear
  90. fieldTypeNewDate
  91. fieldTypeVarChar
  92. fieldTypeBit
  93. )
  94. const (
  95. fieldTypeNewDecimal byte = iota + 0xf6
  96. fieldTypeEnum
  97. fieldTypeSet
  98. fieldTypeTinyBLOB
  99. fieldTypeMediumBLOB
  100. fieldTypeLongBLOB
  101. fieldTypeBLOB
  102. fieldTypeVarString
  103. fieldTypeString
  104. fieldTypeGeometry
  105. )
  106. type fieldFlag uint16
  107. const (
  108. flagNotNULL fieldFlag = 1 << iota
  109. flagPriKey
  110. flagUniqueKey
  111. flagMultipleKey
  112. flagBLOB
  113. flagUnsigned
  114. flagZeroFill
  115. flagBinary
  116. flagEnum
  117. flagAutoIncrement
  118. flagTimestamp
  119. flagSet
  120. flagUnknown1
  121. flagUnknown2
  122. flagUnknown3
  123. flagUnknown4
  124. )
  125. // http://dev.mysql.com/doc/internals/en/status-flags.html
  126. type statusFlag uint16
  127. const (
  128. statusInTrans statusFlag = 1 << iota
  129. statusInAutocommit
  130. statusReserved // Not in documentation
  131. statusMoreResultsExists
  132. statusNoGoodIndexUsed
  133. statusNoIndexUsed
  134. statusCursorExists
  135. statusLastRowSent
  136. statusDbDropped
  137. statusNoBackslashEscapes
  138. statusMetadataChanged
  139. statusQueryWasSlow
  140. statusPsOutParams
  141. statusInTransReadonly
  142. statusSessionStateChanged
  143. )