class Sql_mode_dependency A combination of hard and soft dependency on sql_mode. Used to watch if a GENERATED ALWAYS AS expression guarantees consistent data written to its virtual column. A virtual column can appear in an index if: - the generation expression does not depend on any sql_mode flags, or - the generation expression has a soft dependency on an sql_mode flag, and the
| 109 | therefore it's disallowed. |
| 110 | */ |
| 111 | class Sql_mode_dependency |
| 112 | { |
| 113 | sql_mode_t m_hard; |
| 114 | sql_mode_t m_soft; |
| 115 | public: |
| 116 | Sql_mode_dependency() |
| 117 | :m_hard(0), m_soft(0) |
| 118 | { } |
| 119 | Sql_mode_dependency(sql_mode_t hard, sql_mode_t soft) |
| 120 | :m_hard(hard), m_soft(soft) |
| 121 | { } |
| 122 | sql_mode_t hard() const { return m_hard; } |
| 123 | sql_mode_t soft() const { return m_soft; } |
| 124 | operator bool () const |
| 125 | { |
| 126 | return m_hard > 0 || m_soft > 0; |
| 127 | } |
| 128 | Sql_mode_dependency operator|(const Sql_mode_dependency &other) const |
| 129 | { |
| 130 | return Sql_mode_dependency(m_hard | other.m_hard, m_soft | other.m_soft); |
| 131 | } |
| 132 | Sql_mode_dependency operator&(const Sql_mode_dependency &other) const |
| 133 | { |
| 134 | return Sql_mode_dependency(m_hard & other.m_hard, m_soft & other.m_soft); |
| 135 | } |
| 136 | Sql_mode_dependency &operator|=(const Sql_mode_dependency &other) |
| 137 | { |
| 138 | m_hard|= other.m_hard; |
| 139 | m_soft|= other.m_soft; |
| 140 | return *this; |
| 141 | } |
| 142 | Sql_mode_dependency &operator&=(const Sql_mode_dependency &other) |
| 143 | { |
| 144 | m_hard&= other.m_hard; |
| 145 | m_soft&= other.m_soft; |
| 146 | return *this; |
| 147 | } |
| 148 | Sql_mode_dependency &soft_to_hard() |
| 149 | { |
| 150 | m_hard|= m_soft; |
| 151 | m_soft= 0; |
| 152 | return *this; |
| 153 | } |
| 154 | void push_dependency_warnings(THD *thd) const; |
| 155 | }; |
| 156 | |
| 157 | |
| 158 | #endif // SQL_MODE_H_INCLUDED |
no outgoing calls
no test coverage detected