| 1 | /* -*- c-basic-offset: 2 -*- */ |
| 2 | /* |
| 3 | Copyright(C) 2016 Kouhei Sutou <kou@clear-code.com> |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with this library; if not, write to the Free Software |
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #ifndef MRN_COUNT_SKIP_CHECKER_HPP_ |
| 21 | #define MRN_COUNT_SKIP_CHECKER_HPP_ |
| 22 | |
| 23 | #include <mrn_mysql_compat.h> |
| 24 | |
| 25 | #include <item_cmpfunc.h> |
| 26 | |
| 27 | #include <groonga.h> |
| 28 | |
| 29 | namespace mrn { |
| 30 | class CountSkipChecker { |
| 31 | public: |
| 32 | CountSkipChecker(grn_ctx *ctx, |
| 33 | TABLE *table, |
| 34 | SELECT_LEX *select_lex, |
| 35 | KEY *key_info, |
| 36 | key_part_map target_key_part_map, |
| 37 | bool is_storage_mode); |
| 38 | ~CountSkipChecker(); |
| 39 | |
| 40 | bool check(); |
| 41 | |
| 42 | private: |
| 43 | grn_ctx *ctx_; |
| 44 | TABLE *table_; |
| 45 | SELECT_LEX *select_lex_; |
| 46 | KEY *key_info_; |
| 47 | key_part_map target_key_part_map_; |
| 48 | bool is_storage_mode_; |
| 49 | |
| 50 | bool is_skippable(Item *where); |
| 51 | bool is_skippable(Item_cond *cond_item); |
| 52 | bool is_skippable(Item_func *func_item); |
| 53 | bool is_skippable(Item_field *field_item); |
| 54 | }; |
| 55 | } |
| 56 | |
| 57 | #endif /* MRN_COUNT_SKIP_CHECKER_HPP_ */ |
| 58 | |