~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 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:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include <config.h>
 
20
#include "config.h"
21
21
 
22
22
#include <fcntl.h>
23
23
#include <unistd.h>
32
32
#include <google/protobuf/io/zero_copy_stream.h>
33
33
#include <google/protobuf/io/zero_copy_stream_impl.h>
34
34
 
35
 
#include <drizzled/cached_directory.h>
 
35
#include "drizzled/cached_directory.h"
36
36
 
37
37
#include <drizzled/definitions.h>
38
38
#include <drizzled/base.h>
43
43
#include <drizzled/gettext.h>
44
44
#include <drizzled/unireg.h>
45
45
#include <drizzled/data_home.h>
46
 
#include <drizzled/errmsg_print.h>
47
 
#include <drizzled/xid.h>
48
 
#include <drizzled/sql_table.h>
49
 
#include <drizzled/global_charset_info.h>
50
 
#include <drizzled/charset.h>
51
 
#include <drizzled/internal/my_sys.h>
 
46
#include "drizzled/errmsg_print.h"
 
47
#include "drizzled/xid.h"
 
48
#include "drizzled/sql_table.h"
 
49
#include "drizzled/global_charset_info.h"
 
50
#include "drizzled/charset.h"
 
51
#include "drizzled/internal/my_sys.h"
 
52
#include "drizzled/db.h"
52
53
 
53
54
#include <drizzled/table_proto.h>
54
55
#include <drizzled/plugin/event_observer.h>
55
 
#include <drizzled/internal_error_handler.h>
56
56
 
57
57
#include <drizzled/table/shell.h>
58
58
 
59
 
#include <drizzled/message/cache.h>
 
59
#include "drizzled/message/cache.h"
60
60
 
61
61
#include <boost/algorithm/string/compare.hpp>
62
62
 
101
101
}
102
102
 
103
103
 
104
 
int StorageEngine::renameTable(Session &session, const identifier::Table &from, const identifier::Table &to)
 
104
int StorageEngine::renameTable(Session &session, const TableIdentifier &from, const TableIdentifier &to)
105
105
{
106
106
  int error;
107
107
  setTransactionReadWrite(session);
137
137
  @retval
138
138
    !0  Error
139
139
*/
140
 
int StorageEngine::doDropTable(Session&, const identifier::Table &identifier)
 
140
int StorageEngine::doDropTable(Session&, const TableIdentifier &identifier)
141
141
                               
142
142
{
143
143
  int error= 0;
287
287
class StorageEngineGetTableDefinition: public std::unary_function<StorageEngine *,bool>
288
288
{
289
289
  Session& session;
290
 
  const identifier::Table &identifier;
 
290
  const TableIdentifier &identifier;
291
291
  message::Table &table_message;
292
 
  drizzled::error_t &err;
 
292
  int &err;
293
293
 
294
294
public:
295
295
  StorageEngineGetTableDefinition(Session& session_arg,
296
 
                                  const identifier::Table &identifier_arg,
 
296
                                  const TableIdentifier &identifier_arg,
297
297
                                  message::Table &table_message_arg,
298
 
                                  drizzled::error_t &err_arg) :
 
298
                                  int &err_arg) :
299
299
    session(session_arg), 
300
300
    identifier(identifier_arg),
301
301
    table_message(table_message_arg), 
306
306
    int ret= engine->doGetTableDefinition(session, identifier, table_message);
307
307
 
308
308
    if (ret != ENOENT)
309
 
      err= static_cast<drizzled::error_t>(ret);
 
309
      err= ret;
310
310
 
311
 
    return err == static_cast<drizzled::error_t>(EEXIST) or err != static_cast<drizzled::error_t>(ENOENT);
 
311
    return err == EEXIST || err != ENOENT;
312
312
  }
313
313
};
314
314
 
315
315
class StorageEngineDoesTableExist: public std::unary_function<StorageEngine *, bool>
316
316
{
317
317
  Session& session;
318
 
  const identifier::Table &identifier;
 
318
  const TableIdentifier &identifier;
319
319
 
320
320
public:
321
 
  StorageEngineDoesTableExist(Session& session_arg, const identifier::Table &identifier_arg) :
 
321
  StorageEngineDoesTableExist(Session& session_arg, const TableIdentifier &identifier_arg) :
322
322
    session(session_arg), 
323
323
    identifier(identifier_arg) 
324
324
  { }
333
333
  Utility method which hides some of the details of getTableDefinition()
334
334
*/
335
335
bool plugin::StorageEngine::doesTableExist(Session &session,
336
 
                                           const identifier::Table &identifier,
 
336
                                           const TableIdentifier &identifier,
337
337
                                           bool include_temporary_tables)
338
338
{
339
339
  if (include_temporary_tables)
354
354
  return true;
355
355
}
356
356
 
357
 
bool plugin::StorageEngine::doDoesTableExist(Session&, const drizzled::identifier::Table&)
 
357
bool plugin::StorageEngine::doDoesTableExist(Session&, const drizzled::TableIdentifier&)
358
358
{
359
359
  std::cerr << " Engine was called for doDoesTableExist() and does not implement it: " << this->getName() << "\n";
360
360
  assert(0);
361
361
  return false;
362
362
}
363
363
 
364
 
message::table::shared_ptr StorageEngine::getTableMessage(Session& session,
365
 
                                                          identifier::Table::const_reference identifier,
366
 
                                                          bool include_temporary_tables)
 
364
/**
 
365
  Call this function in order to give the Cursor the possiblity
 
366
  to ask engine if there are any new tables that should be written to disk
 
367
  or any dropped tables that need to be removed from disk
 
368
*/
 
369
int StorageEngine::getTableDefinition(Session& session,
 
370
                                      const TableIdentifier &identifier,
 
371
                                      message::table::shared_ptr &table_message,
 
372
                                      bool include_temporary_tables)
367
373
{
368
 
  drizzled::error_t error;
369
 
  error= static_cast<drizzled::error_t>(ENOENT);
 
374
  int err= ENOENT;
370
375
 
371
376
  if (include_temporary_tables)
372
377
  {
373
378
    Table *table= session.find_temporary_table(identifier);
374
379
    if (table)
375
380
    {
376
 
      return message::table::shared_ptr(new message::Table(*table->getShare()->getTableMessage()));
 
381
      table_message.reset(new message::Table(*table->getShare()->getTableProto()));
 
382
      return EEXIST;
377
383
    }
378
384
  }
379
385
 
380
386
  drizzled::message::table::shared_ptr table_ptr;
381
387
  if ((table_ptr= drizzled::message::Cache::singleton().find(identifier)))
382
388
  {
383
 
    (void)table_ptr;
 
389
    table_message= table_ptr;
384
390
  }
385
391
 
386
392
  message::Table message;
387
393
  EngineVector::iterator iter=
388
394
    std::find_if(vector_of_engines.begin(), vector_of_engines.end(),
389
 
                 StorageEngineGetTableDefinition(session, identifier, message, error));
 
395
                 StorageEngineGetTableDefinition(session, identifier, message, err));
390
396
 
391
397
  if (iter == vector_of_engines.end())
392
398
  {
393
 
    return message::table::shared_ptr();
 
399
    return ENOENT;
394
400
  }
395
 
  message::table::shared_ptr table_message(new message::Table(message));
396
 
 
397
 
  drizzled::message::Cache::singleton().insert(identifier, table_message);
398
 
 
399
 
  return table_message;
 
401
  table_message.reset(new message::Table(message));
 
402
 
 
403
 drizzled::message::Cache::singleton().insert(identifier, table_message);
 
404
 
 
405
  return err;
400
406
}
401
407
 
402
408
/**
409
415
{
410
416
public:
411
417
  Ha_delete_table_error_handler() : Internal_error_handler() {}
412
 
  virtual bool handle_error(drizzled::error_t sql_errno,
 
418
  virtual bool handle_error(uint32_t sql_errno,
413
419
                            const char *message,
414
420
                            DRIZZLE_ERROR::enum_warning_level level,
415
421
                            Session *session);
419
425
 
420
426
bool
421
427
Ha_delete_table_error_handler::
422
 
handle_error(drizzled::error_t ,
 
428
handle_error(uint32_t ,
423
429
             const char *message,
424
430
             DRIZZLE_ERROR::enum_warning_level ,
425
431
             Session *)
429
435
  return true;
430
436
}
431
437
 
432
 
class DropTableByIdentifier: public std::unary_function<EngineVector::value_type, bool>
433
 
{
434
 
  Session::reference session;
435
 
  identifier::Table::const_reference identifier;
436
 
  drizzled::error_t &error;
437
 
 
438
 
public:
439
 
 
440
 
  DropTableByIdentifier(Session::reference session_arg,
441
 
                        identifier::Table::const_reference identifier_arg,
442
 
                        drizzled::error_t &error_arg) :
443
 
    session(session_arg),
444
 
    identifier(identifier_arg),
445
 
    error(error_arg)
446
 
  { }
447
 
 
448
 
  result_type operator() (argument_type engine)
449
 
  {
450
 
    if (not engine->doDoesTableExist(session, identifier))
451
 
      return false;
452
 
 
453
 
    int local_error= engine->doDropTable(session, identifier);
454
 
 
455
 
 
456
 
    if (not local_error)
457
 
      return true;
458
 
 
459
 
    switch (local_error)
460
 
    {
461
 
    case HA_ERR_NO_SUCH_TABLE:
462
 
    case ENOENT:
463
 
      error= static_cast<drizzled::error_t>(HA_ERR_NO_SUCH_TABLE);
464
 
      return false;
465
 
 
466
 
    default:
467
 
      error= static_cast<drizzled::error_t>(local_error);
468
 
      return true;
469
 
    }
470
 
  } 
471
 
};
472
 
 
473
 
 
474
 
bool StorageEngine::dropTable(Session::reference session,
475
 
                              identifier::Table::const_reference identifier,
476
 
                              drizzled::error_t &error)
477
 
{
478
 
  error= EE_OK;
479
 
 
480
 
  EngineVector::const_iterator iter= std::find_if(vector_of_engines.begin(), vector_of_engines.end(),
481
 
                                                  DropTableByIdentifier(session, identifier, error));
482
 
 
483
 
  if (error)
484
 
  {
485
 
    return false;
486
 
  }
487
 
  else if (iter == vector_of_engines.end())
488
 
  {
489
 
    error= ER_BAD_TABLE_ERROR;
490
 
    return false;
491
 
  }
492
 
 
493
 
  drizzled::message::Cache::singleton().erase(identifier);
494
 
 
495
 
  return true;
496
 
}
497
 
 
498
 
bool StorageEngine::dropTable(Session& session,
499
 
                              const identifier::Table &identifier)
500
 
{
501
 
  drizzled::error_t error;
502
 
 
503
 
  if (not dropTable(session, identifier, error))
504
 
  {
505
 
    return false;
506
 
  }
507
 
 
508
 
  return true;
509
 
}
510
 
 
511
 
bool StorageEngine::dropTable(Session::reference session,
512
 
                              StorageEngine &engine,
513
 
                              identifier::Table::const_reference identifier,
514
 
                              drizzled::error_t &error)
515
 
{
516
 
  error= EE_OK;
 
438
/**
 
439
   returns ENOENT if the file doesn't exists.
 
440
*/
 
441
int StorageEngine::dropTable(Session& session,
 
442
                             const TableIdentifier &identifier)
 
443
{
 
444
  int error= 0;
 
445
  int error_proto;
 
446
  message::table::shared_ptr src_proto;
 
447
  StorageEngine *engine;
 
448
 
 
449
  error_proto= StorageEngine::getTableDefinition(session, identifier, src_proto);
 
450
 
 
451
  if (error_proto == ER_CORRUPT_TABLE_DEFINITION)
 
452
  {
 
453
    std::string error_message;
 
454
    identifier.getSQLPath(error_message);
 
455
 
 
456
    my_error(ER_CORRUPT_TABLE_DEFINITION, MYF(0),
 
457
             error_message.c_str(),
 
458
             src_proto->InitializationErrorString().c_str());
 
459
 
 
460
    return ER_CORRUPT_TABLE_DEFINITION;
 
461
  }
 
462
 
 
463
  if (src_proto)
 
464
    engine= StorageEngine::findByName(session, src_proto->engine().name());
 
465
  else
 
466
    engine= StorageEngine::findByName(session, "");
 
467
 
 
468
  if (not engine)
 
469
  {
 
470
    std::string error_message;
 
471
    identifier.getSQLPath(error_message);
 
472
 
 
473
    my_error(ER_CORRUPT_TABLE_DEFINITION, MYF(0), error_message.c_str(), "");
 
474
 
 
475
    return ER_CORRUPT_TABLE_DEFINITION;
 
476
  }
 
477
 
 
478
  error= StorageEngine::dropTable(session, *engine, identifier);
 
479
 
 
480
  if (error_proto && error == 0)
 
481
    return 0;
 
482
 
 
483
  return error;
 
484
}
 
485
 
 
486
int StorageEngine::dropTable(Session& session,
 
487
                             StorageEngine &engine,
 
488
                             const TableIdentifier &identifier)
 
489
{
 
490
  int error;
 
491
 
517
492
  engine.setTransactionReadWrite(session);
518
 
 
519
 
  assert(identifier.isTmp());
520
493
  
521
494
  if (unlikely(plugin::EventObserver::beforeDropTable(session, identifier)))
522
495
  {
524
497
  }
525
498
  else
526
499
  {
527
 
    error= static_cast<drizzled::error_t>(engine.doDropTable(session, identifier));
528
 
 
 
500
    error= engine.doDropTable(session, identifier);
529
501
    if (unlikely(plugin::EventObserver::afterDropTable(session, identifier, error)))
530
502
    {
531
503
      error= ER_EVENT_OBSERVER_PLUGIN;
534
506
 
535
507
  drizzled::message::Cache::singleton().erase(identifier);
536
508
 
537
 
  if (error)
538
 
  {
539
 
    return false;
540
 
  }
541
 
 
542
 
  return true;
 
509
  return error;
543
510
}
544
511
 
545
512
 
551
518
  @retval
552
519
   1  error
553
520
*/
554
 
bool StorageEngine::createTable(Session &session,
555
 
                                const identifier::Table &identifier,
556
 
                                message::Table& table_message)
 
521
int StorageEngine::createTable(Session &session,
 
522
                               const TableIdentifier &identifier,
 
523
                               message::Table& table_message)
557
524
{
558
 
  drizzled::error_t error= EE_OK;
559
 
 
 
525
  int error= 1;
560
526
  TableShare share(identifier);
561
527
  table::Shell table(share);
562
528
  message::Table tmp_proto;
564
530
  if (share.parse_table_proto(session, table_message) || share.open_table_from_share(&session, identifier, "", 0, 0, table))
565
531
  { 
566
532
    // @note Error occured, we should probably do a little more here.
567
 
    // ER_CORRUPT_TABLE_DEFINITION,ER_CORRUPT_TABLE_DEFINITION_ENUM 
568
 
    
569
 
    my_error(ER_CORRUPT_TABLE_DEFINITION_UNKNOWN, identifier);
570
 
 
571
 
    return false;
572
533
  }
573
534
  else
574
535
  {
587
548
    {
588
549
      share.storage_engine->setTransactionReadWrite(session);
589
550
 
590
 
      error= static_cast<drizzled::error_t>(share.storage_engine->doCreateTable(session,
591
 
                                                                                table,
592
 
                                                                                identifier,
593
 
                                                                                table_message));
 
551
      error= share.storage_engine->doCreateTable(session,
 
552
                                                 table,
 
553
                                                 identifier,
 
554
                                                 table_message);
594
555
    }
595
556
 
596
 
    if (error == ER_TABLE_PERMISSION_DENIED)
597
 
    {
598
 
      my_error(ER_TABLE_PERMISSION_DENIED, identifier);
599
 
    }
600
 
    else if (error)
 
557
    if (error)
601
558
    {
602
559
      std::string path;
603
560
      identifier.getSQLPath(path);
607
564
    table.delete_table();
608
565
  }
609
566
 
610
 
  return(error == EE_OK);
 
567
  return(error != 0);
611
568
}
612
569
 
613
570
Cursor *StorageEngine::getCursor(Table &arg)
619
576
  public std::unary_function<StorageEngine *, void>
620
577
{
621
578
  CachedDirectory &directory;
622
 
  const identifier::Schema &identifier;
623
 
  identifier::Table::vector &set_of_identifiers;
 
579
  const SchemaIdentifier &identifier;
 
580
  TableIdentifier::vector &set_of_identifiers;
624
581
 
625
582
public:
626
583
 
627
 
  AddTableIdentifier(CachedDirectory &directory_arg, const identifier::Schema &identifier_arg, identifier::Table::vector &of_names) :
 
584
  AddTableIdentifier(CachedDirectory &directory_arg, const SchemaIdentifier &identifier_arg, TableIdentifier::vector &of_names) :
628
585
    directory(directory_arg),
629
586
    identifier(identifier_arg),
630
587
    set_of_identifiers(of_names)
638
595
};
639
596
 
640
597
 
641
 
void StorageEngine::getIdentifiers(Session &session, const identifier::Schema &schema_identifier, identifier::Table::vector &set_of_identifiers)
 
598
void StorageEngine::getIdentifiers(Session &session, const SchemaIdentifier &schema_identifier, TableIdentifier::vector &set_of_identifiers)
642
599
{
 
600
  static SchemaIdentifier INFORMATION_SCHEMA_IDENTIFIER("information_schema");
 
601
  static SchemaIdentifier DATA_DICTIONARY_IDENTIFIER("data_dictionary");
 
602
 
643
603
  CachedDirectory directory(schema_identifier.getPath(), set_of_table_definition_ext);
644
604
 
645
605
  if (schema_identifier == INFORMATION_SCHEMA_IDENTIFIER)
672
632
  session.doGetTableIdentifiers(directory, schema_identifier, set_of_identifiers);
673
633
}
674
634
 
675
 
class DropTable: public std::unary_function<identifier::Table&, bool>
 
635
class DropTable: public std::unary_function<TableIdentifier&, bool>
676
636
{
677
637
  Session &session;
678
638
  StorageEngine *engine;
690
650
  } 
691
651
};
692
652
 
693
 
/* This will later be converted to identifier::Tables */
 
653
/* This will later be converted to TableIdentifiers */
694
654
class DropTables: public std::unary_function<StorageEngine *, void>
695
655
{
696
656
  Session &session;
697
 
  identifier::Table::vector &table_identifiers;
 
657
  TableIdentifier::vector &table_identifiers;
698
658
 
699
659
public:
700
660
 
701
 
  DropTables(Session &session_arg, identifier::Table::vector &table_identifiers_arg) :
 
661
  DropTables(Session &session_arg, TableIdentifier::vector &table_identifiers_arg) :
702
662
    session(session_arg),
703
663
    table_identifiers(table_identifiers_arg)
704
664
  { }
722
682
void StorageEngine::removeLostTemporaryTables(Session &session, const char *directory)
723
683
{
724
684
  CachedDirectory dir(directory, set_of_table_definition_ext);
725
 
  identifier::Table::vector table_identifiers;
 
685
  TableIdentifier::vector table_identifiers;
726
686
 
727
687
  if (dir.fail())
728
688
  {
751
711
    message::Table definition;
752
712
    if (StorageEngine::readTableFile(path, definition))
753
713
    {
754
 
      identifier::Table identifier(definition.schema(), definition.name(), path);
 
714
      TableIdentifier identifier(definition.schema(), definition.name(), path);
755
715
      table_identifiers.push_back(identifier);
756
716
    }
757
717
  }
801
761
    - table->getShare()->path
802
762
    - table->alias
803
763
*/
804
 
void StorageEngine::print_error(int error, myf errflag, const Table &table) const
 
764
void StorageEngine::print_error(int error, myf errflag, Table &table)
 
765
{
 
766
  print_error(error, errflag, &table);
 
767
}
 
768
 
 
769
void StorageEngine::print_error(int error, myf errflag, Table *table)
805
770
{
806
771
  drizzled::error_t textno= ER_GET_ERRNO;
807
772
  switch (error) {
824
789
    break;
825
790
  case HA_ERR_FOUND_DUPP_KEY:
826
791
  {
827
 
    uint32_t key_nr= table.get_dup_key(error);
 
792
    assert(table);
 
793
    uint32_t key_nr= table->get_dup_key(error);
828
794
    if ((int) key_nr >= 0)
829
795
    {
830
796
      const char *err_msg= ER(ER_DUP_ENTRY_WITH_KEY_NAME);
831
797
 
832
 
      print_keydup_error(key_nr, err_msg, table);
 
798
      print_keydup_error(key_nr, err_msg, *table);
833
799
 
834
800
      return;
835
801
    }
838
804
  }
839
805
  case HA_ERR_FOREIGN_DUPLICATE_KEY:
840
806
  {
841
 
    uint32_t key_nr= table.get_dup_key(error);
 
807
    assert(table);
 
808
    uint32_t key_nr= table->get_dup_key(error);
842
809
    if ((int) key_nr >= 0)
843
810
    {
844
811
      uint32_t max_length;
848
815
      String str(key,sizeof(key),system_charset_info);
849
816
 
850
817
      /* Table is opened and defined at this point */
851
 
      key_unpack(&str, &table,(uint32_t) key_nr);
 
818
      key_unpack(&str,table,(uint32_t) key_nr);
852
819
      max_length= (DRIZZLE_ERRMSG_SIZE-
853
820
                   (uint32_t) strlen(ER(ER_FOREIGN_DUPLICATE_KEY)));
854
821
      if (str.length() >= max_length)
856
823
        str.length(max_length-4);
857
824
        str.append(STRING_WITH_LEN("..."));
858
825
      }
859
 
      my_error(ER_FOREIGN_DUPLICATE_KEY, MYF(0), table.getShare()->getTableName(),
 
826
      my_error(ER_FOREIGN_DUPLICATE_KEY, MYF(0), table->getShare()->getTableName(),
860
827
        str.c_ptr(), key_nr+1);
861
828
      return;
862
829
    }
933
900
    textno=ER_TABLE_DEF_CHANGED;
934
901
    break;
935
902
  case HA_ERR_NO_SUCH_TABLE:
936
 
    {
937
 
      identifier::Table identifier(table.getShare()->getSchemaName(), table.getShare()->getTableName());
938
 
      my_error(ER_TABLE_UNKNOWN, identifier);
939
 
      return;
940
 
    }
 
903
    assert(table);
 
904
    my_error(ER_NO_SUCH_TABLE, MYF(0), table->getShare()->getSchemaName(),
 
905
             table->getShare()->getTableName());
 
906
    return;
941
907
  case HA_ERR_RBR_LOGGING_FAILED:
942
908
    textno= ER_BINLOG_ROW_LOGGING_FAILED;
943
909
    break;
944
910
  case HA_ERR_DROP_INDEX_FK:
945
911
  {
 
912
    assert(table);
946
913
    const char *ptr= "???";
947
 
    uint32_t key_nr= table.get_dup_key(error);
 
914
    uint32_t key_nr= table->get_dup_key(error);
948
915
    if ((int) key_nr >= 0)
949
 
      ptr= table.key_info[key_nr].name;
 
916
      ptr= table->key_info[key_nr].name;
950
917
    my_error(ER_DROP_INDEX_FK, MYF(0), ptr);
951
918
    return;
952
919
  }
991
958
      return;
992
959
    }
993
960
  }
994
 
 
995
 
  my_error(textno, errflag, table.getShare()->getTableName(), error);
 
961
  my_error(textno, errflag, table->getShare()->getTableName(), error);
996
962
}
997
963
 
998
964
 
1005
971
  @return
1006
972
    Returns true if this is a temporary error
1007
973
*/
1008
 
bool StorageEngine::get_error_message(int , String* ) const
 
974
bool StorageEngine::get_error_message(int , String* )
1009
975
{
1010
976
  return false;
1011
977
}
1012
978
 
1013
979
 
1014
 
void StorageEngine::print_keydup_error(uint32_t key_nr, const char *msg, const Table &table) const
 
980
void StorageEngine::print_keydup_error(uint32_t key_nr, const char *msg, Table &table)
1015
981
{
1016
982
  /* Write the duplicated key in the error message */
1017
983
  char key[MAX_KEY_LENGTH];
1039
1005
}
1040
1006
 
1041
1007
 
1042
 
int StorageEngine::deleteDefinitionFromPath(const identifier::Table &identifier)
 
1008
int StorageEngine::deleteDefinitionFromPath(const TableIdentifier &identifier)
1043
1009
{
1044
1010
  std::string path(identifier.getPath());
1045
1011
 
1048
1014
  return internal::my_delete(path.c_str(), MYF(0));
1049
1015
}
1050
1016
 
1051
 
int StorageEngine::renameDefinitionFromPath(const identifier::Table &dest, const identifier::Table &src)
 
1017
int StorageEngine::renameDefinitionFromPath(const TableIdentifier &dest, const TableIdentifier &src)
1052
1018
{
1053
1019
  message::Table table_message;
1054
1020
  std::string src_path(src.getPath());
1077
1043
  return error;
1078
1044
}
1079
1045
 
1080
 
int StorageEngine::writeDefinitionFromPath(const identifier::Table &identifier, message::Table &table_message)
 
1046
int StorageEngine::writeDefinitionFromPath(const TableIdentifier &identifier, message::Table &table_message)
1081
1047
{
1082
1048
  char definition_file_tmp[FN_REFLEN];
1083
1049
  std::string file_name(identifier.getPath());
1156
1122
 
1157
1123
class CanCreateTable: public std::unary_function<StorageEngine *, bool>
1158
1124
{
1159
 
  const identifier::Table &identifier;
 
1125
  const TableIdentifier &identifier;
1160
1126
 
1161
1127
public:
1162
 
  CanCreateTable(const identifier::Table &identifier_arg) :
 
1128
  CanCreateTable(const TableIdentifier &identifier_arg) :
1163
1129
    identifier(identifier_arg)
1164
1130
  { }
1165
1131
 
1173
1139
/**
1174
1140
  @note on success table can be created.
1175
1141
*/
1176
 
bool StorageEngine::canCreateTable(const identifier::Table &identifier)
 
1142
bool StorageEngine::canCreateTable(const TableIdentifier &identifier)
1177
1143
{
1178
1144
  EngineVector::iterator iter=
1179
1145
    std::find_if(vector_of_engines.begin(), vector_of_engines.end(),