1 /*****************************************************************************
2 
3 Copyright (c) 1996, 2009, Oracle and/or its affiliates. All Rights Reserved.
4 Copyright (c) 2019, MariaDB Corporation.
5 
6 This program is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free Software
8 Foundation; version 2 of the License.
9 
10 This program is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License along with
15 this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
17 
18 *****************************************************************************/
19 
20 /**************************************************//**
21 @file include/que0types.h
22 Query graph global types
23 
24 Created 5/27/1996 Heikki Tuuri
25 *******************************************************/
26 
27 #ifndef que0types_h
28 #define que0types_h
29 
30 #include "data0data.h"
31 
32 /* Pseudotype for all graph nodes */
33 typedef void	que_node_t;
34 
35 /* Query graph root is a fork node */
36 typedef	struct que_fork_t	que_t;
37 
38 struct que_thr_t;
39 
40 /* Query graph node types */
41 #define	QUE_NODE_LOCK		1
42 #define	QUE_NODE_INSERT		2
43 #define QUE_NODE_UPDATE		4
44 #define	QUE_NODE_CURSOR		5
45 #define	QUE_NODE_SELECT		6
46 #define	QUE_NODE_AGGREGATE	7
47 #define QUE_NODE_FORK		8
48 #define QUE_NODE_THR		9
49 #define QUE_NODE_UNDO		10
50 #define QUE_NODE_COMMIT		11
51 #define QUE_NODE_ROLLBACK	12
52 #define QUE_NODE_PURGE		13
53 #define QUE_NODE_CREATE_TABLE	14
54 #define QUE_NODE_CREATE_INDEX	15
55 #define QUE_NODE_SYMBOL		16
56 #define QUE_NODE_RES_WORD	17
57 #define QUE_NODE_FUNC		18
58 #define QUE_NODE_ORDER		19
59 #define QUE_NODE_PROC		(20 + QUE_NODE_CONTROL_STAT)
60 #define QUE_NODE_IF		(21 + QUE_NODE_CONTROL_STAT)
61 #define QUE_NODE_WHILE		(22 + QUE_NODE_CONTROL_STAT)
62 #define QUE_NODE_ASSIGNMENT	23
63 #define QUE_NODE_FETCH		24
64 #define QUE_NODE_OPEN		25
65 #define QUE_NODE_COL_ASSIGNMENT	26
66 #define QUE_NODE_FOR		(27 + QUE_NODE_CONTROL_STAT)
67 #define QUE_NODE_RETURN		28
68 #define QUE_NODE_ROW_PRINTF	29
69 #define QUE_NODE_ELSIF		30
70 #define QUE_NODE_CALL		31
71 #define QUE_NODE_EXIT		32
72 
73 /* Common struct at the beginning of each query graph node; the name of this
74 substruct must be 'common' */
75 
76 struct que_common_t{
77 	ulint		type;	/*!< query node type */
78 	que_node_t*	parent;	/*!< back pointer to parent node, or NULL */
79 	que_node_t*	brother;/* pointer to a possible brother node */
80 	dfield_t	val;	/*!< evaluated value for an expression */
81 	ulint		val_buf_size;
82 				/* buffer size for the evaluated value data,
83 				if the buffer has been allocated dynamically:
84 				if this field is != 0, and the node is a
85 				symbol node or a function node, then we
86 				have to free the data field in val
87 				explicitly */
88 
89 	/** Constructor */
que_common_tque_common_t90 	que_common_t(ulint type, que_node_t* parent) :
91 		type(type), parent(parent), brother(NULL),
92 		val(), val_buf_size(0)
93 	{}
94 };
95 
96 #endif
97