1
/******************************************************
6
Created 5/27/1996 Heikki Tuuri
7
*******************************************************/
11
/***************************************************************************
12
Gets the trx of a query thread. */
17
que_thr_t* thr) /* in: query thread */
21
return(thr->graph->trx);
24
/***************************************************************************
25
Gets the first thr in a fork. */
28
que_fork_get_first_thr(
29
/*===================*/
30
que_fork_t* fork) /* in: query fork */
32
return(UT_LIST_GET_FIRST(fork->thrs));
35
/***************************************************************************
36
Gets the child node of the first thr in a fork. */
41
que_fork_t* fork) /* in: query fork */
45
thr = UT_LIST_GET_FIRST(fork->thrs);
50
/***************************************************************************
51
Gets the type of a graph node. */
56
que_node_t* node) /* in: graph node */
60
return(((que_common_t*)node)->type);
63
/***************************************************************************
64
Gets pointer to the value dfield of a graph node. */
69
que_node_t* node) /* in: graph node */
73
return(&(((que_common_t*)node)->val));
76
/***************************************************************************
77
Gets the value buffer size of a graph node. */
80
que_node_get_val_buf_size(
81
/*======================*/
82
/* out: val buffer size, not defined if
83
val.data == NULL in node */
84
que_node_t* node) /* in: graph node */
88
return(((que_common_t*)node)->val_buf_size);
91
/***************************************************************************
92
Sets the value buffer size of a graph node. */
95
que_node_set_val_buf_size(
96
/*======================*/
97
que_node_t* node, /* in: graph node */
98
ulint size) /* in: size */
102
((que_common_t*)node)->val_buf_size = size;
105
/***************************************************************************
106
Sets the parent of a graph node. */
111
que_node_t* node, /* in: graph node */
112
que_node_t* parent) /* in: parent */
116
((que_common_t*)node)->parent = parent;
119
/***************************************************************************
120
Gets pointer to the value data type field of a graph node. */
123
que_node_get_data_type(
124
/*===================*/
125
que_node_t* node) /* in: graph node */
129
return(&(((que_common_t*)node)->val.type));
132
/*************************************************************************
133
Catenates a query graph node to a list of them, possible empty list. */
136
que_node_list_add_last(
137
/*===================*/
138
/* out: one-way list of nodes */
139
que_node_t* node_list, /* in: node list, or NULL */
140
que_node_t* node) /* in: node */
143
que_common_t* cnode2;
147
cnode->brother = NULL;
149
if (node_list == NULL) {
156
while (cnode2->brother != NULL) {
157
cnode2 = cnode2->brother;
160
cnode2->brother = node;
165
/*************************************************************************
166
Gets the next list node in a list of query graph nodes. */
171
/* out: next node in a list of nodes */
172
que_node_t* node) /* in: node in a list */
174
return(((que_common_t*)node)->brother);
177
/*************************************************************************
178
Gets a query graph node list length. */
181
que_node_list_get_len(
182
/*==================*/
183
/* out: length, for NULL list 0 */
184
que_node_t* node_list) /* in: node list, or NULL */
192
while (cnode != NULL) {
194
cnode = cnode->brother;
200
/*************************************************************************
201
Gets the parent node of a query graph node. */
206
/* out: parent node or NULL */
207
que_node_t* node) /* in: node */
209
return(((que_common_t*)node)->parent);
212
/**************************************************************************
213
Checks if graph, trx, or session is in a state where the query thread should
219
/* out: TRUE if should be stopped; NOTE that
220
if the peek is made without reserving the
221
kernel mutex, then another peek with the
222
mutex reserved is necessary before deciding
223
the actual stopping */
224
que_thr_t* thr) /* in: query thread */
232
if (graph->state != QUE_FORK_ACTIVE
233
|| trx->que_state == TRX_QUE_LOCK_WAIT
234
|| (UT_LIST_GET_LEN(trx->signals) > 0
235
&& trx->que_state == TRX_QUE_RUNNING)) {
242
/***************************************************************************
243
Returns TRUE if the query graph is for a SELECT statement. */
248
/* out: TRUE if a select */
249
que_t* graph) /* in: graph */
251
if (graph->fork_type == QUE_FORK_SELECT_SCROLL
252
|| graph->fork_type == QUE_FORK_SELECT_NON_SCROLL) {