837
by Brian Aker
Reworked some classes out of session.h |
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
|
|
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 |
||
20 |
||
21 |
#ifndef DRIZZLED_SELECT_RESULT_H
|
|
22 |
#define DRIZZLED_SELECT_RESULT_H
|
|
23 |
||
24 |
class select_result :public Sql_alloc { |
|
25 |
protected: |
|
26 |
Session *session; |
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
27 |
Select_Lex_Unit *unit; |
837
by Brian Aker
Reworked some classes out of session.h |
28 |
public: |
29 |
select_result() |
|
30 |
{
|
|
31 |
session= current_session; |
|
32 |
}
|
|
33 |
virtual ~select_result() {}; |
|
34 |
virtual int prepare(List<Item> &, |
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
35 |
Select_Lex_Unit *u) |
837
by Brian Aker
Reworked some classes out of session.h |
36 |
{
|
37 |
unit= u; |
|
38 |
return 0; |
|
39 |
}
|
|
40 |
/*
|
|
41 |
Because of peculiarities of prepared statements protocol
|
|
42 |
we need to know number of columns in the result set (if
|
|
43 |
there is a result set) apart from sending columns metadata.
|
|
44 |
*/
|
|
45 |
virtual uint32_t field_count(List<Item> &fields) const |
|
46 |
{ return fields.elements; } |
|
47 |
virtual bool send_fields(List<Item> &list, uint32_t flags)=0; |
|
48 |
virtual bool send_data(List<Item> &items)=0; |
|
49 |
virtual bool initialize_tables (JOIN *) |
|
50 |
{ return 0; } |
|
51 |
virtual bool send_eof()=0; |
|
52 |
virtual void abort() {} |
|
53 |
void set_session(Session *session_arg) { session= session_arg; } |
|
54 |
void begin_dataset() {} |
|
55 |
||
56 |
/*****************************************************************************
|
|
57 |
** Functions to provide a interface to select results
|
|
58 |
*****************************************************************************/
|
|
59 |
||
60 |
virtual void send_error(uint32_t errcode, const char *err) |
|
61 |
{
|
|
62 |
my_message(errcode, err, MYF(0)); |
|
63 |
}
|
|
64 |
||
65 |
/*
|
|
66 |
Cleanup instance of this class for next execution of a prepared
|
|
67 |
statement/stored procedure.
|
|
68 |
*/
|
|
69 |
virtual void cleanup() |
|
70 |
{
|
|
71 |
/* do nothing */
|
|
72 |
}
|
|
73 |
||
74 |
};
|
|
75 |
||
76 |
#endif /* DRIZZLED_SELECT_RESULT_H */ |