~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/row0sel.ic

Merge Stewart's dead code removal

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (C) 1997, 2009, Innobase Oy. All Rights Reserved.
4
 
 
5
 
This program is free software; you can redistribute it and/or modify it under
6
 
the terms of the GNU General Public License as published by the Free Software
7
 
Foundation; version 2 of the License.
8
 
 
9
 
This program is distributed in the hope that it will be useful, but WITHOUT
10
 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
 
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
 
 
13
 
You should have received a copy of the GNU General Public License along with
14
 
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
 
St, Fifth Floor, Boston, MA 02110-1301 USA
16
 
 
17
 
*****************************************************************************/
18
 
 
19
 
/**************************************************//**
20
 
@file include/row0sel.ic
21
 
Select
22
 
 
23
 
Created 12/19/1997 Heikki Tuuri
24
 
*******************************************************/
25
 
 
26
 
#include "que0que.h"
27
 
 
28
 
/*********************************************************************//**
29
 
Gets the plan node for the nth table in a join.
30
 
@return plan node */
31
 
UNIV_INLINE
32
 
plan_t*
33
 
sel_node_get_nth_plan(
34
 
/*==================*/
35
 
        sel_node_t*     node,   /*!< in: select node */
36
 
        ulint           i)      /*!< in: get ith plan node */
37
 
{
38
 
        ut_ad(i < node->n_tables);
39
 
 
40
 
        return(node->plans + i);
41
 
}
42
 
 
43
 
/*********************************************************************//**
44
 
Resets the cursor defined by sel_node to the SEL_NODE_OPEN state, which means
45
 
that it will start fetching from the start of the result set again, regardless
46
 
of where it was before, and it will set intention locks on the tables. */
47
 
UNIV_INLINE
48
 
void
49
 
sel_node_reset_cursor(
50
 
/*==================*/
51
 
        sel_node_t*     node)   /*!< in: select node */
52
 
{
53
 
        node->state = SEL_NODE_OPEN;
54
 
}
55
 
 
56
 
/**********************************************************************//**
57
 
Performs an execution step of an open or close cursor statement node.
58
 
@return query thread to run next or NULL */
59
 
UNIV_INLINE
60
 
que_thr_t*
61
 
open_step(
62
 
/*======*/
63
 
        que_thr_t*      thr)    /*!< in: query thread */
64
 
{
65
 
        sel_node_t*     sel_node;
66
 
        open_node_t*    node;
67
 
        ulint           err;
68
 
 
69
 
        ut_ad(thr);
70
 
 
71
 
        node = (open_node_t*) thr->run_node;
72
 
        ut_ad(que_node_get_type(node) == QUE_NODE_OPEN);
73
 
 
74
 
        sel_node = node->cursor_def;
75
 
 
76
 
        err = DB_SUCCESS;
77
 
 
78
 
        if (node->op_type == ROW_SEL_OPEN_CURSOR) {
79
 
 
80
 
                /*              if (sel_node->state == SEL_NODE_CLOSED) { */
81
 
 
82
 
                sel_node_reset_cursor(sel_node);
83
 
                /*              } else {
84
 
                err = DB_ERROR;
85
 
                } */
86
 
        } else {
87
 
                if (sel_node->state != SEL_NODE_CLOSED) {
88
 
 
89
 
                        sel_node->state = SEL_NODE_CLOSED;
90
 
                } else {
91
 
                        err = DB_ERROR;
92
 
                }
93
 
        }
94
 
 
95
 
        if (UNIV_EXPECT(err, DB_SUCCESS) != DB_SUCCESS) {
96
 
                /* SQL error detected */
97
 
                fprintf(stderr, "SQL error %lu\n", (ulong) err);
98
 
 
99
 
                ut_error;
100
 
        }
101
 
 
102
 
        thr->run_node = que_node_get_parent(node);
103
 
 
104
 
        return(thr);
105
 
}