query_options.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License, version 2.0,
  4. as published by the Free Software Foundation.
  5. This program is also distributed with certain software (including
  6. but not limited to OpenSSL) that is licensed under separate terms,
  7. as designated in a particular file or component or in included license
  8. documentation. The authors of MySQL hereby grant you an additional
  9. permission to link the program and your derivative works with the
  10. separately licensed software that they have included with MySQL.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License, version 2.0, for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
  18. #ifndef QUERY_OPTIONS_INCLUDED
  19. #define QUERY_OPTIONS_INCLUDED
  20. /**
  21. @file
  22. @details
  23. This file is used in the server, and the mysqlbinlog client.
  24. */
  25. /*
  26. This is included in the server and in the client.
  27. Options for select set by the yacc parser (stored in lex->options).
  28. NOTE
  29. log_event.h defines OPTIONS_WRITTEN_TO_BIN_LOG to specify what THD
  30. options list are written into binlog. These options can NOT change their
  31. values, or it will break replication between version.
  32. context is encoded as following:
  33. SELECT - SELECT_LEX::options
  34. THD - THD::options
  35. intern - neither. used only as
  36. func(..., select_node->options | thd->options | OPTION_XXX, ...)
  37. TODO: separate three contexts above, move them to separate bitfields.
  38. */
  39. #define SELECT_DISTINCT (1ULL << 0) // SELECT, user
  40. #define SELECT_STRAIGHT_JOIN (1ULL << 1) // SELECT, user
  41. // Free slot, used to be SELECT_DESCRIBE: (1ULL << 2)
  42. #define SELECT_SMALL_RESULT (1ULL << 3) // SELECT, user
  43. #define SELECT_BIG_RESULT (1ULL << 4) // SELECT, user
  44. #define OPTION_FOUND_ROWS \
  45. (1ULL << 5) // SELECT, user
  46. // 1ULL << 6 is free
  47. #define SELECT_NO_JOIN_CACHE (1ULL << 7) // intern
  48. /** always the opposite of OPTION_NOT_AUTOCOMMIT except when in fix_autocommit()
  49. */
  50. #define OPTION_AUTOCOMMIT (1ULL << 8) // THD, user
  51. #define OPTION_BIG_SELECTS (1ULL << 9) // THD, user
  52. #define OPTION_LOG_OFF (1ULL << 10) // THD, user
  53. #define OPTION_QUOTE_SHOW_CREATE (1ULL << 11) // THD, user, unused
  54. #define TMP_TABLE_ALL_COLUMNS (1ULL << 12) // SELECT, intern
  55. #define OPTION_WARNINGS (1ULL << 13) // THD, user
  56. #define OPTION_AUTO_IS_NULL (1ULL << 14) // THD, user, binlog
  57. #define OPTION_FOUND_COMMENT (1ULL << 15) // DEPRECATED
  58. #define OPTION_SAFE_UPDATES (1ULL << 16) // THD, user
  59. #define OPTION_BUFFER_RESULT (1ULL << 17) // SELECT, user
  60. #define OPTION_BIN_LOG (1ULL << 18) // THD, user
  61. #define OPTION_NOT_AUTOCOMMIT (1ULL << 19) // THD, user
  62. #define OPTION_BEGIN (1ULL << 20) // THD, intern
  63. #define OPTION_TABLE_LOCK (1ULL << 21) // THD, intern
  64. #define OPTION_QUICK (1ULL << 22) // SELECT (for DELETE)
  65. #define OPTION_NO_CONST_TABLES (1ULL << 23) // No const tables, intern
  66. /* The following is used to detect a conflict with DISTINCT */
  67. #define SELECT_ALL (1ULL << 24) // SELECT, user, parser
  68. /** The following can be set when importing tables in a 'wrong order'
  69. to suppress foreign key checks */
  70. #define OPTION_NO_FOREIGN_KEY_CHECKS (1ULL << 26) // THD, user, binlog
  71. /** The following speeds up inserts to InnoDB tables by suppressing unique
  72. key checks in some cases */
  73. #define OPTION_RELAXED_UNIQUE_CHECKS (1ULL << 27) // THD, user, binlog
  74. #define SELECT_NO_UNLOCK (1ULL << 28) // SELECT, intern
  75. #define OPTION_SCHEMA_TABLE (1ULL << 29) // SELECT, intern
  76. /** Flag set if setup_tables already done */
  77. #define OPTION_SETUP_TABLES_DONE (1ULL << 30) // intern
  78. /** If not set then the thread will ignore all warnings with level notes. */
  79. #define OPTION_SQL_NOTES (1ULL << 31) // THD, user
  80. /** (1ULL << 32) is not used after removing TMP_TABLE_FORCE_MYISAM option */
  81. #define OPTION_PROFILING (1ULL << 33)
  82. /**
  83. Indicates that this is a HIGH_PRIORITY SELECT.
  84. Currently used only for printing of such selects.
  85. Type of locks to be acquired is specified directly.
  86. */
  87. #define SELECT_HIGH_PRIORITY (1ULL << 34) // SELECT, user
  88. /**
  89. Is set in slave SQL thread when there was an
  90. error on master, which, when is not reproducible
  91. on slave (i.e. the query succeeds on slave),
  92. is not terminal to the state of repliation,
  93. and should be ignored. The slave SQL thread,
  94. however, needs to rollback the effects of the
  95. succeeded statement to keep replication consistent.
  96. */
  97. #define OPTION_MASTER_SQL_ERROR (1ULL << 35)
  98. /*
  99. Dont report errors for individual rows,
  100. But just report error on commit (or read ofcourse)
  101. Note! Reserved for use in MySQL Cluster
  102. */
  103. #define OPTION_ALLOW_BATCH (1ULL << 36) // THD, intern (slave)
  104. #define OPTION_SELECT_FOR_SHOW (1ULL << 37) // SELECT for SHOW over DD.
  105. // Is set while thread is updating the data dictionary tables.
  106. #define OPTION_DD_UPDATE_CONTEXT (1ULL << 38) // intern
  107. #endif /* QUERY_OPTIONS_INCLUDED */