const.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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"
  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. )
  43. const (
  44. comQuit byte = iota + 1
  45. comInitDB
  46. comQuery
  47. comFieldList
  48. comCreateDB
  49. comDropDB
  50. comRefresh
  51. comShutdown
  52. comStatistics
  53. comProcessInfo
  54. comConnect
  55. comProcessKill
  56. comDebug
  57. comPing
  58. comTime
  59. comDelayedInsert
  60. comChangeUser
  61. comBinlogDump
  62. comTableDump
  63. comConnectOut
  64. comRegiserSlave
  65. comStmtPrepare
  66. comStmtExecute
  67. comStmtSendLongData
  68. comStmtClose
  69. comStmtReset
  70. comSetOption
  71. comStmtFetch
  72. )
  73. const (
  74. fieldTypeDecimal byte = iota
  75. fieldTypeTiny
  76. fieldTypeShort
  77. fieldTypeLong
  78. fieldTypeFloat
  79. fieldTypeDouble
  80. fieldTypeNULL
  81. fieldTypeTimestamp
  82. fieldTypeLongLong
  83. fieldTypeInt24
  84. fieldTypeDate
  85. fieldTypeTime
  86. fieldTypeDateTime
  87. fieldTypeYear
  88. fieldTypeNewDate
  89. fieldTypeVarChar
  90. fieldTypeBit
  91. )
  92. const (
  93. fieldTypeNewDecimal byte = iota + 0xf6
  94. fieldTypeEnum
  95. fieldTypeSet
  96. fieldTypeTinyBLOB
  97. fieldTypeMediumBLOB
  98. fieldTypeLongBLOB
  99. fieldTypeBLOB
  100. fieldTypeVarString
  101. fieldTypeString
  102. fieldTypeGeometry
  103. )
  104. type fieldFlag uint16
  105. const (
  106. flagNotNULL fieldFlag = 1 << iota
  107. flagPriKey
  108. flagUniqueKey
  109. flagMultipleKey
  110. flagBLOB
  111. flagUnsigned
  112. flagZeroFill
  113. flagBinary
  114. flagEnum
  115. flagAutoIncrement
  116. flagTimestamp
  117. flagSet
  118. flagUnknown1
  119. flagUnknown2
  120. flagUnknown3
  121. flagUnknown4
  122. )