1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
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.
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.
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
21
#ifndef DRIZZLED_SELECT_DUMPVAR_H
22
#define DRIZZLED_SELECT_DUMPVAR_H
24
#include <drizzled/error.h>
28
class select_dumpvar :public select_result_interceptor {
31
std::vector<my_var *> var_list;
32
select_dumpvar() { var_list.clear(); row_count= 0;}
35
int prepare(List<Item> &list, Select_Lex_Unit *u)
39
if (var_list.size() != list.elements)
41
my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,
42
ER(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT), MYF(0));
54
bool send_data(List<Item> &items)
57
std::vector<my_var *>::const_iterator iter= var_list.begin();
59
List_iterator<Item> it(items);
63
if (unit->offset_limit_cnt)
64
{ // using limit offset,count
65
unit->offset_limit_cnt--;
70
my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0));
73
while ((iter != var_list.end()) && (item= it++))
76
if (current_var->local == 0)
78
Item_func_set_user_var *suv= new Item_func_set_user_var(current_var->s, item);
79
suv->fix_fields(session, 0);
85
return(session->is_error());
91
push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
92
ER_SP_FETCH_NO_DATA, ER(ER_SP_FETCH_NO_DATA));
94
In order to remember the value of affected rows for ROW_COUNT()
95
function, SELECT INTO has to have an own SQLCOM.
96
TODO: split from SQLCOM_SELECT
98
session->my_ok(row_count);
104
#endif /* DRIZZLED_SELECT_DUMPVAR_H */