~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/storage_engine.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:
605
605
  or any dropped tables that need to be removed from disk
606
606
*/
607
607
int plugin::StorageEngine::getTableDefinition(Session& session,
 
608
                                              TableIdentifier &identifier,
 
609
                                              message::Table *table_proto)
 
610
{
 
611
  return getTableDefinition(session,
 
612
                            identifier.getPath(), identifier.getDBName(), identifier.getTableName(), identifier.isTmp(),
 
613
                            table_proto);
 
614
}
 
615
 
 
616
int plugin::StorageEngine::getTableDefinition(Session& session,
608
617
                                              const char* path,
609
618
                                              const char *,
610
619
                                              const char *,
678
687
  This should return ENOENT if the file doesn't exists.
679
688
  The .frm file will be deleted only if we return 0 or ENOENT
680
689
*/
681
 
int plugin::StorageEngine::dropTable(Session& session, const char *path,
682
 
                                     const char *db, const char *alias,
 
690
int plugin::StorageEngine::dropTable(Session& session,
 
691
                                     TableIdentifier &identifier,
683
692
                                     bool generate_warning)
684
693
{
685
694
  int error= 0;
688
697
  plugin::StorageEngine* engine;
689
698
 
690
699
  error_proto= plugin::StorageEngine::getTableDefinition(session,
691
 
                                                         path, 
692
 
                                                         db,
693
 
                                                         alias,
694
 
                                                         true,
 
700
                                                         identifier,
695
701
                                                         &src_proto);
696
702
 
697
703
  engine= plugin::StorageEngine::findByName(session,
700
706
  if (engine)
701
707
  {
702
708
    engine->setTransactionReadWrite(session);
703
 
    error= engine->doDropTable(session, path);
 
709
    error= engine->doDropTable(session, identifier.getPath());
704
710
  }
705
711
 
706
712
  if (error != ENOENT)
708
714
    if (error == 0)
709
715
    {
710
716
      if (engine && engine->check_flag(HTON_BIT_HAS_DATA_DICTIONARY))
711
 
        delete_table_proto_file(path);
 
717
        delete_table_proto_file(identifier.getPath());
712
718
      else
713
 
        error= delete_table_proto_file(path);
 
719
        error= delete_table_proto_file(identifier.getPath());
714
720
    }
715
721
  }
716
722
 
753
759
 
754
760
   @todo refactor to remove goto
755
761
*/
756
 
int plugin::StorageEngine::createTable(Session& session, const char *path,
757
 
                                       const char *db, const char *table_name,
 
762
int plugin::StorageEngine::createTable(Session& session,
 
763
                                       TableIdentifier &identifier,
758
764
                                       bool update_create_info,
759
765
                                       drizzled::message::Table& table_proto, bool proto_used)
760
766
{
761
767
  int error= 1;
762
768
  Table table;
763
 
  TableShare share(db, 0, table_name, path);
 
769
  TableShare share(identifier.getDBName(), 0, identifier.getTableName(), identifier.getPath());
764
770
  message::Table tmp_proto;
765
771
 
766
772
  if (proto_used)
809
815
    char name_buff[FN_REFLEN];
810
816
    const char *table_name_arg;
811
817
 
812
 
    table_name_arg= share.storage_engine->checkLowercaseNames(path, name_buff);
 
818
    table_name_arg= share.storage_engine->checkLowercaseNames(identifier.getPath(), name_buff);
813
819
 
814
820
    share.storage_engine->setTransactionReadWrite(session);
815
821
 
825
831
  if (error)
826
832
  {
827
833
    char name_buff[FN_REFLEN];
828
 
    sprintf(name_buff,"%s.%s",db,table_name);
 
834
    sprintf(name_buff,"%s.%s", identifier.getDBName(), identifier.getTableName());
829
835
    my_error(ER_CANT_CREATE_TABLE, MYF(ME_BELL+ME_WAITTANG), name_buff, error);
830
836
  }
831
837
err: