drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
select_result.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, 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
20
21#pragma once
22
23#include <drizzled/current_session.h>
24
25namespace drizzled {
26
27class select_result :public memory::SqlAlloc {
28protected:
29 Session *session;
30 Select_Lex_Unit *unit;
31
32public:
33 select_result()
34 {
35 session= current_session;
36 }
37 virtual ~select_result() {}
38 virtual int prepare(List<Item> &,
39 Select_Lex_Unit *u)
40 {
41 unit= u;
42 return 0;
43 }
44 /*
45 Because of peculiarities of prepared statements protocol
46 we need to know number of columns in the result set (if
47 there is a result set) apart from sending columns metadata.
48 */
49 virtual uint32_t field_count(List<Item> &fields) const
50 { return fields.size(); }
51 virtual void send_fields(List<Item>&)=0;
52 virtual bool send_data(List<Item>&)=0;
53 virtual bool initialize_tables(Join*)
54 { return 0; }
55 virtual bool send_eof()=0;
56 virtual void abort() {}
57 void set_session(Session *session_arg) { session= session_arg; }
58 void begin_dataset() {}
59
60 /*****************************************************************************
61 ** Functions to provide a interface to select results
62 *****************************************************************************/
63
64 virtual void send_error(drizzled::error_t errcode, const char *err);
65
66 /*
67 Cleanup instance of this class for next execution of a prepared
68 statement/stored procedure.
69 */
70 virtual void cleanup()
71 {
72 /* do nothing */
73 }
74
75};
76
77} /* namespace drizzled */
78
TODO: Rename this file - func.h is stupid.