~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/csv/ha_tina.cc

  • Committer: Brian Aker
  • Date: 2011-01-12 06:45:23 UTC
  • mto: (2073.1.4 catalogs)
  • mto: This revision was merged to the branch mainline in revision 2080.
  • Revision ID: brian@tangent.org-20110112064523-rqhptaqbph22qmj1
RemoveĀ customĀ error.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
 
41
41
 -Brian
42
42
*/
43
 
#include <config.h>
 
43
#include "config.h"
44
44
#include <drizzled/field.h>
45
45
#include <drizzled/field/blob.h>
46
46
#include <drizzled/error.h>
47
47
#include <drizzled/table.h>
48
48
#include <drizzled/session.h>
49
 
#include <drizzled/internal/my_sys.h>
 
49
#include "drizzled/internal/my_sys.h"
50
50
 
51
51
#include "ha_tina.h"
52
52
 
63
63
/*
64
64
  unsigned char + unsigned char + uint64_t + uint64_t + uint64_t + uint64_t + unsigned char
65
65
*/
66
 
static const int META_BUFFER_SIZE = sizeof(unsigned char) + sizeof(unsigned char) + sizeof(uint64_t)
67
 
  + sizeof(uint64_t) + sizeof(uint64_t) + sizeof(uint64_t) + sizeof(unsigned char);
68
 
static const int TINA_CHECK_HEADER = 254; // The number we use to determine corruption
69
 
static const int BLOB_MEMROOT_ALLOC_SIZE = 8192;
 
66
#define META_BUFFER_SIZE sizeof(unsigned char) + sizeof(unsigned char) + sizeof(uint64_t) \
 
67
  + sizeof(uint64_t) + sizeof(uint64_t) + sizeof(uint64_t) + sizeof(unsigned char)
 
68
#define TINA_CHECK_HEADER 254 // The number we use to determine corruption
 
69
#define BLOB_MEMROOT_ALLOC_SIZE 8192
70
70
 
71
71
/* The file extension */
72
 
static const char* CSV_EXT = ".CSV"               // The data file
73
 
static const char* CSN_EXT = ".CSN"               // Files used during repair and update
74
 
static const char* CSM_EXT = ".CSM"               // Meta file
 
72
#define CSV_EXT ".CSV"               // The data file
 
73
#define CSN_EXT ".CSN"               // Files used during repair and update
 
74
#define CSM_EXT ".CSM"               // Meta file
75
75
 
76
76
 
77
77
static int read_meta_file(int meta_file, ha_rows *rows);
122
122
 
123
123
  int doCreateTable(Session &,
124
124
                    Table &table_arg,
125
 
                    const drizzled::identifier::Table &identifier,
 
125
                    const drizzled::TableIdentifier &identifier,
126
126
                    drizzled::message::Table&);
127
127
 
128
128
  int doGetTableDefinition(Session& session,
129
 
                           const drizzled::identifier::Table &identifier,
 
129
                           const drizzled::TableIdentifier &identifier,
130
130
                           drizzled::message::Table &table_message);
131
131
 
132
 
  int doDropTable(Session&, const drizzled::identifier::Table &identifier);
 
132
  int doDropTable(Session&, const drizzled::TableIdentifier &identifier);
133
133
  TinaShare *findOpenTable(const string table_name);
134
134
  void addOpenTable(const string &table_name, TinaShare *);
135
135
  void deleteOpenTable(const string &table_name);
138
138
  uint32_t max_keys()          const { return 0; }
139
139
  uint32_t max_key_parts()     const { return 0; }
140
140
  uint32_t max_key_length()    const { return 0; }
141
 
  bool doDoesTableExist(Session& session, const drizzled::identifier::Table &identifier);
142
 
  int doRenameTable(Session&, const drizzled::identifier::Table &from, const drizzled::identifier::Table &to);
 
141
  bool doDoesTableExist(Session& session, const drizzled::TableIdentifier &identifier);
 
142
  int doRenameTable(Session&, const drizzled::TableIdentifier &from, const drizzled::TableIdentifier &to);
143
143
 
144
144
  void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
145
 
                             const drizzled::identifier::Schema &schema_identifier,
146
 
                             drizzled::identifier::Table::vector &set_of_identifiers);
 
145
                             const drizzled::SchemaIdentifier &schema_identifier,
 
146
                             drizzled::TableIdentifier::vector &set_of_identifiers);
147
147
};
148
148
 
149
149
void Tina::doGetTableIdentifiers(drizzled::CachedDirectory&,
150
 
                                 const drizzled::identifier::Schema&,
151
 
                                 drizzled::identifier::Table::vector&)
 
150
                                 const drizzled::SchemaIdentifier&,
 
151
                                 drizzled::TableIdentifier::vector&)
152
152
{
153
153
}
154
154
 
155
155
int Tina::doRenameTable(Session &session,
156
 
                        const drizzled::identifier::Table &from, const drizzled::identifier::Table &to)
 
156
                        const drizzled::TableIdentifier &from, const drizzled::TableIdentifier &to)
157
157
{
158
158
  int error= 0;
159
159
  for (const char **ext= bas_ext(); *ext ; ext++)
171
171
  return error;
172
172
}
173
173
 
174
 
bool Tina::doDoesTableExist(Session &session, const drizzled::identifier::Table &identifier)
 
174
bool Tina::doDoesTableExist(Session &session, const drizzled::TableIdentifier &identifier)
175
175
{
176
176
  return session.getMessageCache().doesTableMessageExist(identifier);
177
177
}
178
178
 
179
179
 
180
180
int Tina::doDropTable(Session &session,
181
 
                      const drizzled::identifier::Table &identifier)
 
181
                      const drizzled::TableIdentifier &identifier)
182
182
{
183
183
  int error= 0;
184
184
  int enoent_or_zero= ENOENT;                   // Error if no file was deleted
228
228
 
229
229
 
230
230
int Tina::doGetTableDefinition(Session &session,
231
 
                               const drizzled::identifier::Table &identifier,
 
231
                               const drizzled::TableIdentifier &identifier,
232
232
                               drizzled::message::Table &table_message)
233
233
{
234
234
  if (session.getMessageCache().getTableMessage(identifier, table_message))
781
781
  this will not be called for every request. Any sort of positions
782
782
  that need to be reset should be kept in the ::extra() call.
783
783
*/
784
 
int ha_tina::doOpen(const identifier::Table &identifier, int , uint32_t )
 
784
int ha_tina::doOpen(const TableIdentifier &identifier, int , uint32_t )
785
785
{
786
786
  if (not (share= get_share(identifier.getPath().c_str())))
787
787
    return(ENOENT);
1268
1268
 
1269
1269
int Tina::doCreateTable(Session &session,
1270
1270
                        Table& table_arg,
1271
 
                        const drizzled::identifier::Table &identifier,
 
1271
                        const drizzled::TableIdentifier &identifier,
1272
1272
                        drizzled::message::Table &create_proto)
1273
1273
{
1274
1274
  char name_buff[FN_REFLEN];
1323
1323
  "CSV storage engine",
1324
1324
  PLUGIN_LICENSE_GPL,
1325
1325
  tina_init_func, /* Plugin Init */
1326
 
  NULL,                       /* depends */
 
1326
  NULL,                       /* system variables                */
1327
1327
  NULL                        /* config options                  */
1328
1328
}
1329
1329
DRIZZLE_DECLARE_PLUGIN_END;