~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/tableprototester/tableprototester.cc

  • Committer: Lee Bieber
  • Date: 2011-03-29 22:31:41 UTC
  • mfrom: (2257.1.3 build)
  • Revision ID: kalebral@gmail.com-20110329223141-yxc22h3l2he58sk0
Merge Andrew - 743842: Build failure using GCC 4.6
Merge Stewart - 738022: CachedDirectory silently fails to add entries if stat() fails
Merge Olaf - Common fwd: add copyright, add more declaration

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17
17
*/
18
18
 
19
 
#include "config.h"
20
 
#include <drizzled/table.h>
21
 
#include <drizzled/error.h>
22
 
#include "drizzled/internal/my_pthread.h"
 
19
#include <config.h>
23
20
 
24
21
#include "tableprototester.h"
25
22
 
28
25
#include <string>
29
26
#include <map>
30
27
#include <fstream>
31
 
#include <drizzled/message/table.pb.h>
32
 
#include "drizzled/internal/m_string.h"
33
28
 
34
 
#include "drizzled/global_charset_info.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>
35
36
 
36
37
 
37
38
using namespace std;
68
69
 
69
70
  int doCreateTable(Session&,
70
71
                    Table&,
71
 
                    const drizzled::TableIdentifier &identifier,
72
 
                    drizzled::message::Table&);
 
72
                    const drizzled::identifier::Table &identifier,
 
73
                    const drizzled::message::Table&);
73
74
 
74
 
  int doDropTable(Session&, const drizzled::TableIdentifier &identifier);
 
75
  int doDropTable(Session&, const drizzled::identifier::Table &identifier);
75
76
 
76
77
  int doGetTableDefinition(Session &session,
77
 
                           const drizzled::TableIdentifier &identifier,
 
78
                           const drizzled::identifier::Table &identifier,
78
79
                           drizzled::message::Table &table_proto);
79
80
 
80
81
  /* The following defines can be increased if necessary */
91
92
            HA_KEYREAD_ONLY);
92
93
  }
93
94
 
94
 
  bool doDoesTableExist(Session &session, const drizzled::TableIdentifier &identifier);
 
95
  bool doDoesTableExist(Session &session, const drizzled::identifier::Table &identifier);
95
96
 
96
 
  int doRenameTable(Session&, const drizzled::TableIdentifier&, const drizzled::TableIdentifier&)
 
97
  int doRenameTable(Session&, const drizzled::identifier::Table&, const drizzled::identifier::Table&)
97
98
  {
98
 
    return EPERM;
 
99
    return HA_ERR_NO_SUCH_TABLE;
99
100
  }
100
101
 
101
102
  void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
102
 
                             const drizzled::SchemaIdentifier &schema_identifier,
103
 
                             drizzled::TableIdentifier::vector &set_of_identifiers);
 
103
                             const drizzled::identifier::Schema &schema_identifier,
 
104
                             drizzled::identifier::table::vector &set_of_identifiers);
104
105
};
105
106
 
106
107
void TableProtoTesterEngine::doGetTableIdentifiers(drizzled::CachedDirectory&,
107
 
                                                   const drizzled::SchemaIdentifier &schema_identifier,
108
 
                                                   drizzled::TableIdentifier::vector &set_of_identifiers)
 
108
                                                   const drizzled::identifier::Schema &schema_identifier,
 
109
                                                   drizzled::identifier::table::vector &set_of_identifiers)
109
110
{
110
111
  if (schema_identifier.compare("test"))
111
112
  {
112
 
    set_of_identifiers.push_back(TableIdentifier(schema_identifier, "t1"));
113
 
    set_of_identifiers.push_back(TableIdentifier(schema_identifier, "too_many_enum_values"));
114
 
    set_of_identifiers.push_back(TableIdentifier(schema_identifier, "invalid_table_collation"));
 
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"));
115
116
  }
116
117
}
117
118
 
118
 
bool TableProtoTesterEngine::doDoesTableExist(Session&, const drizzled::TableIdentifier &identifier)
 
119
bool TableProtoTesterEngine::doDoesTableExist(Session&, const drizzled::identifier::Table &identifier)
119
120
{
120
121
  if (not identifier.getPath().compare("test/t1"))
121
122
    return true;
144
145
 
145
146
int TableProtoTesterEngine::doCreateTable(Session&,
146
147
                                          Table&,
147
 
                                          const drizzled::TableIdentifier&,
148
 
                                          drizzled::message::Table&)
 
148
                                          const drizzled::identifier::Table&,
 
149
                                          const drizzled::message::Table&)
149
150
{
150
151
  return EEXIST;
151
152
}
152
153
 
153
154
 
154
 
int TableProtoTesterEngine::doDropTable(Session&, const drizzled::TableIdentifier&)
 
155
int TableProtoTesterEngine::doDropTable(Session&, const drizzled::identifier::Table&)
155
156
{
156
 
  return EPERM;
 
157
  return HA_ERR_NO_SUCH_TABLE;
157
158
}
158
159
 
159
160
static void fill_table1(message::Table &table)
235
236
}
236
237
 
237
238
int TableProtoTesterEngine::doGetTableDefinition(Session&,
238
 
                                                 const drizzled::TableIdentifier &identifier,
 
239
                                                 const drizzled::identifier::Table &identifier,
239
240
                                                 drizzled::message::Table &table_proto)
240
241
{
241
242
  if (not identifier.getPath().compare("test/t1"))
364
365
  "Used to test rest of server with various table proto messages",
365
366
  PLUGIN_LICENSE_GPL,
366
367
  tableprototester_init,     /* Plugin Init */
367
 
  NULL,               /* system variables */
 
368
  NULL,               /* depends */
368
369
  NULL                /* config options   */
369
370
}
370
371
DRIZZLE_DECLARE_PLUGIN_END;