| 1 |
/***************************************************************************** |
| 2 |
|
| 3 |
Copyright (c) 1997, 2026, Oracle and/or its affiliates. |
| 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, version 2.0, as published by the |
| 7 |
Free Software Foundation. |
| 8 |
|
| 9 |
This program is designed to work with certain software (including |
| 10 |
but not limited to OpenSSL) that is licensed under separate terms, |
| 11 |
as designated in a particular file or component or in included license |
| 12 |
documentation. The authors of MySQL hereby grant you an additional |
| 13 |
permission to link the program and your derivative works with the |
| 14 |
separately licensed software that they have either included with |
| 15 |
the program or referenced in the documentation. |
| 16 |
|
| 17 |
This program is distributed in the hope that it will be useful, but WITHOUT |
| 18 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 19 |
FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0, |
| 20 |
for more details. |
| 21 |
|
| 22 |
You should have received a copy of the GNU General Public License along with |
| 23 |
this program; if not, write to the Free Software Foundation, Inc., |
| 24 |
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 25 |
|
| 26 |
*****************************************************************************/ |
| 27 |
|
| 28 |
/** @file include/eval0eval.h |
| 29 |
SQL evaluator: evaluates simple data structures, like expressions, in |
| 30 |
a query graph |
| 31 |
|
| 32 |
Created 12/29/1997 Heikki Tuuri |
| 33 |
*******************************************************/ |
| 34 |
|
| 35 |
#ifndef eval0eval_h |
| 36 |
#define eval0eval_h |
| 37 |
|
| 38 |
#include "pars0pars.h" |
| 39 |
#include "pars0sym.h" |
| 40 |
#include "que0types.h" |
| 41 |
#include "univ.i" |
| 42 |
|
| 43 |
/** Free the buffer from global dynamic memory for a value of a que_node, |
| 44 |
if it has been allocated in the above function. The freeing for pushed |
| 45 |
column values is done in sel_col_prefetch_buf_free. */ |
| 46 |
void eval_node_free_val_buf(que_node_t *node); /*!< in: query graph node */ |
| 47 |
/** Evaluates a symbol table symbol. */ |
| 48 |
static inline void eval_sym(sym_node_t *sym_node); /*!< in: symbol table node */ |
| 49 |
/** Evaluates an expression. */ |
| 50 |
static inline void eval_exp(que_node_t *exp_node); /*!< in: expression */ |
| 51 |
|
| 52 |
/** Sets an integer value as the value of an expression node. |
| 53 |
@param[in] node expression node |
| 54 |
@param[in] val value to set */ |
| 55 |
static inline void eval_node_set_int_val(que_node_t *node, lint val); |
| 56 |
|
| 57 |
/** Gets an integer value from an expression node. |
| 58 |
@return integer value */ |
| 59 |
static inline lint eval_node_get_int_val( |
| 60 |
que_node_t *node); /*!< in: expression node */ |
| 61 |
|
| 62 |
/** Copies a binary string value as the value of a query graph node. Allocates |
| 63 |
a new buffer if necessary. |
| 64 |
@param[in] node query graph node |
| 65 |
@param[in] str binary string |
| 66 |
@param[in] len string length or UNIV_SQL_NULL */ |
| 67 |
static inline void eval_node_copy_and_alloc_val(que_node_t *node, |
| 68 |
const byte *str, ulint len); |
| 69 |
|
| 70 |
/** Copies a query node value to another node. |
| 71 |
@param[in] node1 node to copy to |
| 72 |
@param[in] node2 node to copy from */ |
| 73 |
static inline void eval_node_copy_val(que_node_t *node1, que_node_t *node2); |
| 74 |
|
| 75 |
/** Gets a boolean value from a query node. |
| 76 |
@return boolean value */ |
| 77 |
static inline bool eval_node_get_bool_val( |
| 78 |
que_node_t *node); /*!< in: query graph node */ |
| 79 |
/** Evaluates a comparison node. |
| 80 |
@return the result of the comparison */ |
| 81 |
bool eval_cmp(func_node_t *cmp_node); /*!< in: comparison node */ |
| 82 |
|
| 83 |
#include "eval0eval.ic" |
| 84 |
|
| 85 |
#endif |