~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table.cc

Merged captain branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
#include <drizzled/item/float.h>
41
41
#include <drizzled/item/null.h>
42
42
 
 
43
#include <drizzled/table_proto.h>
 
44
 
43
45
#include <string>
44
46
#include <vector>
45
47
#include <algorithm>
92
94
  return name + strlen(name);
93
95
}
94
96
 
95
 
TABLE_CATEGORY get_table_category(const LEX_STRING *db, const LEX_STRING *name)
 
97
static TABLE_CATEGORY get_table_category(const LEX_STRING *db)
96
98
{
97
99
  assert(db != NULL);
98
 
  assert(name != NULL);
99
100
 
100
101
  if ((db->length == INFORMATION_SCHEMA_NAME.length()) &&
101
102
      (my_strcasecmp(system_charset_info,
274
275
  return default_item;
275
276
}
276
277
 
277
 
static int parse_table_proto(Session *session,
278
 
                             drizzled::message::Table &table,
279
 
                             TableShare *share)
 
278
int parse_table_proto(Session *session,
 
279
                      drizzled::message::Table &table,
 
280
                      TableShare *share)
280
281
{
281
282
  int error= 0;
282
283
  handler *handler_file= NULL;
283
284
 
284
285
  {
285
 
    LEX_STRING engine_name= { (char*)table.engine().name().c_str(),
286
 
                              strlen(table.engine().name().c_str()) };
287
 
    share->storage_engine= ha_resolve_by_name(session, &engine_name);
 
286
    share->storage_engine= ha_resolve_by_name(session, table.engine().name());
288
287
  }
289
288
 
290
289
  drizzled::message::Table::TableOptions table_options;
1232
1231
{
1233
1232
  int error;
1234
1233
  bool error_given;
1235
 
  string proto_path("");
1236
1234
 
1237
1235
  error= 1;
1238
1236
  error_given= 0;
1239
1237
 
1240
 
  proto_path.reserve(FN_REFLEN);
1241
 
  proto_path.append(share->normalized_path.str);
1242
 
 
1243
 
  proto_path.append(".dfe");
1244
 
 
1245
1238
  drizzled::message::Table table;
1246
1239
 
1247
 
  if ((error= drizzle_read_table_proto(proto_path.c_str(), &table)))
 
1240
  error= StorageEngine::getTableProto(share->normalized_path.str, &table);
 
1241
 
 
1242
  if (error != EEXIST)
1248
1243
  {
1249
1244
    if (error>0)
1250
1245
    {
1263
1258
 
1264
1259
  error= parse_table_proto(session, table, share);
1265
1260
 
1266
 
  share->table_category= get_table_category(& share->db, & share->table_name);
 
1261
  share->table_category= get_table_category(& share->db);
1267
1262
 
1268
1263
  if (!error)
1269
1264
    session->status_var.opened_shares++;