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