~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/memory/ha_heap.cc

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
#include <drizzled/error.h>
18
18
#include <drizzled/table.h>
19
19
#include <drizzled/session.h>
20
 
#include <drizzled/field/timestamp.h>
21
20
#include <drizzled/field/varstring.h>
22
 
#include "drizzled/plugin/daemon.h"
 
21
#include <drizzled/plugin/daemon.h>
 
22
#include <drizzled/plugin/storage_engine.h>
23
23
 
24
24
#include <boost/thread/mutex.hpp>
25
25
 
71
71
 
72
72
  int doCreateTable(Session &session,
73
73
                    Table &table_arg,
74
 
                    const TableIdentifier &identifier,
 
74
                    const identifier::Table &identifier,
75
75
                    message::Table &create_proto);
76
76
 
77
77
  /* For whatever reason, internal tables can be created by Cursor::open()
85
85
                        message::Table &create_proto,
86
86
                        HP_SHARE **internal_share);
87
87
 
88
 
  int doRenameTable(Session&, const TableIdentifier &from, const TableIdentifier &to);
 
88
  int doRenameTable(Session&, const identifier::Table &from, const identifier::Table &to);
89
89
 
90
 
  int doDropTable(Session&, const TableIdentifier &identifier);
 
90
  int doDropTable(Session&, const identifier::Table &identifier);
91
91
 
92
92
  int doGetTableDefinition(Session& session,
93
 
                           const TableIdentifier &identifier,
 
93
                           const identifier::Table &identifier,
94
94
                           message::Table &table_message);
95
95
 
96
96
  uint32_t max_supported_keys()          const { return MAX_KEY; }
101
101
    return ( HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR);
102
102
  }
103
103
 
104
 
  bool doDoesTableExist(Session& session, const TableIdentifier &identifier);
 
104
  bool doDoesTableExist(Session& session, const identifier::Table &identifier);
105
105
  void doGetTableIdentifiers(CachedDirectory &directory,
106
 
                             const SchemaIdentifier &schema_identifier,
107
 
                             TableIdentifiers &set_of_identifiers);
 
106
                             const identifier::Schema &schema_identifier,
 
107
                             identifier::Table::vector &set_of_identifiers);
108
108
};
109
109
 
110
110
void HeapEngine::doGetTableIdentifiers(CachedDirectory&,
111
 
                                       const SchemaIdentifier&,
112
 
                                       TableIdentifiers&)
 
111
                                       const identifier::Schema&,
 
112
                                       identifier::Table::vector&)
113
113
{
114
114
}
115
115
 
116
 
bool HeapEngine::doDoesTableExist(Session& session, const TableIdentifier &identifier)
 
116
bool HeapEngine::doDoesTableExist(Session& session, const identifier::Table &identifier)
117
117
{
118
118
  return session.getMessageCache().doesTableMessageExist(identifier);
119
119
}
120
120
 
121
121
int HeapEngine::doGetTableDefinition(Session &session,
122
 
                                     const TableIdentifier &identifier,
 
122
                                     const identifier::Table &identifier,
123
123
                                     message::Table &table_proto)
124
124
{
125
125
  if (session.getMessageCache().getTableMessage(identifier, table_proto))
131
131
  We have to ignore ENOENT entries as the MEMORY table is created on open and
132
132
  not when doing a CREATE on the table.
133
133
*/
134
 
int HeapEngine::doDropTable(Session &session, const TableIdentifier &identifier)
 
134
int HeapEngine::doDropTable(Session &session, const identifier::Table &identifier)
135
135
{
136
136
  session.getMessageCache().removeTableMessage(identifier);
137
137
 
176
176
*/
177
177
#define MEMORY_STATS_UPDATE_THRESHOLD 10
178
178
 
179
 
int ha_heap::doOpen(const drizzled::TableIdentifier &identifier, int mode, uint32_t test_if_locked)
 
179
int ha_heap::doOpen(const drizzled::identifier::Table &identifier, int mode, uint32_t test_if_locked)
180
180
{
181
181
  if ((test_if_locked & HA_OPEN_INTERNAL_TABLE) || (!(file= heap_open(identifier.getPath().c_str(), mode)) && errno == ENOENT))
182
182
  {
241
241
Cursor *ha_heap::clone(memory::Root *)
242
242
{
243
243
  Cursor *new_handler= getTable()->getMutableShare()->db_type()->getCursor(*getTable());
244
 
  TableIdentifier identifier(getTable()->getShare()->getSchemaName(),
 
244
  identifier::Table identifier(getTable()->getShare()->getSchemaName(),
245
245
                             getTable()->getShare()->getTableName(),
246
246
                             getTable()->getShare()->getPath());
247
247
 
624
624
}
625
625
 
626
626
 
627
 
int HeapEngine::doRenameTable(Session &session, const TableIdentifier &from, const TableIdentifier &to)
 
627
int HeapEngine::doRenameTable(Session &session, const identifier::Table &from, const identifier::Table &to)
628
628
{
629
629
  session.getMessageCache().renameTableMessage(from, to);
630
630
  return heap_rename(from.getPath().c_str(), to.getPath().c_str());
653
653
 
654
654
int HeapEngine::doCreateTable(Session &session,
655
655
                              Table &table_arg,
656
 
                              const TableIdentifier &identifier,
 
656
                              const identifier::Table &identifier,
657
657
                              message::Table& create_proto)
658
658
{
659
659
  int error;
770
770
        auto_key= key+ 1;
771
771
        auto_key_type= field->key_type();
772
772
      }
773
 
      if ((uint)field->field_index + 1 > max_key_fieldnr)
 
773
      if ((uint)field->position() + 1 > max_key_fieldnr)
774
774
      {
775
775
        /* Do not use seg->fieldnr as it's not reliable in case of temp tables */
776
 
        max_key_fieldnr= field->field_index + 1;
 
776
        max_key_fieldnr= field->position() + 1;
777
777
      }
778
778
    }
779
779
  }
840
840
  "Hash based, stored in memory, useful for temporary tables",
841
841
  PLUGIN_LICENSE_GPL,
842
842
  heap_init,
843
 
  NULL,                       /* system variables                */
 
843
  NULL,                       /* depends */
844
844
  NULL                        /* config options                  */
845
845
}
846
846
DRIZZLE_DECLARE_PLUGIN_END;