reserved.go 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. package dolphin
  2. import "strings"
  3. // https://dev.mysql.com/doc/refman/8.0/en/keywords.html
  4. func (p *Parser) IsReservedKeyword(s string) bool {
  5. switch strings.ToLower(s) {
  6. case "accessible":
  7. case "add":
  8. case "all":
  9. case "alter":
  10. case "analyze":
  11. case "and":
  12. case "as":
  13. case "asc":
  14. case "asensitive":
  15. case "before":
  16. case "between":
  17. case "bigint":
  18. case "binary":
  19. case "blob":
  20. case "both":
  21. case "by":
  22. case "call":
  23. case "cascade":
  24. case "case":
  25. case "change":
  26. case "char":
  27. case "character":
  28. case "check":
  29. case "collate":
  30. case "column":
  31. case "condition":
  32. case "constraint":
  33. case "continue":
  34. case "convert":
  35. case "create":
  36. case "cross":
  37. case "cube":
  38. case "cume_dist":
  39. case "current_date":
  40. case "current_time":
  41. case "current_timestamp":
  42. case "current_user":
  43. case "cursor":
  44. case "database":
  45. case "databases":
  46. case "day_hour":
  47. case "day_microsecond":
  48. case "day_minute":
  49. case "day_second":
  50. case "dec":
  51. case "decimal":
  52. case "declare":
  53. case "default":
  54. case "delayed":
  55. case "delete":
  56. case "dense_rank":
  57. case "desc":
  58. case "describe":
  59. case "deterministic":
  60. case "distinct":
  61. case "distinctrow":
  62. case "div":
  63. case "double":
  64. case "drop":
  65. case "dual":
  66. case "each":
  67. case "else":
  68. case "elseif":
  69. case "empty":
  70. case "enclosed":
  71. case "escaped":
  72. case "except":
  73. case "exists":
  74. case "exit":
  75. case "explain":
  76. case "false":
  77. case "fetch":
  78. case "first_value":
  79. case "float":
  80. case "float4":
  81. case "float8":
  82. case "for":
  83. case "force":
  84. case "foreign":
  85. case "from":
  86. case "fulltext":
  87. case "function":
  88. case "generated":
  89. case "get":
  90. case "grant":
  91. case "group":
  92. case "grouping":
  93. case "groups":
  94. case "having":
  95. case "high_priority":
  96. case "hour_microsecond":
  97. case "hour_minute":
  98. case "hour_second":
  99. case "if":
  100. case "ignore":
  101. case "in":
  102. case "index":
  103. case "infile":
  104. case "inner":
  105. case "inout":
  106. case "insensitive":
  107. case "insert":
  108. case "int":
  109. case "int1":
  110. case "int2":
  111. case "int3":
  112. case "int4":
  113. case "int8":
  114. case "integer":
  115. case "interval":
  116. case "into":
  117. case "io_after_gtids":
  118. case "io_before_gtids":
  119. case "is":
  120. case "iterate":
  121. case "join":
  122. case "json_table":
  123. case "key":
  124. case "keys":
  125. case "kill":
  126. case "lag":
  127. case "last_value":
  128. case "lateral":
  129. case "lead":
  130. case "leading":
  131. case "leave":
  132. case "left":
  133. case "like":
  134. case "limit":
  135. case "linear":
  136. case "lines":
  137. case "load":
  138. case "localtime":
  139. case "localtimestamp":
  140. case "lock":
  141. case "long":
  142. case "longblob":
  143. case "longtext":
  144. case "loop":
  145. case "low_priority":
  146. case "master_bind":
  147. case "master_ssl_verify_server_cert":
  148. case "match":
  149. case "maxvalue":
  150. case "mediumblob":
  151. case "mediumint":
  152. case "mediumtext":
  153. case "middleint":
  154. case "minute_microsecond":
  155. case "minute_second":
  156. case "mod":
  157. case "modifies":
  158. case "natural":
  159. case "not":
  160. case "no_write_to_binlog":
  161. case "nth_value":
  162. case "ntile":
  163. case "null":
  164. case "numeric":
  165. case "of":
  166. case "on":
  167. case "optimize":
  168. case "optimizer_costs":
  169. case "option":
  170. case "optionally":
  171. case "or":
  172. case "order":
  173. case "out":
  174. case "outer":
  175. case "outfile":
  176. case "over":
  177. case "partition":
  178. case "percent_rank":
  179. case "precision":
  180. case "primary":
  181. case "procedure":
  182. case "purge":
  183. case "range":
  184. case "rank":
  185. case "read":
  186. case "reads":
  187. case "read_write":
  188. case "real":
  189. case "recursive":
  190. case "references":
  191. case "regexp":
  192. case "release":
  193. case "rename":
  194. case "repeat":
  195. case "replace":
  196. case "require":
  197. case "resignal":
  198. case "restrict":
  199. case "return":
  200. case "revoke":
  201. case "right":
  202. case "rlike":
  203. case "row":
  204. case "rows":
  205. case "row_number":
  206. case "schema":
  207. case "schemas":
  208. case "second_microsecond":
  209. case "select":
  210. case "sensitive":
  211. case "separator":
  212. case "set":
  213. case "show":
  214. case "signal":
  215. case "smallint":
  216. case "spatial":
  217. case "specific":
  218. case "sql":
  219. case "sqlexception":
  220. case "sqlstate":
  221. case "sqlwarning":
  222. case "sql_big_result":
  223. case "sql_calc_found_rows":
  224. case "sql_small_result":
  225. case "ssl":
  226. case "starting":
  227. case "stored":
  228. case "straight_join":
  229. case "system":
  230. case "table":
  231. case "terminated":
  232. case "then":
  233. case "tinyblob":
  234. case "tinyint":
  235. case "tinytext":
  236. case "to":
  237. case "trailing":
  238. case "trigger":
  239. case "true":
  240. case "undo":
  241. case "union":
  242. case "unique":
  243. case "unlock":
  244. case "unsigned":
  245. case "update":
  246. case "usage":
  247. case "use":
  248. case "using":
  249. case "utc_date":
  250. case "utc_time":
  251. case "utc_timestamp":
  252. case "values":
  253. case "varbinary":
  254. case "varchar":
  255. case "varcharacter":
  256. case "varying":
  257. case "virtual":
  258. case "when":
  259. case "where":
  260. case "while":
  261. case "window":
  262. case "with":
  263. case "write":
  264. case "xor":
  265. case "year_month":
  266. case "zerofill":
  267. default:
  268. return false
  269. }
  270. return true
  271. }