| 1 | /***************************************************************************** |
| 2 | |
| 3 | Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or modify it under |
| 6 | the terms of the GNU General Public License as published by the Free Software |
| 7 | Foundation; version 2 of the License. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 12 | |
| 13 | You should have received a copy of the GNU General Public License along with |
| 14 | this program; if not, write to the Free Software Foundation, Inc., |
| 15 | 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA |
| 16 | |
| 17 | *****************************************************************************/ |
| 18 | |
| 19 | /**************************************************//** |
| 20 | @file include/eval0eval.h |
| 21 | SQL evaluator: evaluates simple data structures, like expressions, in |
| 22 | a query graph |
| 23 | |
| 24 | Created 12/29/1997 Heikki Tuuri |
| 25 | *******************************************************/ |
| 26 | |
| 27 | #ifndef eval0eval_h |
| 28 | #define eval0eval_h |
| 29 | |
| 30 | #include "univ.i" |
| 31 | #include "que0types.h" |
| 32 | #include "pars0sym.h" |
| 33 | #include "pars0pars.h" |
| 34 | |
| 35 | /*****************************************************************//** |
| 36 | Free the buffer from global dynamic memory for a value of a que_node, |
| 37 | if it has been allocated in the above function. The freeing for pushed |
| 38 | column values is done in sel_col_prefetch_buf_free. */ |
| 39 | void |
| 40 | eval_node_free_val_buf( |
| 41 | /*===================*/ |
| 42 | que_node_t* node); /*!< in: query graph node */ |
| 43 | /*****************************************************************//** |
| 44 | Evaluates a symbol table symbol. */ |
| 45 | UNIV_INLINE |
| 46 | void |
| 47 | eval_sym( |
| 48 | /*=====*/ |
| 49 | sym_node_t* sym_node); /*!< in: symbol table node */ |
| 50 | /*****************************************************************//** |
| 51 | Evaluates an expression. */ |
| 52 | UNIV_INLINE |
| 53 | void |
| 54 | eval_exp( |
| 55 | /*=====*/ |
| 56 | que_node_t* exp_node); /*!< in: expression */ |
| 57 | /*****************************************************************//** |
| 58 | Sets an integer value as the value of an expression node. */ |
| 59 | UNIV_INLINE |
| 60 | void |
| 61 | eval_node_set_int_val( |
| 62 | /*==================*/ |
| 63 | que_node_t* node, /*!< in: expression node */ |
| 64 | lint val); /*!< in: value to set */ |
| 65 | /*****************************************************************//** |
| 66 | Gets an integer value from an expression node. |
| 67 | @return integer value */ |
| 68 | UNIV_INLINE |
| 69 | lint |
| 70 | eval_node_get_int_val( |
| 71 | /*==================*/ |
| 72 | que_node_t* node); /*!< in: expression node */ |
| 73 | /*****************************************************************//** |
| 74 | Copies a binary string value as the value of a query graph node. Allocates a |
| 75 | new buffer if necessary. */ |
| 76 | UNIV_INLINE |
| 77 | void |
| 78 | eval_node_copy_and_alloc_val( |
| 79 | /*=========================*/ |
| 80 | que_node_t* node, /*!< in: query graph node */ |
| 81 | const byte* str, /*!< in: binary string */ |
| 82 | ulint len); /*!< in: string length or UNIV_SQL_NULL */ |
| 83 | /*****************************************************************//** |
| 84 | Copies a query node value to another node. */ |
| 85 | UNIV_INLINE |
| 86 | void |
| 87 | eval_node_copy_val( |
| 88 | /*===============*/ |
| 89 | que_node_t* node1, /*!< in: node to copy to */ |
| 90 | que_node_t* node2); /*!< in: node to copy from */ |
| 91 | /*****************************************************************//** |
| 92 | Gets a iboolean value from a query node. |
| 93 | @return iboolean value */ |
| 94 | UNIV_INLINE |
| 95 | ibool |
| 96 | eval_node_get_ibool_val( |
| 97 | /*====================*/ |
| 98 | que_node_t* node); /*!< in: query graph node */ |
| 99 | /*****************************************************************//** |
| 100 | Evaluates a comparison node. |
| 101 | @return the result of the comparison */ |
| 102 | ibool |
| 103 | eval_cmp( |
| 104 | /*=====*/ |
| 105 | func_node_t* cmp_node); /*!< in: comparison node */ |
| 106 | |
| 107 | |
| 108 | #include "eval0eval.ic" |
| 109 | |
| 110 | #endif |
| 111 | |