16
16
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
#include <drizzled/table.h>
21
#include <drizzled/error.h>
22
#include "drizzled/internal/my_pthread.h"
21
24
#include "tableprototester.h"
31
#include <drizzled/message/table.pb.h>
32
#include "drizzled/internal/m_string.h"
29
#include <drizzled/error.h>
30
#include <drizzled/global_charset_info.h>
31
#include <drizzled/internal/m_string.h>
32
#include <drizzled/internal/my_pthread.h>
33
#include <drizzled/message/table.h>
34
#include <drizzled/plugin/storage_engine.h>
35
#include <drizzled/table.h>
34
#include "drizzled/global_charset_info.h"
38
37
using namespace std;
70
69
int doCreateTable(Session&,
72
const drizzled::identifier::Table &identifier,
71
const drizzled::TableIdentifier &identifier,
73
72
drizzled::message::Table&);
75
int doDropTable(Session&, const drizzled::identifier::Table &identifier);
74
int doDropTable(Session&, const drizzled::TableIdentifier &identifier);
77
76
int doGetTableDefinition(Session &session,
78
const drizzled::identifier::Table &identifier,
77
const drizzled::TableIdentifier &identifier,
79
78
drizzled::message::Table &table_proto);
80
void doGetTableNames(drizzled::CachedDirectory &directory,
81
const SchemaIdentifier &,
82
set<string>& set_of_names)
85
set_of_names.insert("t1");
81
89
/* The following defines can be increased if necessary */
82
90
uint32_t max_supported_keys() const { return 64; }
83
91
uint32_t max_supported_key_length() const { return 1000; }
95
bool doDoesTableExist(Session &session, const drizzled::identifier::Table &identifier);
103
bool doDoesTableExist(Session &session, const drizzled::TableIdentifier &identifier);
97
int doRenameTable(Session&, const drizzled::identifier::Table&, const drizzled::identifier::Table&)
105
int doRenameTable(Session&, const drizzled::TableIdentifier&, const drizzled::TableIdentifier&)
99
return HA_ERR_NO_SUCH_TABLE;
102
110
void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
103
const drizzled::identifier::Schema &schema_identifier,
104
drizzled::identifier::Table::vector &set_of_identifiers);
111
const drizzled::SchemaIdentifier &schema_identifier,
112
drizzled::TableIdentifiers &set_of_identifiers);
107
115
void TableProtoTesterEngine::doGetTableIdentifiers(drizzled::CachedDirectory&,
108
const drizzled::identifier::Schema &schema_identifier,
109
drizzled::identifier::Table::vector &set_of_identifiers)
116
const drizzled::SchemaIdentifier &schema_identifier,
117
drizzled::TableIdentifiers &set_of_identifiers)
111
119
if (schema_identifier.compare("test"))
113
set_of_identifiers.push_back(identifier::Table(schema_identifier, "t1"));
114
set_of_identifiers.push_back(identifier::Table(schema_identifier, "too_many_enum_values"));
115
set_of_identifiers.push_back(identifier::Table(schema_identifier, "invalid_table_collation"));
121
set_of_identifiers.push_back(TableIdentifier(schema_identifier, "t1"));
122
set_of_identifiers.push_back(TableIdentifier(schema_identifier, "too_many_enum_values"));
123
set_of_identifiers.push_back(TableIdentifier(schema_identifier, "invalid_table_collation"));
119
bool TableProtoTesterEngine::doDoesTableExist(Session&, const drizzled::identifier::Table &identifier)
127
bool TableProtoTesterEngine::doDoesTableExist(Session&, const drizzled::TableIdentifier &identifier)
121
if (not identifier.getPath().compare("test/t1"))
123
if (not identifier.getPath().compare("test/too_many_enum_values"))
125
if (not identifier.getPath().compare("test/invalid_table_collation"))
129
if (not identifier.getPath().compare("./test/t1"))
131
if (not identifier.getPath().compare("./test/too_many_enum_values"))
133
if (not identifier.getPath().compare("./test/invalid_table_collation"))
131
139
TableProtoTesterCursor::TableProtoTesterCursor(drizzled::plugin::StorageEngine &engine_arg,
140
TableShare &table_arg) :
133
141
Cursor(engine_arg, table_arg)
146
154
int TableProtoTesterEngine::doCreateTable(Session&,
148
const drizzled::identifier::Table&,
156
const drizzled::TableIdentifier&,
149
157
drizzled::message::Table&)
155
int TableProtoTesterEngine::doDropTable(Session&, const drizzled::identifier::Table&)
163
int TableProtoTesterEngine::doDropTable(Session&, const drizzled::TableIdentifier&)
157
return HA_ERR_NO_SUCH_TABLE;
160
168
static void fill_table1(message::Table &table)
238
246
int TableProtoTesterEngine::doGetTableDefinition(Session&,
239
const drizzled::identifier::Table &identifier,
247
const drizzled::TableIdentifier &identifier,
240
248
drizzled::message::Table &table_proto)
242
if (not identifier.getPath().compare("test/t1"))
250
if (not identifier.getPath().compare("./test/t1"))
244
252
fill_table1(table_proto);
247
else if (not identifier.getPath().compare("test/too_many_enum_values"))
255
else if (not identifier.getPath().compare("./test/too_many_enum_values"))
249
257
fill_table_too_many_enum_values(table_proto);
252
else if (not identifier.getPath().compare("test/invalid_table_collation"))
260
else if (not identifier.getPath().compare("./test/invalid_table_collation"))
254
262
fill_table_invalid_table_collation(table_proto);
365
373
"Used to test rest of server with various table proto messages",
366
374
PLUGIN_LICENSE_GPL,
367
375
tableprototester_init, /* Plugin Init */
376
NULL, /* system variables */
369
377
NULL /* config options */
371
379
DRIZZLE_DECLARE_PLUGIN_END;