~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/information_engine/information_engine.h

Updating Padraig's work for I_S

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include <drizzled/server_includes.h>
21
21
#include <drizzled/cursor.h>
22
22
#include <mysys/thr_lock.h>
 
23
 
23
24
#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
 
  drizzled::plugin::InfoSchemaTable::Rows::iterator iter;
34
 
 
35
 
public:
36
 
  InformationCursor(drizzled::plugin::StorageEngine *engine, TableShare *table_arg);
37
 
  ~InformationCursor()
38
 
  {}
39
 
 
40
 
  /*
41
 
    The name of the index type that will be used for display
42
 
    don't implement this method unless you really have indexes
43
 
  */
44
 
  uint64_t table_flags() const
45
 
  {
46
 
    return 0;
47
 
  }
48
 
  uint32_t index_flags(uint32_t inx, uint32_t part, bool all_parts) const;
49
 
  /* The following defines can be increased if necessary */
50
 
  int open(const char *name, int mode, uint32_t test_if_locked);
51
 
  int close(void);
52
 
  int rnd_init(bool scan);
53
 
  int rnd_next(unsigned char *buf);
54
 
  int rnd_pos(unsigned char * buf, unsigned char *pos);
55
 
  void position(const unsigned char *record);
56
 
  int info(uint32_t flag);
57
 
  THR_LOCK_DATA **store_lock(Session *session,
58
 
                             THR_LOCK_DATA **to,
59
 
                             enum thr_lock_type lock_type);
60
 
};
61
 
 
62
 
static const char *InformationEngine_exts[] = {
63
 
  NULL
64
 
};
 
25
#include "information_cursor.h"
65
26
 
66
27
class InformationEngine : public drizzled::plugin::StorageEngine
67
28
{
 
29
private:
 
30
  typedef std::map<const std::string, InformationShare> OpenTables;
 
31
  typedef std::pair<const std::string, InformationShare> Record;
 
32
 
 
33
  OpenTables open_tables;
 
34
  pthread_mutex_t mutex; // Mutext used in getShare() calls
 
35
 
68
36
public:
69
37
  InformationEngine(const std::string &name_arg)
70
38
   : drizzled::plugin::StorageEngine(name_arg,
71
39
                                     HTON_FILE_BASED
72
40
                                      | HTON_HAS_DATA_DICTIONARY) 
73
 
  {}
 
41
  {
 
42
    pthread_mutex_init(&mutex, NULL);
 
43
  }
 
44
 
 
45
  ~InformationEngine()
 
46
  {
 
47
    pthread_mutex_destroy(&mutex);
 
48
  }
 
49
 
 
50
  // Follow Two Methods are for "share"
 
51
  InformationShare *getShare(const std::string &name_arg);
 
52
  void freeShare(InformationShare *share);
 
53
 
74
54
 
75
55
  int doCreateTable(Session *,
76
56
                    const char *,
91
71
    return new (mem_root) InformationCursor(this, table);
92
72
  }
93
73
 
94
 
  const char **bas_ext() const {
95
 
    return InformationEngine_exts;
 
74
  const char **bas_ext() const 
 
75
  {
 
76
    return NULL;
96
77
  }
97
78
 
98
 
  void doGetTableNames(CachedDirectory&, std::string& db, std::set<std::string>& set_of_names);
 
79
  void doGetTableNames(CachedDirectory&, 
 
80
                       std::string &db, 
 
81
                       std::set<std::string> &set_of_names);
 
82
 
 
83
  int doGetTableDefinition(Session &session,
 
84
                           const char *path,
 
85
                           const char *db,
 
86
                           const char *table_name,
 
87
                           const bool is_tmp,
 
88
                           drizzled::message::Table *table_proto);
 
89
 
99
90
};
100
91
 
101
92
#endif /* PLUGIN_INFORMATION_ENGINE_INFORMATION_ENGINE_H */