const.go 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. type clientFlag uint32
  18. const (
  19. clientLongPassword clientFlag = 1 << iota
  20. clientFoundRows
  21. clientLongFlag
  22. clientConnectWithDB
  23. clientNoSchema
  24. clientCompress
  25. clientODBC
  26. clientLocalFiles
  27. clientIgnoreSpace
  28. clientProtocol41
  29. clientInteractive
  30. clientSSL
  31. clientIgnoreSIGPIPE
  32. clientTransactions
  33. clientReserved
  34. clientSecureConn
  35. clientMultiStatements
  36. clientMultiResults
  37. )
  38. type commandType byte
  39. const (
  40. comQuit commandType = iota + 1
  41. comInitDB
  42. comQuery
  43. comFieldList
  44. comCreateDB
  45. comDropDB
  46. comRefresh
  47. comShutdown
  48. comStatistics
  49. comProcessInfo
  50. comConnect
  51. comProcessKill
  52. comDebug
  53. comPing
  54. comTime
  55. comDelayedInsert
  56. comChangeUser
  57. comBinlogDump
  58. comTableDump
  59. comConnectOut
  60. comRegiserSlave
  61. comStmtPrepare
  62. comStmtExecute
  63. comStmtSendLongData
  64. comStmtClose
  65. comStmtReset
  66. comSetOption
  67. comStmtFetch
  68. )
  69. const (
  70. fieldTypeDecimal byte = iota
  71. fieldTypeTiny
  72. fieldTypeShort
  73. fieldTypeLong
  74. fieldTypeFloat
  75. fieldTypeDouble
  76. fieldTypeNULL
  77. fieldTypeTimestamp
  78. fieldTypeLongLong
  79. fieldTypeInt24
  80. fieldTypeDate
  81. fieldTypeTime
  82. fieldTypeDateTime
  83. fieldTypeYear
  84. fieldTypeNewDate
  85. fieldTypeVarChar
  86. fieldTypeBit
  87. )
  88. const (
  89. fieldTypeNewDecimal byte = iota + 0xf6
  90. fieldTypeEnum
  91. fieldTypeSet
  92. fieldTypeTinyBLOB
  93. fieldTypeMediumBLOB
  94. fieldTypeLongBLOB
  95. fieldTypeBLOB
  96. fieldTypeVarString
  97. fieldTypeString
  98. fieldTypeGeometry
  99. )
  100. type fieldFlag uint16
  101. const (
  102. flagNotNULL fieldFlag = 1 << iota
  103. flagPriKey
  104. flagUniqueKey
  105. flagMultipleKey
  106. flagBLOB
  107. flagUnsigned
  108. flagZeroFill
  109. flagBinary
  110. flagEnum
  111. flagAutoIncrement
  112. flagTimestamp
  113. flagSet
  114. flagUnknown1
  115. flagUnknown2
  116. flagUnknown3
  117. flagUnknown4
  118. )