~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/memory/ha_heap.cc

  • Committer: Brian Aker
  • Date: 2011-02-05 10:53:26 UTC
  • mto: (2147.3.1 alter-table)
  • mto: This revision was merged to the branch mainline in revision 2148.
  • Revision ID: brian@tangent.org-20110205105326-hjmn5xehw5rs46tp
Fix bad error in warnings/errors.

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