~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/que0que.ic

  • Committer: Monty Taylor
  • Date: 2009-04-14 19:16:51 UTC
  • mto: (997.2.5 mordred)
  • mto: This revision was merged to the branch mainline in revision 994.
  • Revision ID: mordred@inaugust.com-20090414191651-ltbww6hpqks8k7qk
Clarified instructions in README.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
*****************************************************************************/
18
18
 
19
 
/**************************************************//**
20
 
@file include/que0que.ic
 
19
/******************************************************
21
20
Query graph
22
21
 
23
22
Created 5/27/1996 Heikki Tuuri
25
24
 
26
25
#include "usr0sess.h"
27
26
 
28
 
/***********************************************************************//**
 
27
/***************************************************************************
29
28
Gets the trx of a query thread. */
30
29
UNIV_INLINE
31
30
trx_t*
32
31
thr_get_trx(
33
32
/*========*/
34
 
        que_thr_t*      thr)    /*!< in: query thread */
 
33
        que_thr_t*      thr)    /* in: query thread */
35
34
{
36
35
        ut_ad(thr);
37
36
 
38
37
        return(thr->graph->trx);
39
38
}
40
39
 
41
 
/***********************************************************************//**
 
40
/***************************************************************************
42
41
Gets the first thr in a fork. */
43
42
UNIV_INLINE
44
43
que_thr_t*
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 */
48
47
{
49
48
        return(UT_LIST_GET_FIRST(fork->thrs));
50
49
}
51
50
 
52
 
/***********************************************************************//**
 
51
/***************************************************************************
53
52
Gets the child node of the first thr in a fork. */
54
53
UNIV_INLINE
55
54
que_node_t*
56
55
que_fork_get_child(
57
56
/*===============*/
58
 
        que_fork_t*     fork)   /*!< in: query fork */
 
57
        que_fork_t*     fork)   /* in: query fork */
59
58
{
60
59
        que_thr_t*      thr;
61
60
 
64
63
        return(thr->child);
65
64
}
66
65
 
67
 
/***********************************************************************//**
 
66
/***************************************************************************
68
67
Gets the type of a graph node. */
69
68
UNIV_INLINE
70
69
ulint
71
70
que_node_get_type(
72
71
/*==============*/
73
 
        que_node_t*     node)   /*!< in: graph node */
 
72
        que_node_t*     node)   /* in: graph node */
74
73
{
75
74
        ut_ad(node);
76
75
 
77
76
        return(((que_common_t*)node)->type);
78
77
}
79
78
 
80
 
/***********************************************************************//**
 
79
/***************************************************************************
81
80
Gets pointer to the value dfield of a graph node. */
82
81
UNIV_INLINE
83
82
dfield_t*
84
83
que_node_get_val(
85
84
/*=============*/
86
 
        que_node_t*     node)   /*!< in: graph node */
 
85
        que_node_t*     node)   /* in: graph node */
87
86
{
88
87
        ut_ad(node);
89
88
 
90
89
        return(&(((que_common_t*)node)->val));
91
90
}
92
91
 
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. */
96
94
UNIV_INLINE
97
95
ulint
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 */
101
101
{
102
102
        ut_ad(node);
103
103
 
104
104
        return(((que_common_t*)node)->val_buf_size);
105
105
}
106
106
 
107
 
/***********************************************************************//**
 
107
/***************************************************************************
108
108
Sets the value buffer size of a graph node. */
109
109
UNIV_INLINE
110
110
void
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 */
115
115
{
116
116
        ut_ad(node);
117
117
 
118
118
        ((que_common_t*)node)->val_buf_size = size;
119
119
}
120
120
 
121
 
/***********************************************************************//**
 
121
/***************************************************************************
122
122
Sets the parent of a graph node. */
123
123
UNIV_INLINE
124
124
void
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 */
129
129
{
130
130
        ut_ad(node);
131
131
 
132
132
        ((que_common_t*)node)->parent = parent;
133
133
}
134
134
 
135
 
/***********************************************************************//**
 
135
/***************************************************************************
136
136
Gets pointer to the value data type field of a graph node. */
137
137
UNIV_INLINE
138
138
dtype_t*
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 */
142
142
{
143
143
        ut_ad(node);
144
144
 
145
145
        return(dfield_get_type(&((que_common_t*) node)->val));
146
146
}
147
147
 
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. */
151
150
UNIV_INLINE
152
151
que_node_t*
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 */
157
157
{
158
158
        que_common_t*   cnode;
159
159
        que_common_t*   cnode2;
178
178
        return(node_list);
179
179
}
180
180
 
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. */
184
183
UNIV_INLINE
185
184
que_node_t*
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 */
189
189
{
190
190
        return(((que_common_t*)node)->brother);
191
191
}
192
192
 
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. */
196
195
UNIV_INLINE
197
196
ulint
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 */
201
201
{
202
202
        const que_common_t*     cnode;
203
203
        ulint                   len;
213
213
        return(len);
214
214
}
215
215
 
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. */
219
218
UNIV_INLINE
220
219
que_node_t*
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 */
224
224
{
225
225
        return(((que_common_t*)node)->parent);
226
226
}
227
227
 
228
 
/**********************************************************************//**
 
228
/**************************************************************************
229
229
Checks if graph, trx, or session is in a state where the query thread should
230
 
be stopped.
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 */
 
230
be stopped. */
234
231
UNIV_INLINE
235
232
ibool
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 */
239
241
{
240
242
        trx_t*  trx;
241
243
        que_t*  graph;
254
256
        return(FALSE);
255
257
}
256
258
 
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. */
260
261
UNIV_INLINE
261
262
ibool
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 */
265
267
{
266
268
        if (graph->fork_type == QUE_FORK_SELECT_SCROLL
267
269
            || graph->fork_type == QUE_FORK_SELECT_NON_SCROLL) {