1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
*
* Copyright (C) 2008 Sun Microsystems
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DRIZZLED_SELECT_RESULT_H
#define DRIZZLED_SELECT_RESULT_H
namespace drizzled
{
class JOIN;
class select_result :public memory::SqlAlloc {
protected:
Session *session;
Select_Lex_Unit *unit;
public:
select_result()
{
session= current_session;
}
virtual ~select_result() {};
virtual int prepare(List<Item> &,
Select_Lex_Unit *u)
{
unit= u;
return 0;
}
/*
Because of peculiarities of prepared statements protocol
we need to know number of columns in the result set (if
there is a result set) apart from sending columns metadata.
*/
virtual uint32_t field_count(List<Item> &fields) const
{ return fields.elements; }
virtual bool send_fields(List<Item> &list)=0;
virtual bool send_data(List<Item> &items)=0;
virtual bool initialize_tables (JOIN *)
{ return 0; }
virtual bool send_eof()=0;
virtual void abort() {}
void set_session(Session *session_arg) { session= session_arg; }
void begin_dataset() {}
/*****************************************************************************
** Functions to provide a interface to select results
*****************************************************************************/
virtual void send_error(uint32_t errcode, const char *err);
/*
Cleanup instance of this class for next execution of a prepared
statement/stored procedure.
*/
virtual void cleanup()
{
/* do nothing */
}
};
} /* namespace drizzled */
#endif /* DRIZZLED_SELECT_RESULT_H */
|