~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/information_engine/information_engine.h

  • Committer: Brian Aker
  • Date: 2009-10-30 15:58:06 UTC
  • mfrom: (1183.1.30 merge)
  • Revision ID: brian@gaz-20091030155806-bq7mu2f5ljtodn0h
Merge Brian

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2005 MySQL AB
 
2
 
 
3
  This program is free software; you can redistribute it and/or modify
 
4
  it under the terms of the GNU General Public License as published by
 
5
  the Free Software Foundation; version 2 of the License.
 
6
 
 
7
  This program is distributed in the hope that it will be useful,
 
8
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
  GNU General Public License for more details.
 
11
 
 
12
  You should have received a copy of the GNU General Public License
 
13
  along with this program; if not, write to the Free Software
 
14
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
 
 
16
 
 
17
#ifndef PLUGIN_INFORMATION_ENGINE_INFORMATION_ENGINE_H
 
18
#define PLUGIN_INFORMATION_ENGINE_INFORMATION_ENGINE_H
 
19
 
 
20
#include <drizzled/server_includes.h>
 
21
#include <drizzled/cursor.h>
 
22
#include <mysys/thr_lock.h>
 
23
#include "information_share.h"
 
24
 
 
25
 
 
26
/*
 
27
  Class definition for the information engine
 
28
*/
 
29
class InformationCursor: public Cursor
 
30
{
 
31
  THR_LOCK_DATA lock;      /* MySQL lock */
 
32
  InformationShare *share;
 
33
 
 
34
public:
 
35
  InformationCursor(drizzled::plugin::StorageEngine *engine, TableShare *table_arg);
 
36
  ~InformationCursor()
 
37
  {}
 
38
 
 
39
  /*
 
40
    The name of the index type that will be used for display
 
41
    don't implement this method unless you really have indexes
 
42
  */
 
43
  uint64_t table_flags() const
 
44
  {
 
45
    return 0;
 
46
  }
 
47
  uint32_t index_flags(uint32_t inx, uint32_t part, bool all_parts) const;
 
48
  /* The following defines can be increased if necessary */
 
49
  int open(const char *name, int mode, uint32_t test_if_locked);
 
50
  int close(void);
 
51
  int rnd_init(bool scan);
 
52
  int rnd_next(unsigned char *buf);
 
53
  int rnd_pos(unsigned char * buf, unsigned char *pos);
 
54
  void position(const unsigned char *record);
 
55
  int info(uint32_t flag);
 
56
  THR_LOCK_DATA **store_lock(Session *session,
 
57
                             THR_LOCK_DATA **to,
 
58
                             enum thr_lock_type lock_type);
 
59
};
 
60
 
 
61
static const char *InformationEngine_exts[] = {
 
62
  NULL
 
63
};
 
64
 
 
65
class InformationEngine : public drizzled::plugin::StorageEngine
 
66
{
 
67
public:
 
68
  InformationEngine(const std::string &name_arg)
 
69
   : drizzled::plugin::StorageEngine(name_arg,
 
70
                                     HTON_FILE_BASED
 
71
                                      | HTON_HAS_DATA_DICTIONARY) 
 
72
  {}
 
73
 
 
74
  int doCreateTable(Session *,
 
75
                    const char *,
 
76
                    Table&,
 
77
                    HA_CREATE_INFO&,
 
78
                    drizzled::message::Table&)
 
79
  {
 
80
    return 1;
 
81
  }
 
82
 
 
83
  int doDropTable(Session&, const std::string) 
 
84
  { 
 
85
    return 0; 
 
86
  }
 
87
 
 
88
  virtual Cursor *create(TableShare *table, MEM_ROOT *mem_root)
 
89
  {
 
90
    return new (mem_root) InformationCursor(this, table);
 
91
  }
 
92
 
 
93
  const char **bas_ext() const {
 
94
    return InformationEngine_exts;
 
95
  }
 
96
 
 
97
  void doGetTableNames(CachedDirectory&, std::string& db, std::set<std::string>& set_of_names);
 
98
};
 
99
 
 
100
#endif /* PLUGIN_INFORMATION_ENGINE_INFORMATION_ENGINE_H */