~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table_proto_write.cc

  • Committer: Brian Aker
  • Date: 2009-11-26 18:50:02 UTC
  • mfrom: (1226.1.4 push)
  • Revision ID: brian@gaz-20091126185002-se908a2ceq9ub2rn
Mege of TableIdentifier gran patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
544
544
    1  error
545
545
*/
546
546
 
547
 
int rea_create_table(Session *session, const char *path,
548
 
                     const char *db, const char *table_name,
 
547
int rea_create_table(Session *session,
 
548
                     TableIdentifier &identifier,
549
549
                     message::Table *table_proto,
550
550
                     HA_CREATE_INFO *create_info,
551
551
                     List<CreateField> &create_fields,
552
552
                     uint32_t keys, KEY *key_info)
553
553
{
554
 
  /* Proto will blow up unless we give a name */
555
 
  assert(table_name);
556
 
 
557
 
  if (fill_table_proto(table_proto, table_name, create_fields, create_info,
 
554
  if (fill_table_proto(table_proto, identifier.getTableName(), create_fields, create_info,
558
555
                      keys, key_info))
559
556
    return 1;
560
557
 
561
 
  string new_path(path);
 
558
  string new_path(identifier.getPath());
562
559
  string file_ext = ".dfe";
563
560
 
564
561
  new_path.append(file_ext);
573
570
  if (err != 0)
574
571
  {
575
572
    if (err == ENOENT)
576
 
      my_error(ER_BAD_DB_ERROR,MYF(0),db);
 
573
      my_error(ER_BAD_DB_ERROR,MYF(0), identifier.getDBName());
577
574
    else
578
 
      my_error(ER_CANT_CREATE_TABLE,MYF(0),table_name,err);
 
575
      my_error(ER_CANT_CREATE_TABLE, MYF(0), identifier.getTableName(), err);
579
576
 
580
577
    goto err_handler;
581
578
  }
582
579
 
583
 
  if (plugin::StorageEngine::createTable(*session, path, db, table_name,
 
580
  if (plugin::StorageEngine::createTable(*session,
 
581
                                         identifier,
584
582
                                         false, *table_proto))
585
583
    goto err_handler;
586
584
  return 0;
587
585
 
588
586
err_handler:
589
587
  if (engine->check_flag(HTON_BIT_HAS_DATA_DICTIONARY) == false)
590
 
    delete_table_proto_file(path);
 
588
    delete_table_proto_file(identifier.getPath());
591
589
 
592
590
  return 1;
593
591
} /* rea_create_table */