1273.20.1
by Brian Aker
Basic engine with test. |
1 |
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2010 Brian Aker
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; either version 2 of the License, or
|
|
9 |
* (at your option) any later version.
|
|
10 |
*
|
|
11 |
* This program is distributed in the hope that it will be useful,
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License
|
|
17 |
* along with this program; if not, write to the Free Software
|
|
18 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
19 |
*/
|
|
20 |
||
21 |
#ifndef PLUGIN_SCHEMA_ENGINE_SCHEMA_H
|
|
22 |
#define PLUGIN_SCHEMA_ENGINE_SCHEMA_H
|
|
23 |
||
24 |
#include <assert.h> |
|
25 |
#include <drizzled/plugin/storage_engine.h> |
|
1678.1.1
by Monty Taylor
Removed our unordered wrappers. We use Boost now. |
26 |
#include <boost/unordered_map.hpp> |
1755.2.6
by Brian Aker
Remove usage of non-boost lock type. |
27 |
#include <boost/thread/shared_mutex.hpp> |
1273.20.1
by Brian Aker
Basic engine with test. |
28 |
|
29 |
extern const drizzled::CHARSET_INFO *default_charset_info; |
|
30 |
||
31 |
static const char *schema_exts[] = { |
|
32 |
NULL
|
|
33 |
};
|
|
34 |
||
35 |
class Schema : public drizzled::plugin::StorageEngine |
|
36 |
{
|
|
1642
by Brian Aker
This adds const to SchemaIdentifier. |
37 |
bool writeSchemaFile(const drizzled::SchemaIdentifier &schema_identifier, const drizzled::message::Schema &db); |
1749.3.14
by Brian Aker
Update to use the identifier (and not the straight filename). |
38 |
bool readSchemaFile(const drizzled::SchemaIdentifier &schema_identifier, drizzled::message::Schema &schema); |
1309.1.3
by Brian Aker
Cache for Schema. |
39 |
|
40 |
void prime(); |
|
41 |
||
1812.3.8
by Brian Aker
This switches our schema system over to using a shared ptr. Lets see how |
42 |
typedef boost::unordered_map<std::string, drizzled::message::SchemaPtr> SchemaCache; |
1309.1.3
by Brian Aker
Cache for Schema. |
43 |
SchemaCache schema_cache; |
44 |
bool schema_cache_filled; |
|
45 |
||
1755.2.6
by Brian Aker
Remove usage of non-boost lock type. |
46 |
boost::shared_mutex mutex; |
1273.19.27
by Brian Aker
Move schema writing code to schema engine plugin. |
47 |
|
1273.20.1
by Brian Aker
Basic engine with test. |
48 |
public: |
49 |
Schema(); |
|
50 |
||
1309.1.3
by Brian Aker
Cache for Schema. |
51 |
~Schema(); |
1273.20.1
by Brian Aker
Basic engine with test. |
52 |
|
1309.1.30
by Brian Aker
Simplify dropTable() (will add exceptions right now) |
53 |
|
1618.1.1
by Brian Aker
Modify TableIdentifier to be const |
54 |
bool doCanCreateTable(const drizzled::TableIdentifier &identifier); |
1320.1.8
by Brian Aker
Temporary fix for allowing engines to say "don't do this". |
55 |
|
1869.1.4
by Brian Aker
TableShare is no longer in the house (i.e. we no longer directly have a copy |
56 |
drizzled::Cursor *create(drizzled::Table &) |
1273.20.1
by Brian Aker
Basic engine with test. |
57 |
{
|
58 |
return NULL; |
|
59 |
}
|
|
60 |
||
1643.3.3
by Brian Aker
Updated to harmonize the identifier API. |
61 |
void doGetSchemaIdentifiers(drizzled::SchemaIdentifiers &set_of_names); |
1812.3.8
by Brian Aker
This switches our schema system over to using a shared ptr. Lets see how |
62 |
bool doGetSchemaDefinition(const drizzled::SchemaIdentifier&, drizzled::message::SchemaPtr &proto); |
1273.20.1
by Brian Aker
Basic engine with test. |
63 |
|
1856.2.8
by Joseph Daly
working alter, drop, create schema |
64 |
bool doCreateSchema(const drizzled::message::Schema &schema_message); |
1273.19.25
by Brian Aker
createSchema() now works via SE interface. |
65 |
|
1273.19.26
by Brian Aker
Move Alter schema to SE interface. |
66 |
bool doAlterSchema(const drizzled::message::Schema &schema_message); |
67 |
||
1642
by Brian Aker
This adds const to SchemaIdentifier. |
68 |
bool doDropSchema(const drizzled::SchemaIdentifier&); |
1273.19.31
by Brian Aker
Fix dropSchema(). |
69 |
|
1412
by Brian Aker
Innodb is now in the house (aka... it handls its own DFE). |
70 |
// Below are table methods that we don't implement (and don't need)
|
71 |
||
72 |
int doGetTableDefinition(drizzled::Session&, |
|
1618.1.1
by Brian Aker
Modify TableIdentifier to be const |
73 |
const drizzled::TableIdentifier&, |
1412
by Brian Aker
Innodb is now in the house (aka... it handls its own DFE). |
74 |
drizzled::message::Table&) |
75 |
{
|
|
76 |
return ENOENT; |
|
77 |
}
|
|
78 |
||
1618.1.1
by Brian Aker
Modify TableIdentifier to be const |
79 |
bool doDoesTableExist(drizzled::Session&, const drizzled::TableIdentifier&) |
1412
by Brian Aker
Innodb is now in the house (aka... it handls its own DFE). |
80 |
{
|
81 |
return false; |
|
82 |
}
|
|
83 |
||
1618.1.1
by Brian Aker
Modify TableIdentifier to be const |
84 |
int doRenameTable(drizzled::Session&, const drizzled::TableIdentifier&, const drizzled::TableIdentifier&) |
1412
by Brian Aker
Innodb is now in the house (aka... it handls its own DFE). |
85 |
{
|
86 |
return EPERM; |
|
87 |
}
|
|
88 |
||
1413
by Brian Aker
doCreateTable() was still taking a pointer instead of a session reference. |
89 |
int doCreateTable(drizzled::Session&, |
1412
by Brian Aker
Innodb is now in the house (aka... it handls its own DFE). |
90 |
drizzled::Table&, |
1618.1.1
by Brian Aker
Modify TableIdentifier to be const |
91 |
const drizzled::TableIdentifier&, |
1412
by Brian Aker
Innodb is now in the house (aka... it handls its own DFE). |
92 |
drizzled::message::Table&) |
93 |
{
|
|
94 |
return EPERM; |
|
95 |
}
|
|
96 |
||
1618.1.1
by Brian Aker
Modify TableIdentifier to be const |
97 |
int doDropTable(drizzled::Session&, const drizzled::TableIdentifier&) |
1412
by Brian Aker
Innodb is now in the house (aka... it handls its own DFE). |
98 |
{
|
99 |
return 0; |
|
1389
by Brian Aker
Large reord in ALTER TABLE for RENAME. |
100 |
}
|
101 |
||
1273.20.1
by Brian Aker
Basic engine with test. |
102 |
const char **bas_ext() const |
103 |
{
|
|
104 |
return schema_exts; |
|
105 |
}
|
|
1429.1.3
by Brian Aker
Merge in work for fetching a list of table identifiers. |
106 |
|
1377.7.2
by Stewart Smith
make get_auto_increment pure virtual and force engines not supporting auto_increment to be explicit about it |
107 |
void get_auto_increment(uint64_t, uint64_t, |
108 |
uint64_t, |
|
109 |
uint64_t *, |
|
110 |
uint64_t *) |
|
111 |
{}
|
|
1429.1.3
by Brian Aker
Merge in work for fetching a list of table identifiers. |
112 |
void doGetTableIdentifiers(drizzled::CachedDirectory &directory, |
1642
by Brian Aker
This adds const to SchemaIdentifier. |
113 |
const drizzled::SchemaIdentifier &schema_identifier, |
1429.1.3
by Brian Aker
Merge in work for fetching a list of table identifiers. |
114 |
drizzled::TableIdentifiers &set_of_identifiers); |
1273.20.1
by Brian Aker
Basic engine with test. |
115 |
};
|
116 |
||
117 |
#endif /* PLUGIN_SCHEMA_ENGINE_SCHEMA_H */ |