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