18
18
#include <drizzled/table.h>
19
19
#include <drizzled/session.h>
20
20
#include <drizzled/field/varstring.h>
21
#include <drizzled/plugin/daemon.h>
22
#include <drizzled/plugin/storage_engine.h>
21
#include "drizzled/plugin/daemon.h"
24
23
#include <boost/thread/mutex.hpp>
72
71
int doCreateTable(Session &session,
74
const identifier::Table &identifier,
73
const TableIdentifier &identifier,
75
74
message::Table &create_proto);
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);
88
int doRenameTable(Session&, const identifier::Table &from, const identifier::Table &to);
87
int doRenameTable(Session&, const TableIdentifier &from, const TableIdentifier &to);
90
int doDropTable(Session&, const identifier::Table &identifier);
89
int doDropTable(Session&, const TableIdentifier &identifier);
92
91
int doGetTableDefinition(Session& session,
93
const identifier::Table &identifier,
92
const TableIdentifier &identifier,
94
93
message::Table &table_message);
96
95
uint32_t max_supported_keys() const { return MAX_KEY; }
101
100
return ( HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR);
104
bool doDoesTableExist(Session& session, const identifier::Table &identifier);
103
bool doDoesTableExist(Session& session, const TableIdentifier &identifier);
105
104
void doGetTableIdentifiers(CachedDirectory &directory,
106
const identifier::Schema &schema_identifier,
107
identifier::Table::vector &set_of_identifiers);
105
const SchemaIdentifier &schema_identifier,
106
TableIdentifier::vector &set_of_identifiers);
110
109
void HeapEngine::doGetTableIdentifiers(CachedDirectory&,
111
const identifier::Schema&,
112
identifier::Table::vector&)
110
const SchemaIdentifier&,
111
TableIdentifier::vector&)
116
bool HeapEngine::doDoesTableExist(Session& session, const identifier::Table &identifier)
115
bool HeapEngine::doDoesTableExist(Session& session, const TableIdentifier &identifier)
118
117
return session.getMessageCache().doesTableMessageExist(identifier);
121
120
int HeapEngine::doGetTableDefinition(Session &session,
122
const identifier::Table &identifier,
121
const TableIdentifier &identifier,
123
122
message::Table &table_proto)
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.
134
int HeapEngine::doDropTable(Session &session, const identifier::Table &identifier)
133
int HeapEngine::doDropTable(Session &session, const TableIdentifier &identifier)
136
135
session.getMessageCache().removeTableMessage(identifier);
177
176
#define MEMORY_STATS_UPDATE_THRESHOLD 10
179
int ha_heap::doOpen(const drizzled::identifier::Table &identifier, int mode, uint32_t test_if_locked)
178
int ha_heap::doOpen(const drizzled::TableIdentifier &identifier, int mode, uint32_t test_if_locked)
181
180
if ((test_if_locked & HA_OPEN_INTERNAL_TABLE) || (!(file= heap_open(identifier.getPath().c_str(), mode)) && errno == ENOENT))
241
240
Cursor *ha_heap::clone(memory::Root *)
243
242
Cursor *new_handler= getTable()->getMutableShare()->db_type()->getCursor(*getTable());
244
identifier::Table identifier(getTable()->getShare()->getSchemaName(),
243
TableIdentifier identifier(getTable()->getShare()->getSchemaName(),
245
244
getTable()->getShare()->getTableName(),
246
245
getTable()->getShare()->getPath());
627
int HeapEngine::doRenameTable(Session &session, const identifier::Table &from, const identifier::Table &to)
626
int HeapEngine::doRenameTable(Session &session, const TableIdentifier &from, const TableIdentifier &to)
629
628
session.getMessageCache().renameTableMessage(from, to);
630
629
return heap_rename(from.getPath().c_str(), to.getPath().c_str());
654
653
int HeapEngine::doCreateTable(Session &session,
655
654
Table &table_arg,
656
const identifier::Table &identifier,
655
const TableIdentifier &identifier,
657
656
message::Table& create_proto)
840
839
"Hash based, stored in memory, useful for temporary tables",
841
840
PLUGIN_LICENSE_GPL,
842
NULL, /* system variables */
844
843
NULL /* config options */
846
845
DRIZZLE_DECLARE_PLUGIN_END;