~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/handler.h

  • Committer: Brian Aker
  • Date: 2008-12-04 18:49:15 UTC
  • Revision ID: brian@tangent.org-20081204184915-4znnd1zco058heh8
Cleanup unused attribute

Show diffs side-by-side

added added

removed removed

Lines of Context:
313
313
  /* Estimates calculation */
314
314
  virtual double scan_time(void)
315
315
  { return uint64_t2double(stats.data_file_length) / IO_SIZE + 2; }
316
 
  virtual double read_time(uint32_t index __attribute__((unused)),
317
 
                           uint32_t ranges, ha_rows rows)
 
316
  virtual double read_time(uint32_t, uint32_t ranges, ha_rows rows)
318
317
  { return rows2double(ranges+rows); }
319
318
 
320
319
  virtual double index_only_read_time(uint32_t keynr, double records);
367
366
  */
368
367
  virtual enum row_type get_row_type() const { return ROW_TYPE_NOT_USED; }
369
368
 
370
 
  virtual const char *index_type(uint32_t key_number __attribute__((unused)))
 
369
  virtual const char *index_type(uint32_t)
371
370
  { assert(0); return "";}
372
371
 
373
372
 
403
402
    @retval  0           Success
404
403
    @retval  >0          Error code
405
404
  */
406
 
  virtual int exec_bulk_update(uint32_t *dup_key_found __attribute__((unused)))
 
405
  virtual int exec_bulk_update(uint32_t *)
407
406
  {
408
407
    assert(false);
409
408
    return HA_ERR_WRONG_COMMAND;
446
445
  virtual int index_read_idx_map(unsigned char * buf, uint32_t index, const unsigned char * key,
447
446
                                 key_part_map keypart_map,
448
447
                                 enum ha_rkey_function find_flag);
449
 
  virtual int index_next(unsigned char * buf __attribute__((unused)))
450
 
   { return  HA_ERR_WRONG_COMMAND; }
451
 
  virtual int index_prev(unsigned char * buf __attribute__((unused)))
452
 
   { return  HA_ERR_WRONG_COMMAND; }
453
 
  virtual int index_first(unsigned char * buf __attribute__((unused)))
454
 
   { return  HA_ERR_WRONG_COMMAND; }
455
 
  virtual int index_last(unsigned char * buf __attribute__((unused)))
456
 
   { return  HA_ERR_WRONG_COMMAND; }
457
 
  virtual int index_next_same(unsigned char *buf __attribute__((unused)),
458
 
                              const unsigned char *key __attribute__((unused)),
459
 
                              uint32_t keylen __attribute__((unused)));
 
448
  virtual int index_next(unsigned char *)
 
449
   { return  HA_ERR_WRONG_COMMAND; }
 
450
  virtual int index_prev(unsigned char *)
 
451
   { return  HA_ERR_WRONG_COMMAND; }
 
452
  virtual int index_first(unsigned char *)
 
453
   { return  HA_ERR_WRONG_COMMAND; }
 
454
  virtual int index_last(unsigned char *)
 
455
   { return  HA_ERR_WRONG_COMMAND; }
 
456
  virtual int index_next_same(unsigned char *, const unsigned char *, uint32_t);
460
457
  /**
461
458
     @brief
462
459
     The following functions works like index_read, but it find the last
474
471
  virtual int read_range_next();
475
472
  int compare_key(key_range *range);
476
473
  int compare_key2(key_range *range);
477
 
  virtual int rnd_next(unsigned char *buf __attribute__((unused)))=0;
478
 
  virtual int rnd_pos(unsigned char * buf __attribute__((unused)),
479
 
                      unsigned char *pos __attribute__((unused)))=0;
 
474
  virtual int rnd_next(unsigned char *)=0;
 
475
  virtual int rnd_pos(unsigned char *, unsigned char *)=0;
480
476
  /**
481
477
    One has to use this method when to find
482
478
    random position by record as the plain
489
485
    The following function is only needed for tables that may be temporary
490
486
    tables during joins.
491
487
  */
492
 
  virtual int restart_rnd_next(unsigned char *buf __attribute__((unused)),
493
 
                               unsigned char *pos __attribute__((unused)))
494
 
    { return HA_ERR_WRONG_COMMAND; }
495
 
  virtual int rnd_same(unsigned char *buf __attribute__((unused)),
496
 
                       uint32_t inx __attribute__((unused)))
497
 
    { return HA_ERR_WRONG_COMMAND; }
498
 
  virtual ha_rows records_in_range(uint32_t inx __attribute__((unused)),
499
 
                                   key_range *min_key __attribute__((unused)),
500
 
                                   key_range *max_key __attribute__((unused)))
 
488
  virtual int restart_rnd_next(unsigned char *, unsigned char *)
 
489
    { return HA_ERR_WRONG_COMMAND; }
 
490
  virtual int rnd_same(unsigned char *, uint32_t)
 
491
    { return HA_ERR_WRONG_COMMAND; }
 
492
  virtual ha_rows records_in_range(uint32_t, key_range *, key_range *)
501
493
    { return (ha_rows) 10; }
502
494
  virtual void position(const unsigned char *record)=0;
503
495
  virtual int info(uint)=0; // see my_base.h for full description
504
 
  virtual uint32_t calculate_key_hash_value(Field **field_array __attribute__((unused)))
 
496
  virtual uint32_t calculate_key_hash_value(Field **)
505
497
  { assert(0); return 0; }
506
 
  virtual int extra(enum ha_extra_function operation __attribute__((unused)))
 
498
  virtual int extra(enum ha_extra_function)
507
499
  { return 0; }
508
 
  virtual int extra_opt(enum ha_extra_function operation,
509
 
                        uint32_t cache_size __attribute__((unused)))
 
500
  virtual int extra_opt(enum ha_extra_function operation, uint32_t)
510
501
  { return extra(operation); }
511
502
 
512
503
  /**
530
521
  */
531
522
  virtual void try_semi_consistent_read(bool) {}
532
523
  virtual void unlock_row(void) {}
533
 
  virtual int start_stmt(Session *session __attribute__((unused)),
534
 
                         thr_lock_type lock_type __attribute__((unused)))
 
524
  virtual int start_stmt(Session *, thr_lock_type)
535
525
  {return 0;}
536
526
  virtual void get_auto_increment(uint64_t offset, uint64_t increment,
537
527
                                  uint64_t nb_desired_values,
557
547
      insert_id_for_cur_row;
558
548
  }
559
549
 
560
 
  virtual void update_create_info(HA_CREATE_INFO *create_info __attribute__((unused))) {}
 
550
  virtual void update_create_info(HA_CREATE_INFO *) {}
561
551
  int check_old_types(void);
562
 
  virtual int assign_to_keycache(Session* session __attribute__((unused)),
563
 
                                 HA_CHECK_OPT* check_opt __attribute__((unused)))
 
552
  virtual int assign_to_keycache(Session*, HA_CHECK_OPT *)
564
553
  { return HA_ADMIN_NOT_IMPLEMENTED; }
565
554
  /* end of the list of admin commands */
566
555
 
567
556
  virtual int indexes_are_disabled(void) {return 0;}
568
557
  virtual char *update_table_comment(const char * comment)
569
558
  { return (char*) comment;}
570
 
  virtual void append_create_info(String *packet __attribute__((unused)))
 
559
  virtual void append_create_info(String *)
571
560
  {}
572
561
  /**
573
562
      If index == MAX_KEY then a check for table is made and if index <
579
568
    @retval   true            Foreign key defined on table or index
580
569
    @retval   false           No foreign key defined
581
570
  */
582
 
  virtual bool is_fk_defined_on_table_or_index(uint32_t index __attribute__((unused)))
 
571
  virtual bool is_fk_defined_on_table_or_index(uint32_t)
583
572
  { return false; }
584
573
  virtual char* get_foreign_key_create_info(void)
585
574
  { return(NULL);}  /* gets foreign key create string from InnoDB */
586
575
  /** used in ALTER Table; 1 if changing storage engine is allowed */
587
576
  virtual bool can_switch_engines(void) { return 1; }
588
577
  /** used in REPLACE; is > 0 if table is referred by a FOREIGN KEY */
589
 
  virtual int get_foreign_key_list(Session *session __attribute__((unused)),
590
 
                                   List<FOREIGN_KEY_INFO> *f_key_list __attribute__((unused)))
 
578
  virtual int get_foreign_key_list(Session *, List<FOREIGN_KEY_INFO> *)
591
579
  { return 0; }
592
580
  virtual uint32_t referenced_by_foreign_key() { return 0;}
593
581
  virtual void init_table_handle_for_HANDLER()
594
582
  { return; }       /* prepare InnoDB for HANDLER */
595
 
  virtual void free_foreign_key_create_info(char* str __attribute__((unused))) {}
 
583
  virtual void free_foreign_key_create_info(char *) {}
596
584
  /** The following can be called without an open handler */
597
585
  virtual const char *table_type() const =0;
598
586
  /**
608
596
  */
609
597
  virtual const char **bas_ext() const =0;
610
598
 
611
 
  virtual int get_default_no_partitions(HA_CREATE_INFO *info __attribute__((unused))) { return 1;}
612
 
  virtual bool get_no_parts(const char *name __attribute__((unused)),
613
 
                            uint32_t *no_parts)
 
599
  virtual int get_default_no_partitions(HA_CREATE_INFO *) { return 1;}
 
600
  virtual bool get_no_parts(const char *, uint32_t *no_parts)
614
601
  {
615
602
    *no_parts= 0;
616
603
    return 0;
618
605
 
619
606
  virtual uint32_t index_flags(uint32_t idx, uint32_t part, bool all_parts) const =0;
620
607
 
621
 
  virtual int add_index(Table *table_arg __attribute__((unused)),
622
 
                        KEY *key_info __attribute__((unused)),
623
 
                        uint32_t num_of_keys __attribute__((unused)))
624
 
  { return (HA_ERR_WRONG_COMMAND); }
625
 
  virtual int prepare_drop_index(Table *table_arg __attribute__((unused)),
626
 
                                 uint32_t *key_num __attribute__((unused)),
627
 
                                 uint32_t num_of_keys __attribute__((unused)))
628
 
  { return (HA_ERR_WRONG_COMMAND); }
629
 
  virtual int final_drop_index(Table *table_arg __attribute__((unused)))
 
608
  virtual int add_index(Table *, KEY *, uint32_t)
 
609
  { return (HA_ERR_WRONG_COMMAND); }
 
610
  virtual int prepare_drop_index(Table *, uint32_t *, uint32_t)
 
611
  { return (HA_ERR_WRONG_COMMAND); }
 
612
  virtual int final_drop_index(Table *)
630
613
  { return (HA_ERR_WRONG_COMMAND); }
631
614
 
632
615
  uint32_t max_record_length() const
646
629
  virtual uint32_t max_supported_key_parts(void) const { return MAX_REF_PARTS; }
647
630
  virtual uint32_t max_supported_key_length(void) const { return MAX_KEY_LENGTH; }
648
631
  virtual uint32_t max_supported_key_part_length(void) const { return 255; }
649
 
  virtual uint32_t min_record_length(uint32_t options __attribute__((unused))) const
 
632
  virtual uint32_t min_record_length(uint32_t) const
650
633
  { return 1; }
651
634
 
652
635
  virtual bool low_byte_first(void) const { return 1; }
716
699
  */
717
700
 
718
701
  virtual bool
719
 
    register_query_cache_table(Session *session __attribute__((unused)),
720
 
                               char *table_key __attribute__((unused)),
721
 
                               uint32_t key_length __attribute__((unused)),
 
702
    register_query_cache_table(Session *, char *, uint32_t,
722
703
                               qc_engine_callback *engine_callback,
723
 
                               uint64_t *engine_data __attribute__((unused)))
 
704
                               uint64_t *)
724
705
  {
725
706
    *engine_callback= 0;
726
707
    return true;
773
754
 */
774
755
 virtual void cond_pop(void) { return; }
775
756
 
776
 
 virtual Item
777
 
   *idx_cond_push(uint32_t keyno __attribute__((unused)),
778
 
                  Item* idx_cond __attribute__((unused)))
 
757
 virtual Item *idx_cond_push(uint32_t, Item *idx_cond)
779
758
 { return idx_cond; }
780
759
 
781
760
 /*
782
761
    Part of old fast alter table, to be depricated
783
762
  */
784
763
 virtual bool
785
 
   check_if_incompatible_data(HA_CREATE_INFO *create_info __attribute__((unused)),
786
 
                              uint32_t table_changes __attribute__((unused)))
 
764
   check_if_incompatible_data(HA_CREATE_INFO *, uint32_t)
787
765
 { return COMPATIBLE_DATA_NO; }
788
766
 
789
767
 /* On-line ALTER Table interface */
811
789
      just changing the frm file) without any change in the handler
812
790
      implementation.
813
791
 */
814
 
 virtual int
815
 
   check_if_supported_alter(Table *altered_table __attribute__((unused)),
816
 
                            HA_CREATE_INFO *create_info,
817
 
                            HA_ALTER_FLAGS *alter_flags __attribute__((unused)),
818
 
                            uint32_t table_changes)
 
792
 virtual int check_if_supported_alter(Table *, HA_CREATE_INFO *create_info,
 
793
                                      HA_ALTER_FLAGS * alter_flags, uint32_t table_changes)
819
794
 {
820
795
   if (this->check_if_incompatible_data(create_info, table_changes)
821
796
       == COMPATIBLE_DATA_NO)
838
813
   @retval   0      OK
839
814
   @retval   error  error code passed from storage engine
840
815
 */
841
 
 virtual int alter_table_phase1(Session *session __attribute__((unused)),
842
 
                                Table *altered_table __attribute__((unused)),
843
 
                                HA_CREATE_INFO *create_info __attribute__((unused)),
844
 
                                HA_ALTER_INFO *alter_info __attribute__((unused)),
845
 
                                HA_ALTER_FLAGS *alter_flags  __attribute__((unused)))
 
816
 virtual int alter_table_phase1(Session *, Table *, HA_CREATE_INFO *, HA_ALTER_INFO *,
 
817
                                HA_ALTER_FLAGS *)
846
818
 {
847
819
   return HA_ERR_UNSUPPORTED;
848
820
 }
864
836
      this call is to be wrapped with a DDL lock. This is currently NOT
865
837
      supported.
866
838
 */
867
 
 virtual int alter_table_phase2(Session *session  __attribute__((unused)),
868
 
                                Table *altered_table  __attribute__((unused)),
869
 
                                HA_CREATE_INFO *create_info __attribute__((unused)),
870
 
                                HA_ALTER_INFO *alter_info __attribute__((unused)),
871
 
                                HA_ALTER_FLAGS *alter_flags __attribute__((unused)))
 
839
 virtual int alter_table_phase2(Session *, Table *, HA_CREATE_INFO *, HA_ALTER_INFO *,
 
840
                                HA_ALTER_FLAGS *)
872
841
 {
873
842
   return HA_ERR_UNSUPPORTED;
874
843
 }
879
848
    @param    session               The thread handle
880
849
    @param    table             The altered table, re-opened
881
850
 */
882
 
 virtual int alter_table_phase3(Session *session __attribute__((unused)),
883
 
                                Table *table __attribute__((unused)))
 
851
 virtual int alter_table_phase3(Session *, Table *)
884
852
 {
885
853
   return HA_ERR_UNSUPPORTED;
886
854
 }
916
884
                                      lock conflict with NOWAIT option
917
885
    @retval HA_ERR_LOCK_DEADLOCK      Deadlock detected
918
886
  */
919
 
  virtual int lock_table(Session *session         __attribute__((unused)),
920
 
                         int lock_type    __attribute__((unused)),
921
 
                         int lock_timeout __attribute__((unused)))
 
887
  virtual int lock_table(Session *, int, int)
922
888
  {
923
889
    return HA_ERR_WRONG_COMMAND;
924
890
  }
960
926
  */
961
927
 
962
928
  virtual int open(const char *name, int mode, uint32_t test_if_locked)=0;
963
 
  virtual int index_init(uint32_t idx,
964
 
                         bool sorted __attribute__((unused)))
 
929
  virtual int index_init(uint32_t idx, bool)
965
930
  { active_index= idx; return 0; }
966
931
  virtual int index_end() { active_index= MAX_KEY; return 0; }
967
932
  /**
973
938
  */
974
939
  virtual int rnd_init(bool scan)= 0;
975
940
  virtual int rnd_end() { return 0; }
976
 
  virtual int write_row(unsigned char *buf __attribute__((unused)))
977
 
  {
978
 
    return HA_ERR_WRONG_COMMAND;
979
 
  }
980
 
 
981
 
  virtual int update_row(const unsigned char *old_data __attribute__((unused)),
982
 
                         unsigned char *new_data __attribute__((unused)))
983
 
  {
984
 
    return HA_ERR_WRONG_COMMAND;
985
 
  }
986
 
 
987
 
  virtual int delete_row(const unsigned char *buf __attribute__((unused)))
 
941
  virtual int write_row(unsigned char *)
 
942
  {
 
943
    return HA_ERR_WRONG_COMMAND;
 
944
  }
 
945
 
 
946
  virtual int update_row(const unsigned char *, unsigned char *)
 
947
  {
 
948
    return HA_ERR_WRONG_COMMAND;
 
949
  }
 
950
 
 
951
  virtual int delete_row(const unsigned char *)
988
952
  {
989
953
    return HA_ERR_WRONG_COMMAND;
990
954
  }
1018
982
    @return  non-0 in case of failure, 0 in case of success.
1019
983
    When lock_type is F_UNLCK, the return value is ignored.
1020
984
  */
1021
 
  virtual int external_lock(Session *session __attribute__((unused)),
1022
 
                            int lock_type __attribute__((unused)))
 
985
  virtual int external_lock(Session *, int)
1023
986
  {
1024
987
    return 0;
1025
988
  }
1026
989
  virtual void release_auto_increment(void) { return; };
1027
990
  /** admin commands - called from mysql_admin_table */
1028
 
  virtual int check_for_upgrade(HA_CHECK_OPT *check_opt __attribute__((unused)))
 
991
  virtual int check_for_upgrade(HA_CHECK_OPT *)
1029
992
  { return 0; }
1030
 
  virtual int check(Session* session __attribute__((unused)),
1031
 
                    HA_CHECK_OPT* check_opt __attribute__((unused)))
 
993
  virtual int check(Session *, HA_CHECK_OPT *)
1032
994
  { return HA_ADMIN_NOT_IMPLEMENTED; }
1033
995
 
1034
996
  /**
1036
998
     to specify CHECK option to use to call check()
1037
999
     upon the table.
1038
1000
  */
1039
 
  virtual int repair(Session* session __attribute__((unused)),
1040
 
                     HA_CHECK_OPT* check_opt __attribute__((unused)))
 
1001
  virtual int repair(Session *, HA_CHECK_OPT *)
1041
1002
  { return HA_ADMIN_NOT_IMPLEMENTED; }
1042
 
  virtual void start_bulk_insert(ha_rows rows __attribute__((unused)))
 
1003
  virtual void start_bulk_insert(ha_rows)
1043
1004
  {}
1044
1005
  virtual int end_bulk_insert(void) { return 0; }
1045
 
  virtual int index_read(unsigned char * buf __attribute__((unused)),
1046
 
                         const unsigned char * key __attribute__((unused)),
1047
 
                         uint32_t key_len __attribute__((unused)),
1048
 
                         enum ha_rkey_function find_flag __attribute__((unused)))
 
1006
  virtual int index_read(unsigned char *, const unsigned char *, 
 
1007
                         uint32_t, enum ha_rkey_function)
1049
1008
   { return  HA_ERR_WRONG_COMMAND; }
1050
 
  virtual int index_read_last(unsigned char * buf __attribute__((unused)),
1051
 
                              const unsigned char * key __attribute__((unused)),
1052
 
                              uint32_t key_len __attribute__((unused)))
 
1009
  virtual int index_read_last(unsigned char *, const unsigned char *, uint32_t)
1053
1010
   { return (my_errno= HA_ERR_WRONG_COMMAND); }
1054
1011
  /**
1055
1012
    This method is similar to update_row, however the handler doesn't need
1064
1021
    @retval  0   Bulk delete used by handler
1065
1022
    @retval  1   Bulk delete not used, normal operation used
1066
1023
  */
1067
 
  virtual int bulk_update_row(const unsigned char *old_data __attribute__((unused)),
1068
 
                              unsigned char *new_data __attribute__((unused)),
1069
 
                              uint32_t *dup_key_found __attribute__((unused)))
 
1024
  virtual int bulk_update_row(const unsigned char *, unsigned char *, uint32_t *)
1070
1025
  {
1071
1026
    assert(false);
1072
1027
    return HA_ERR_WRONG_COMMAND;
1085
1040
    is emulated by doing a 'DELETE FROM t'. HA_ERR_WRONG_COMMAND is
1086
1041
    returned by storage engines that don't support this operation.
1087
1042
  */
1088
 
  virtual int reset_auto_increment(uint64_t value __attribute__((unused)))
 
1043
  virtual int reset_auto_increment(uint64_t)
1089
1044
  { return HA_ERR_WRONG_COMMAND; }
1090
 
  virtual int optimize(Session* session __attribute__((unused)),
1091
 
                       HA_CHECK_OPT* check_opt __attribute__((unused)))
1092
 
  { return HA_ADMIN_NOT_IMPLEMENTED; }
1093
 
  virtual int analyze(Session* session __attribute__((unused)),
1094
 
                      HA_CHECK_OPT* check_opt __attribute__((unused)))
1095
 
  { return HA_ADMIN_NOT_IMPLEMENTED; }
1096
 
  virtual bool check_and_repair(Session *session __attribute__((unused)))
 
1045
  virtual int optimize(Session *, HA_CHECK_OPT *)
 
1046
  { return HA_ADMIN_NOT_IMPLEMENTED; }
 
1047
  virtual int analyze(Session *, HA_CHECK_OPT *)
 
1048
  { return HA_ADMIN_NOT_IMPLEMENTED; }
 
1049
  virtual bool check_and_repair(Session *)
1097
1050
  { return true; }
1098
 
  virtual int disable_indexes(uint32_t mode __attribute__((unused)))
1099
 
  { return HA_ERR_WRONG_COMMAND; }
1100
 
  virtual int enable_indexes(uint32_t mode __attribute__((unused)))
1101
 
  { return HA_ERR_WRONG_COMMAND; }
1102
 
  virtual int discard_or_import_tablespace(bool discard __attribute__((unused)))
 
1051
  virtual int disable_indexes(uint32_t)
 
1052
  { return HA_ERR_WRONG_COMMAND; }
 
1053
  virtual int enable_indexes(uint32_t)
 
1054
  { return HA_ERR_WRONG_COMMAND; }
 
1055
  virtual int discard_or_import_tablespace(bool)
1103
1056
  { return (my_errno=HA_ERR_WRONG_COMMAND); }
1104
1057
  virtual void prepare_for_alter(void) { return; }
1105
1058
  virtual void drop_table(const char *name);
1106
 
  virtual int create(const char *name __attribute__((unused)),
1107
 
                     Table *form __attribute__((unused)),
1108
 
                     HA_CREATE_INFO *info __attribute__((unused)))=0;
 
1059
  virtual int create(const char *, Table *, HA_CREATE_INFO *)=0;
1109
1060
 
1110
 
  virtual int create_handler_files(const char *name __attribute__((unused)),
1111
 
                                   const char *old_name __attribute__((unused)),
1112
 
                                   int action_flag __attribute__((unused)),
1113
 
                                   HA_CREATE_INFO *info __attribute__((unused)))
 
1061
  virtual int create_handler_files(const char *, const char *, int, HA_CREATE_INFO *)
1114
1062
  { return false; }
1115
1063
};
1116
1064