2154.2.17
by Brian Aker
Additional removal of session |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 Sun Microsystems, Inc.
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; version 2 of the License.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
*/
|
|
19 |
||
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
20 |
#include <config.h> |
2154.2.17
by Brian Aker
Additional removal of session |
21 |
|
22 |
#include <drizzled/select_dumpvar.h> |
|
23 |
#include <drizzled/sql_lex.h> |
|
24 |
#include <drizzled/session.h> |
|
2241.2.11
by Olaf van der Spek
Refactor |
25 |
#include <drizzled/var.h> |
2154.2.17
by Brian Aker
Additional removal of session |
26 |
|
27 |
namespace drizzled { |
|
28 |
||
29 |
bool select_dumpvar::send_data(List<Item> &items) |
|
30 |
{
|
|
31 |
if (unit->offset_limit_cnt) |
|
32 |
{ // using limit offset,count |
|
33 |
unit->offset_limit_cnt--; |
|
2318.6.58
by Olaf van der Spek
Refactor |
34 |
return 0; |
2154.2.17
by Brian Aker
Additional removal of session |
35 |
}
|
36 |
if (row_count++) |
|
37 |
{
|
|
38 |
my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0)); |
|
2318.6.77
by Olaf van der Spek
Refactor |
39 |
return 1; |
2154.2.17
by Brian Aker
Additional removal of session |
40 |
}
|
2456.1.2
by Olaf van der Spek
Refactor |
41 |
List<Item>::iterator it(items.begin()); |
42 |
BOOST_FOREACH(var* current_var, var_list) |
|
2154.2.17
by Brian Aker
Additional removal of session |
43 |
{
|
2456.1.2
by Olaf van der Spek
Refactor |
44 |
Item* item= it++; |
45 |
if (not item) |
|
46 |
break; |
|
47 |
if (current_var->local) |
|
48 |
continue; |
|
49 |
Item_func_set_user_var *suv= new Item_func_set_user_var(current_var->s, item); |
|
50 |
suv->fix_fields(session, 0); |
|
51 |
suv->check(0); |
|
52 |
suv->update(); |
|
2154.2.17
by Brian Aker
Additional removal of session |
53 |
}
|
2456.1.2
by Olaf van der Spek
Refactor |
54 |
return session->is_error(); |
2154.2.17
by Brian Aker
Additional removal of session |
55 |
}
|
56 |
||
57 |
bool select_dumpvar::send_eof() |
|
58 |
{
|
|
2456.1.2
by Olaf van der Spek
Refactor |
59 |
if (not row_count) |
60 |
push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_SP_FETCH_NO_DATA, ER(ER_SP_FETCH_NO_DATA)); |
|
2154.2.17
by Brian Aker
Additional removal of session |
61 |
/*
|
62 |
In order to remember the value of affected rows for ROW_COUNT()
|
|
63 |
function, SELECT INTO has to have an own SQLCOM.
|
|
64 |
@TODO split from SQLCOM_SELECT
|
|
65 |
*/
|
|
66 |
session->my_ok(row_count); |
|
67 |
return 0; |
|
68 |
}
|
|
69 |
||
70 |
int select_dumpvar::prepare(List<Item> &list, Select_Lex_Unit *u) |
|
71 |
{
|
|
72 |
unit= u; |
|
2456.1.2
by Olaf van der Spek
Refactor |
73 |
if (var_list.size() == list.size()) |
74 |
return 0; |
|
75 |
my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT, ER(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT), MYF(0)); |
|
76 |
return 1; |
|
2154.2.17
by Brian Aker
Additional removal of session |
77 |
}
|
78 |
||
79 |
} // namespace drizzled |