~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/storage_engine.cc

  • Committer: Brian Aker
  • Date: 2011-01-12 22:54:12 UTC
  • mto: This revision was merged to the branch mainline in revision 2079.
  • Revision ID: brian@tangent.org-20110112225412-u76lu18yz6furi4s
Fix interface for create table such that it issues error and returns state
like the rest of the API.

Show diffs side-by-side

added added

removed removed

Lines of Context:
557
557
  @retval
558
558
   1  error
559
559
*/
560
 
int StorageEngine::createTable(Session &session,
561
 
                               const TableIdentifier &identifier,
562
 
                               message::Table& table_message)
 
560
bool StorageEngine::createTable(Session &session,
 
561
                                const TableIdentifier &identifier,
 
562
                                message::Table& table_message)
563
563
{
564
 
  int error= 1;
 
564
  drizzled::error_t error= EE_OK;
 
565
 
565
566
  TableShare share(identifier);
566
567
  table::Shell table(share);
567
568
  message::Table tmp_proto;
569
570
  if (share.parse_table_proto(session, table_message) || share.open_table_from_share(&session, identifier, "", 0, 0, table))
570
571
  { 
571
572
    // @note Error occured, we should probably do a little more here.
 
573
    // ER_CORRUPT_TABLE_DEFINITION,ER_CORRUPT_TABLE_DEFINITION_ENUM 
 
574
    
 
575
    my_error(ER_CORRUPT_TABLE_DEFINITION_UNKNOWN, identifier);
 
576
 
 
577
    return false;
572
578
  }
573
579
  else
574
580
  {
587
593
    {
588
594
      share.storage_engine->setTransactionReadWrite(session);
589
595
 
590
 
      error= share.storage_engine->doCreateTable(session,
591
 
                                                 table,
592
 
                                                 identifier,
593
 
                                                 table_message);
 
596
      error= static_cast<drizzled::error_t>(share.storage_engine->doCreateTable(session,
 
597
                                                                                table,
 
598
                                                                                identifier,
 
599
                                                                                table_message));
594
600
    }
595
601
 
596
602
    if (error == ER_TABLE_PERMISSION_DENIED)
607
613
    table.delete_table();
608
614
  }
609
615
 
610
 
  return(error != 0);
 
616
  return(error == EE_OK);
611
617
}
612
618
 
613
619
Cursor *StorageEngine::getCursor(Table &arg)