~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/select_result.h

Merged vcol stuff.

Show diffs side-by-side

added added

removed removed

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