26
25
#include "usr0sess.h"
28
/***********************************************************************//**
27
/***************************************************************************
29
28
Gets the trx of a query thread. */
34
que_thr_t* thr) /*!< in: query thread */
33
que_thr_t* thr) /* in: query thread */
38
37
return(thr->graph->trx);
41
/***********************************************************************//**
40
/***************************************************************************
42
41
Gets the first thr in a fork. */
45
44
que_fork_get_first_thr(
46
45
/*===================*/
47
que_fork_t* fork) /*!< in: query fork */
46
que_fork_t* fork) /* in: query fork */
49
48
return(UT_LIST_GET_FIRST(fork->thrs));
52
/***********************************************************************//**
51
/***************************************************************************
53
52
Gets the child node of the first thr in a fork. */
56
55
que_fork_get_child(
57
56
/*===============*/
58
que_fork_t* fork) /*!< in: query fork */
57
que_fork_t* fork) /* in: query fork */
64
63
return(thr->child);
67
/***********************************************************************//**
66
/***************************************************************************
68
67
Gets the type of a graph node. */
73
que_node_t* node) /*!< in: graph node */
72
que_node_t* node) /* in: graph node */
77
76
return(((que_common_t*)node)->type);
80
/***********************************************************************//**
79
/***************************************************************************
81
80
Gets pointer to the value dfield of a graph node. */
86
que_node_t* node) /*!< in: graph node */
85
que_node_t* node) /* in: graph node */
90
89
return(&(((que_common_t*)node)->val));
93
/***********************************************************************//**
94
Gets the value buffer size of a graph node.
95
@return val buffer size, not defined if val.data == NULL in node */
92
/***************************************************************************
93
Gets the value buffer size of a graph node. */
98
96
que_node_get_val_buf_size(
99
97
/*======================*/
100
que_node_t* node) /*!< in: graph node */
98
/* out: val buffer size, not defined if
99
val.data == NULL in node */
100
que_node_t* node) /* in: graph node */
104
104
return(((que_common_t*)node)->val_buf_size);
107
/***********************************************************************//**
107
/***************************************************************************
108
108
Sets the value buffer size of a graph node. */
111
111
que_node_set_val_buf_size(
112
112
/*======================*/
113
que_node_t* node, /*!< in: graph node */
114
ulint size) /*!< in: size */
113
que_node_t* node, /* in: graph node */
114
ulint size) /* in: size */
118
118
((que_common_t*)node)->val_buf_size = size;
121
/***********************************************************************//**
121
/***************************************************************************
122
122
Sets the parent of a graph node. */
125
125
que_node_set_parent(
126
126
/*================*/
127
que_node_t* node, /*!< in: graph node */
128
que_node_t* parent) /*!< in: parent */
127
que_node_t* node, /* in: graph node */
128
que_node_t* parent) /* in: parent */
132
132
((que_common_t*)node)->parent = parent;
135
/***********************************************************************//**
135
/***************************************************************************
136
136
Gets pointer to the value data type field of a graph node. */
139
139
que_node_get_data_type(
140
140
/*===================*/
141
que_node_t* node) /*!< in: graph node */
141
que_node_t* node) /* in: graph node */
145
145
return(dfield_get_type(&((que_common_t*) node)->val));
148
/*********************************************************************//**
149
Catenates a query graph node to a list of them, possible empty list.
150
@return one-way list of nodes */
148
/*************************************************************************
149
Catenates a query graph node to a list of them, possible empty list. */
153
152
que_node_list_add_last(
154
153
/*===================*/
155
que_node_t* node_list, /*!< in: node list, or NULL */
156
que_node_t* node) /*!< in: node */
154
/* out: one-way list of nodes */
155
que_node_t* node_list, /* in: node list, or NULL */
156
que_node_t* node) /* in: node */
158
158
que_common_t* cnode;
159
159
que_common_t* cnode2;
178
178
return(node_list);
181
/*********************************************************************//**
182
Gets the next list node in a list of query graph nodes.
183
@return next node in a list of nodes */
181
/*************************************************************************
182
Gets the next list node in a list of query graph nodes. */
186
185
que_node_get_next(
187
186
/*==============*/
188
que_node_t* node) /*!< in: node in a list */
187
/* out: next node in a list of nodes */
188
que_node_t* node) /* in: node in a list */
190
190
return(((que_common_t*)node)->brother);
193
/*********************************************************************//**
194
Gets a query graph node list length.
195
@return length, for NULL list 0 */
193
/*************************************************************************
194
Gets a query graph node list length. */
198
197
que_node_list_get_len(
199
198
/*==================*/
200
que_node_t* node_list) /*!< in: node list, or NULL */
199
/* out: length, for NULL list 0 */
200
que_node_t* node_list) /* in: node list, or NULL */
202
202
const que_common_t* cnode;
216
/*********************************************************************//**
217
Gets the parent node of a query graph node.
218
@return parent node or NULL */
216
/*************************************************************************
217
Gets the parent node of a query graph node. */
221
220
que_node_get_parent(
222
221
/*================*/
223
que_node_t* node) /*!< in: node */
222
/* out: parent node or NULL */
223
que_node_t* node) /* in: node */
225
225
return(((que_common_t*)node)->parent);
228
/**********************************************************************//**
228
/**************************************************************************
229
229
Checks if graph, trx, or session is in a state where the query thread should
231
@return TRUE if should be stopped; NOTE that if the peek is made
232
without reserving the kernel mutex, then another peek with the mutex
233
reserved is necessary before deciding the actual stopping */
236
233
que_thr_peek_stop(
237
234
/*==============*/
238
que_thr_t* thr) /*!< in: query thread */
235
/* out: TRUE if should be stopped; NOTE that
236
if the peek is made without reserving the
237
kernel mutex, then another peek with the
238
mutex reserved is necessary before deciding
239
the actual stopping */
240
que_thr_t* thr) /* in: query thread */
257
/***********************************************************************//**
258
Returns TRUE if the query graph is for a SELECT statement.
259
@return TRUE if a select */
259
/***************************************************************************
260
Returns TRUE if the query graph is for a SELECT statement. */
262
263
que_graph_is_select(
263
264
/*================*/
264
que_t* graph) /*!< in: graph */
265
/* out: TRUE if a select */
266
que_t* graph) /* in: graph */
266
268
if (graph->fork_type == QUE_FORK_SELECT_SCROLL
267
269
|| graph->fork_type == QUE_FORK_SELECT_NON_SCROLL) {