const.go 2.2 KB

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