~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/function_engine/cursor.h

  • Committer: Mats Kindahl
  • Date: 2008-08-26 07:32:59 UTC
  • mto: (489.1.2 codestyle)
  • mto: This revision was merged to the branch mainline in revision 491.
  • Revision ID: mats@mysql.com-20080826073259-9k4evtajgldgolli
Replaced use of thd_proc_info() macro with calls to
set_proc_info() and get_proc_info() internally.  Introduced
functions set_thd_proc_info() and get_thd_proc_info() for
external users, i.e., plug-ins.

The set_thd_proc_info() accepted callers info that can be used to
print debug output, but the information was not used. The return
value was changed to void and the old value is not fetched any
more. To be able to get the value of proc_info for external
users, the function get_thd_proc_info() was introduced.

The thd_proc_info() macro called set_thd_proc_info() but almost
never used the return value of set_thd_proc_info() so the macro
was replaced with a call of THD::set_proc_info().

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) 2009 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; either version 2 of the License, or
9
 
 *  (at your option) any later version.
10
 
 *
11
 
 *  This program is distributed in the hope that it will be useful,
12
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
 *  GNU General Public License for more details.
15
 
 *
16
 
 *  You should have received a copy of the GNU General Public License
17
 
 *  along with this program; if not, write to the Free Software
18
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 
 */
20
 
 
21
 
#ifndef PLUGIN_FUNCTION_ENGINE_CURSOR_H
22
 
#define PLUGIN_FUNCTION_ENGINE_CURSOR_H
23
 
 
24
 
#include <drizzled/cursor.h>
25
 
 
26
 
#include <plugin/function_engine/function.h>
27
 
#include <drizzled/base.h>
28
 
 
29
 
class FunctionCursor: public drizzled::Cursor
30
 
{
31
 
  drizzled::plugin::TableFunction *tool;
32
 
  drizzled::plugin::TableFunction::Generator *generator;
33
 
  size_t record_id;
34
 
  std::vector<unsigned char *> row_cache;
35
 
  drizzled::ha_rows estimate_of_rows;
36
 
  drizzled::ha_rows rows_returned;
37
 
 
38
 
  void wipeCache();
39
 
 
40
 
public:
41
 
  FunctionCursor(drizzled::plugin::StorageEngine &engine,
42
 
                 drizzled::Table &table_arg);
43
 
  ~FunctionCursor() {}
44
 
 
45
 
  int open(const char *name, int mode, uint32_t test_if_locked);
46
 
 
47
 
  int close(void);
48
 
 
49
 
  int reset()
50
 
  {
51
 
    return extra(drizzled::HA_EXTRA_RESET_STATE);
52
 
  }
53
 
 
54
 
  int doStartTableScan(bool scan);
55
 
 
56
 
  /* get the next row and copy it into buf */
57
 
  int rnd_next(unsigned char *buf);
58
 
 
59
 
  /* locate row pointed to by pos, copy it into buf */
60
 
  int rnd_pos(unsigned char *buf, unsigned char *pos);
61
 
 
62
 
  int doEndTableScan();
63
 
 
64
 
  int extra(enum drizzled::ha_extra_function);
65
 
 
66
 
  /* record position of a record for reordering */
67
 
  void position(const unsigned char *record);
68
 
 
69
 
  int info(uint32_t flag);
70
 
 
71
 
  /**
72
 
   * @return an upper bound estimate for the number of rows in the table
73
 
   */
74
 
  drizzled::ha_rows estimate_rows_upper_bound()
75
 
  {
76
 
    return estimate_of_rows;
77
 
  }
78
 
 
79
 
  void get_auto_increment(uint64_t, uint64_t,
80
 
                          uint64_t,
81
 
                          uint64_t *,
82
 
                          uint64_t *)
83
 
  {}
84
 
};
85
 
 
86
 
#endif /* PLUGIN_FUNCTION_ENGINE_CURSOR_H */