~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/function_engine/cursor.h

  • Committer: Monty Taylor
  • Date: 2010-03-11 18:27:20 UTC
  • mfrom: (1333 staging)
  • mto: This revision was merged to the branch mainline in revision 1348.
  • Revision ID: mordred@inaugust.com-20100311182720-hd1h87y6cb1b1mp0
Merged trunk.

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
 
 
28
class FunctionCursor: public drizzled::Cursor
 
29
{
 
30
  drizzled::plugin::TableFunction *tool;
 
31
  drizzled::plugin::TableFunction::Generator *generator;
 
32
  size_t record_id;
 
33
  std::vector<unsigned char *> row_cache;
 
34
  drizzled::ha_rows estimate_of_rows;
 
35
  drizzled::ha_rows rows_returned;
 
36
 
 
37
public:
 
38
  FunctionCursor(drizzled::plugin::StorageEngine &engine,
 
39
                 drizzled::TableShare &table_arg);
 
40
  ~FunctionCursor() {}
 
41
 
 
42
  int open(const char *name, int mode, uint32_t test_if_locked);
 
43
 
 
44
  int close(void);
 
45
 
 
46
  int rnd_init(bool scan);
 
47
 
 
48
  /* get the next row and copy it into buf */
 
49
  int rnd_next(unsigned char *buf);
 
50
 
 
51
  /* locate row pointed to by pos, copy it into buf */
 
52
  int rnd_pos(unsigned char *buf, unsigned char *pos);
 
53
 
 
54
  int rnd_end();
 
55
 
 
56
  /* record position of a record for reordering */
 
57
  void position(const unsigned char *record);
 
58
 
 
59
  int info(uint32_t flag);
 
60
 
 
61
  /**
 
62
   * @return an upper bound estimate for the number of rows in the table
 
63
   */
 
64
  drizzled::ha_rows estimate_rows_upper_bound()
 
65
  {
 
66
    return estimate_of_rows;
 
67
  }
 
68
};
 
69
 
 
70
#endif /* PLUGIN_FUNCTION_ENGINE_CURSOR_H */