diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index c1ea002515b..b47b9c98510 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -581,6 +581,7 @@ static int process_selected_tables(char *db, char **table_names, int tables) my_free(table_names_comma_sep); } else + { for (; tables > 0; tables--, table_names++) { table= *table_names; @@ -590,6 +591,7 @@ static int process_selected_tables(char *db, char **table_names, int tables) continue; handle_request_for_tables(table, table_len, view == 1, opt_all_in_1); } + } DBUG_RETURN(0); } /* process_selected_tables */ @@ -909,16 +911,29 @@ static int handle_request_for_tables(char *tables, size_t length, } break; case DO_ANALYZE: + if (view) + { + printf("%-50s %s\n", tables, "Can't run anaylyze on a view"); + DBUG_RETURN(1); + } DBUG_ASSERT(!view); op= (opt_write_binlog) ? "ANALYZE" : "ANALYZE NO_WRITE_TO_BINLOG"; if (opt_persistent_all) end = strmov(end, " PERSISTENT FOR ALL"); break; case DO_OPTIMIZE: - DBUG_ASSERT(!view); + if (view) + { + printf("%-50s %s\n", tables, "Can't run optimize on a view"); + DBUG_RETURN(1); + } op= (opt_write_binlog) ? "OPTIMIZE" : "OPTIMIZE NO_WRITE_TO_BINLOG"; break; case DO_FIX_NAMES: - DBUG_ASSERT(!view); + if (view) + { + printf("%-50s %s\n", tables, "Can't run fix names on a view"); + DBUG_RETURN(1); + } DBUG_RETURN(fix_table_storage_name(tables)); } diff --git a/extra/comp_err.c b/extra/comp_err.c index cf6262f66e2..5e3cec676bc 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -267,6 +267,7 @@ static int create_header_files(struct errors *error_head) fprintf(sql_statef, "/* Autogenerated file, please don't edit */\n\n"); fprintf(er_namef, "/* Autogenerated file, please don't edit */\n\n"); + fprintf(er_definef, "#ifndef ER_ERROR_FIRST\n"); fprintf(er_definef, "#define ER_ERROR_FIRST %d\n", error_head->d_code); current_d_code= error_head->d_code -1; @@ -314,6 +315,7 @@ static int create_header_files(struct errors *error_head) } /* finishing off with mysqld_error.h */ fprintf(er_definef, "#define ER_ERROR_LAST %d\n", er_last); + fprintf(er_definef, "#endif /* ER_ERROR_FIRST */\n"); my_fclose(er_definef, MYF(0)); my_fclose(sql_statef, MYF(0)); my_fclose(er_namef, MYF(0)); diff --git a/extra/mysqld_safe_helper.c b/extra/mysqld_safe_helper.c index 09e507c6e1c..5c50b2300d4 100644 --- a/extra/mysqld_safe_helper.c +++ b/extra/mysqld_safe_helper.c @@ -14,7 +14,7 @@ void my_exit(int c) exit(c); } -void do_usage() +void do_usage(void) { printf("Usage:\n" " %s log \n" @@ -59,7 +59,7 @@ int main(int argc, char *argv[]) MY_INIT(argv[0]); if (argc < 3) - do_usage(argv[0]); + do_usage(); user_info= my_check_user(argv[1], MYF(0)); if (user_info ? my_set_user(argv[1], user_info, MYF(MY_WME)) diff --git a/include/maria.h b/include/maria.h index ab8fc944c8c..e25fa4c24ee 100644 --- a/include/maria.h +++ b/include/maria.h @@ -305,7 +305,7 @@ extern int maria_rsame(MARIA_HA *file, uchar *record, int inx); extern int maria_rsame_with_pos(MARIA_HA *file, uchar *record, int inx, MARIA_RECORD_POS pos); extern int maria_update(MARIA_HA *file, const uchar *old, - uchar *new_record); + const uchar *new_record); extern int maria_write(MARIA_HA *file, uchar *buff); extern MARIA_RECORD_POS maria_position(MARIA_HA *file); extern int maria_status(MARIA_HA *info, MARIA_INFO *x, uint flag); diff --git a/include/myisam.h b/include/myisam.h index f7a3ae8cc8a..dfbc00f64aa 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -275,7 +275,7 @@ extern int mi_rsame(struct st_myisam_info *file,uchar *record,int inx); extern int mi_rsame_with_pos(struct st_myisam_info *file,uchar *record, int inx, my_off_t pos); extern int mi_update(struct st_myisam_info *file,const uchar *old, - uchar *new_record); + const uchar *new_record); extern int mi_write(struct st_myisam_info *file,uchar *buff); extern my_off_t mi_position(struct st_myisam_info *file); extern int mi_status(struct st_myisam_info *info, MI_ISAMINFO *x, uint flag); diff --git a/include/myisammrg.h b/include/myisammrg.h index 89293537989..952f3b02920 100644 --- a/include/myisammrg.h +++ b/include/myisammrg.h @@ -104,7 +104,8 @@ extern int myrg_rkey(MYRG_INFO *info,uchar *buf,int inx, const uchar *key, key_part_map keypart_map, enum ha_rkey_function search_flag); extern int myrg_rrnd(MYRG_INFO *file,uchar *buf,ulonglong pos); extern int myrg_rsame(MYRG_INFO *file,uchar *record,int inx); -extern int myrg_update(MYRG_INFO *file,const uchar *old,uchar *new_rec); +extern int myrg_update(MYRG_INFO *file,const uchar *old, + const uchar *new_rec); extern int myrg_write(MYRG_INFO *info,uchar *rec); extern int myrg_status(MYRG_INFO *file,MYMERGE_INFO *x,int flag); extern int myrg_lock_database(MYRG_INFO *file,int lock_type); diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 54da823c439..a05c6a78cdb 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -3210,3 +3210,48 @@ DROP TABLE t1,t2; # # End of 10.1 tests # +# +# Start of 10.3 tests +# +# +# MDEV-12515 Wrong value when storing DATE_ADD() and ADDTIME() to a numeric field +# +SET sql_mode=''; +CREATE TABLE t1 AS SELECT +DATE_ADD('2001-01-01',INTERVAL 1 DAY) AS c1, +ADDTIME('10:20:30',1) AS c2; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) DEFAULT NULL, + `c2` varchar(26) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM t1; +c1 c2 +2001-01-02 10:20:31 +DROP TABLE t1; +CREATE TABLE t2 (c INT); +INSERT INTO t2 SELECT DATE_ADD('2001-01-01',INTERVAL 1 DAY); +Warnings: +Warning 1265 Data truncated for column 'c' at row 1 +INSERT INTO t2 VALUES ('2001-01-02'); +Warnings: +Warning 1265 Data truncated for column 'c' at row 1 +SELECT * FROM t2; +c +2001 +2001 +DROP TABLE t2; +CREATE TABLE t2 (a INT); +INSERT INTO t2 VALUES (ADDTIME('10:20:30',1)); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +INSERT INTO t2 VALUES ('10:20:31'); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +SELECT * FROM t2; +a +10 +10 +DROP TABLE t2; +SET sql_mode=DEFAULT; diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index e7132331806..6a7b7e7b8bf 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -3902,5 +3902,36 @@ SELECT 1 MOD COALESCE(a) FROM t1; ERROR HY000: Illegal parameter data types bigint and geometry for operation '%' DROP TABLE t1; # +# MDEV-12514 Split Item_temporal_func::fix_length_and_dec() +# +SELECT DATE_ADD(POINT(1,1), INTERVAL 10 DAY); +ERROR HY000: Illegal parameter data types geometry and interval for operation 'date_add_interval' +SELECT DATE_SUB(POINT(1,1), INTERVAL 10 DAY); +ERROR HY000: Illegal parameter data types geometry and interval for operation 'date_add_interval' +SELECT POINT(1,1) + INTERVAL 10 DAY; +ERROR HY000: Illegal parameter data types geometry and interval for operation 'date_add_interval' +SELECT POINT(1,1) - INTERVAL 10 DAY; +ERROR HY000: Illegal parameter data types geometry and interval for operation 'date_add_interval' +SELECT INTERVAL 10 DAY + POINT(1,1); +ERROR HY000: Illegal parameter data types geometry and interval for operation 'date_add_interval' +SELECT INTERVAL 10 DAY + POINT(1,1); +ERROR HY000: Illegal parameter data types geometry and interval for operation 'date_add_interval' +SELECT ADDTIME(POINT(1,1), '10:10:10'); +ERROR HY000: Illegal parameter data types geometry and varchar for operation 'add_time' +SELECT ADDTIME('10:10:10', POINT(1,1)); +ERROR HY000: Illegal parameter data types varchar and geometry for operation 'add_time' +SELECT ADDTIME(POINT(1,1), TIME'10:10:10'); +ERROR HY000: Illegal parameter data types geometry and time for operation 'add_time' +SELECT ADDTIME(TIME'10:10:10', POINT(1,1)); +ERROR HY000: Illegal parameter data types time and geometry for operation 'add_time' +SELECT ADDTIME(POINT(1,1), TIMESTAMP'2001-01-01 10:10:10'); +ERROR HY000: Illegal parameter data types geometry and datetime for operation 'add_time' +SELECT ADDTIME(TIMESTAMP'2001-01-01 10:10:10', POINT(1,1)); +ERROR HY000: Illegal parameter data types datetime and geometry for operation 'add_time' +SELECT STR_TO_DATE(POINT(1,1),'%M %d,%Y'); +ERROR HY000: Illegal parameter data types geometry and varchar for operation 'str_to_date' +SELECT STR_TO_DATE('2001-01-01', POINT(1,1)); +ERROR HY000: Illegal parameter data types varchar and geometry for operation 'str_to_date' +# # End of 10.3 tests # diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 6e0169d97ca..e8d1d4e79e3 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -1817,3 +1817,35 @@ DROP TABLE t1,t2; --echo # --echo # End of 10.1 tests --echo # + + +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-12515 Wrong value when storing DATE_ADD() and ADDTIME() to a numeric field +--echo # + +SET sql_mode=''; + +CREATE TABLE t1 AS SELECT + DATE_ADD('2001-01-01',INTERVAL 1 DAY) AS c1, + ADDTIME('10:20:30',1) AS c2; +SHOW CREATE TABLE t1; +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t2 (c INT); +INSERT INTO t2 SELECT DATE_ADD('2001-01-01',INTERVAL 1 DAY); +INSERT INTO t2 VALUES ('2001-01-02'); +SELECT * FROM t2; +DROP TABLE t2; + +CREATE TABLE t2 (a INT); +INSERT INTO t2 VALUES (ADDTIME('10:20:30',1)); +INSERT INTO t2 VALUES ('10:20:31'); +SELECT * FROM t2; +DROP TABLE t2; + +SET sql_mode=DEFAULT; diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index a19de83f046..1b355b70bc6 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -2090,6 +2090,40 @@ SELECT 1 MOD COALESCE(a) FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-12514 Split Item_temporal_func::fix_length_and_dec() +--echo # + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT DATE_ADD(POINT(1,1), INTERVAL 10 DAY); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT DATE_SUB(POINT(1,1), INTERVAL 10 DAY); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT POINT(1,1) + INTERVAL 10 DAY; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT POINT(1,1) - INTERVAL 10 DAY; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT INTERVAL 10 DAY + POINT(1,1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT INTERVAL 10 DAY + POINT(1,1); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT ADDTIME(POINT(1,1), '10:10:10'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT ADDTIME('10:10:10', POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT ADDTIME(POINT(1,1), TIME'10:10:10'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT ADDTIME(TIME'10:10:10', POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT ADDTIME(POINT(1,1), TIMESTAMP'2001-01-01 10:10:10'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT ADDTIME(TIMESTAMP'2001-01-01 10:10:10', POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT STR_TO_DATE(POINT(1,1),'%M %d,%Y'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT STR_TO_DATE('2001-01-01', POINT(1,1)); --echo # --echo # End of 10.3 tests diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index b27de9dad4d..79b49eb1edb 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -4204,7 +4204,7 @@ exit: old_data is always record[1] */ -int ha_partition::update_row(const uchar *old_data, uchar *new_data) +int ha_partition::update_row(const uchar *old_data, const uchar *new_data) { THD *thd= ha_thd(); uint32 new_part_id, old_part_id; @@ -4280,7 +4280,7 @@ int ha_partition::update_row(const uchar *old_data, uchar *new_data) DBUG_PRINT("info", ("Update from partition %d to partition %d", old_part_id, new_part_id)); tmp_disable_binlog(thd); /* Do not replicate the low-level changes. */ - error= m_file[new_part_id]->ha_write_row(new_data); + error= m_file[new_part_id]->ha_write_row((uchar*) new_data); reenable_binlog(thd); table->next_number_field= saved_next_number_field; if (error) diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 70ec4ae8edb..46fca544279 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -485,7 +485,7 @@ public: number of calls to write_row. */ virtual int write_row(uchar * buf); - virtual int update_row(const uchar * old_data, uchar * new_data); + virtual int update_row(const uchar * old_data, const uchar * new_data); virtual int delete_row(const uchar * buf); virtual int delete_all_rows(void); virtual int truncate(); diff --git a/sql/ha_sequence.cc b/sql/ha_sequence.cc index f3c4d8961a8..70d16516241 100644 --- a/sql/ha_sequence.cc +++ b/sql/ha_sequence.cc @@ -231,7 +231,7 @@ int ha_sequence::write_row(uchar *buf) } -int ha_sequence::update_row(const uchar *old_data, uchar *new_data) +int ha_sequence::update_row(const uchar *old_data, const uchar *new_data) { int error; sequence_definition tmp_seq; diff --git a/sql/ha_sequence.h b/sql/ha_sequence.h index aeb7ff3fd58..ff8e4263692 100644 --- a/sql/ha_sequence.h +++ b/sql/ha_sequence.h @@ -69,7 +69,7 @@ public: HA_CREATE_INFO *create_info); handler *clone(const char *name, MEM_ROOT *mem_root); int write_row(uchar *buf); - int update_row(const uchar *old_data, uchar *new_data); + int update_row(const uchar *old_data, const uchar *new_data); Table_flags table_flags() const; /* One can't delete from sequence engine */ int delete_row(const uchar *buf) diff --git a/sql/handler.cc b/sql/handler.cc index 5d0ec99e978..fb4384a8bc5 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -4042,7 +4042,7 @@ int handler::ha_repair(THD* thd, HA_CHECK_OPT* check_opt) */ int -handler::ha_bulk_update_row(const uchar *old_data, uchar *new_data, +handler::ha_bulk_update_row(const uchar *old_data, const uchar *new_data, uint *dup_key_found) { DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE || @@ -5998,7 +5998,7 @@ int handler::ha_write_row(uchar *buf) } -int handler::ha_update_row(const uchar *old_data, uchar *new_data) +int handler::ha_update_row(const uchar *old_data, const uchar *new_data) { int error; Log_func *log_func= Update_rows_log_event::binlog_row_logging_function; diff --git a/sql/handler.h b/sql/handler.h index e6615695ce7..f283a17fb12 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1483,13 +1483,15 @@ struct THD_TRANS unsigned int m_unsafe_rollback_flags; /* - Define the type of statemens which cannot be rolled back safely. + Define the type of statements which cannot be rolled back safely. Each type occupies one bit in m_unsafe_rollback_flags. */ - static unsigned int const MODIFIED_NON_TRANS_TABLE= 0x01; - static unsigned int const CREATED_TEMP_TABLE= 0x02; - static unsigned int const DROPPED_TEMP_TABLE= 0x04; - static unsigned int const DID_WAIT= 0x08; + enum unsafe_statement_types + { + CREATED_TEMP_TABLE= 2, + DROPPED_TEMP_TABLE= 4, + DID_WAIT= 8 + }; void mark_created_temp_table() { @@ -2890,7 +2892,7 @@ public: */ int ha_external_lock(THD *thd, int lock_type); int ha_write_row(uchar * buf); - int ha_update_row(const uchar * old_data, uchar * new_data); + int ha_update_row(const uchar * old_data, const uchar * new_data); int ha_delete_row(const uchar * buf); void ha_release_auto_increment(); @@ -2929,7 +2931,7 @@ public: int ret= end_bulk_insert(); DBUG_RETURN(ret); } - int ha_bulk_update_row(const uchar *old_data, uchar *new_data, + int ha_bulk_update_row(const uchar *old_data, const uchar *new_data, uint *dup_key_found); int ha_delete_all_rows(); int ha_truncate(); @@ -4047,7 +4049,7 @@ private: message will contain garbage. */ virtual int update_row(const uchar *old_data __attribute__((unused)), - uchar *new_data __attribute__((unused))) + const uchar *new_data __attribute__((unused))) { return HA_ERR_WRONG_COMMAND; } @@ -4135,7 +4137,7 @@ public: @retval 0 Bulk delete used by handler @retval 1 Bulk delete not used, normal operation used */ - virtual int bulk_update_row(const uchar *old_data, uchar *new_data, + virtual int bulk_update_row(const uchar *old_data, const uchar *new_data, uint *dup_key_found) { DBUG_ASSERT(FALSE); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index f5ba6f206c2..6d2135db91e 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -3315,14 +3315,6 @@ my_decimal *Item_func_coalesce::decimal_op(my_decimal *decimal_value) } -bool Item_hybrid_func::fix_attributes(Item **items, uint nitems) -{ - bool rc= Item_hybrid_func::type_handler()-> - Item_hybrid_func_fix_attributes(current_thd, this, items, nitems); - DBUG_ASSERT(!rc || current_thd->is_error()); - return rc; -} - /**************************************************************************** Classes and function for the IN operator ****************************************************************************/ diff --git a/sql/item_func.cc b/sql/item_func.cc index 8f60cfbd7cb..f25ba12b83c 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -543,6 +543,15 @@ my_decimal *Item_func::val_decimal(my_decimal *decimal_value) } +bool Item_hybrid_func::fix_attributes(Item **items, uint nitems) +{ + bool rc= Item_hybrid_func::type_handler()-> + Item_hybrid_func_fix_attributes(current_thd, this, items, nitems); + DBUG_ASSERT(!rc || current_thd->is_error()); + return rc; +} + + String *Item_real_func::val_str(String *str) { DBUG_ASSERT(fixed == 1); diff --git a/sql/item_func.h b/sql/item_func.h index 7f9321f017d..a367a0d74c4 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -75,18 +75,10 @@ public: { return count_string_length(item, nitems); } - void set_attributes_temporal(uint int_part_length, uint dec) - { - collation.set_numeric(); - unsigned_flag= 0; - decimals= MY_MIN(dec, TIME_SECOND_PART_DIGITS); - uint length= decimals + int_part_length + (dec ? 1 : 0); - fix_char_length(length); - } void aggregate_attributes_temporal(uint int_part_length, Item **item, uint nitems) { - set_attributes_temporal(int_part_length, count_max_decimals(item, nitems)); + fix_attributes_temporal(int_part_length, count_max_decimals(item, nitems)); } table_map not_null_tables_cache; diff --git a/sql/item_sum.h b/sql/item_sum.h index ee1c10f9fbe..98b027de41d 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -1153,7 +1153,7 @@ public: } protected: - static const int NUM_BIT_COUNTERS= 64; + enum bit_counters { NUM_BIT_COUNTERS= 64 }; ulonglong reset_bits,bits; /* Marks whether the function is to be computed as a window function. diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 174f8ffb9fa..a4a1f900fce 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1458,34 +1458,6 @@ bool get_interval_value(Item *args,interval_type int_type, INTERVAL *interval) } -void Item_temporal_func::fix_length_and_dec() -{ - uint char_length= mysql_temporal_int_part_length(field_type()); - /* - We set maybe_null to 1 as default as any bad argument with date or - time can get us to return NULL. - */ - maybe_null= (arg_count > 0); - if (decimals) - { - if (decimals == NOT_FIXED_DEC) - char_length+= TIME_SECOND_PART_DIGITS + 1; - else - { - set_if_smaller(decimals, TIME_SECOND_PART_DIGITS); - char_length+= decimals + 1; - } - } - sql_mode= current_thd->variables.sql_mode & - (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE); - collation.set(field_type() == MYSQL_TYPE_STRING ? - default_charset() : &my_charset_numeric, - field_type() == MYSQL_TYPE_STRING ? - DERIVATION_COERCIBLE : DERIVATION_NUMERIC, - MY_REPERTOIRE_ASCII); - fix_char_length(char_length); -} - String *Item_temporal_func::val_str(String *str) { DBUG_ASSERT(fixed == 1); @@ -2009,8 +1981,8 @@ void Item_func_from_unixtime::fix_length_and_dec() THD *thd= current_thd; thd->time_zone_used= 1; tz= thd->variables.time_zone; - decimals= args[0]->decimals; - Item_temporal_func::fix_length_and_dec(); + fix_attributes_datetime_not_fixed_dec(args[0]->decimals); + maybe_null= true; } @@ -2039,8 +2011,8 @@ bool Item_func_from_unixtime::get_date(MYSQL_TIME *ltime, void Item_func_convert_tz::fix_length_and_dec() { - decimals= args[0]->temporal_precision(MYSQL_TYPE_DATETIME); - Item_temporal_func::fix_length_and_dec(); + fix_attributes_datetime(args[0]->temporal_precision(MYSQL_TYPE_DATETIME)); + maybe_null= true; } @@ -2093,6 +2065,13 @@ void Item_date_add_interval::fix_length_and_dec() { enum_field_types arg0_field_type; + if (!args[0]->type_handler()->is_traditional_type()) + { + my_error(ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION, MYF(0), + args[0]->type_handler()->name().ptr(), + "interval", func_name()); + return; + } /* The field type for the result of an Item_datefunc is defined as follows: @@ -2108,7 +2087,6 @@ void Item_date_add_interval::fix_length_and_dec() (This is because you can't know if the string contains a DATE, MYSQL_TIME or DATETIME argument) */ - set_handler_by_field_type(MYSQL_TYPE_STRING); arg0_field_type= args[0]->field_type(); uint interval_dec= 0; if (int_type == INTERVAL_MICROSECOND || @@ -2121,30 +2099,47 @@ void Item_date_add_interval::fix_length_and_dec() if (arg0_field_type == MYSQL_TYPE_DATETIME || arg0_field_type == MYSQL_TYPE_TIMESTAMP) { - decimals= MY_MAX(args[0]->temporal_precision(MYSQL_TYPE_DATETIME), interval_dec); - set_handler_by_field_type(MYSQL_TYPE_DATETIME); + uint dec= MY_MAX(args[0]->temporal_precision(MYSQL_TYPE_DATETIME), + interval_dec); + set_handler(&type_handler_datetime); + fix_attributes_datetime(dec); } else if (arg0_field_type == MYSQL_TYPE_DATE) { if (int_type <= INTERVAL_DAY || int_type == INTERVAL_YEAR_MONTH) - set_handler_by_field_type(arg0_field_type); + { + set_handler(&type_handler_newdate); + fix_attributes_date(); + } else { - decimals= interval_dec; - set_handler_by_field_type(MYSQL_TYPE_DATETIME); + set_handler(&type_handler_datetime2); + fix_attributes_datetime(interval_dec); } } else if (arg0_field_type == MYSQL_TYPE_TIME) { - decimals= MY_MAX(args[0]->temporal_precision(MYSQL_TYPE_TIME), interval_dec); + uint dec= MY_MAX(args[0]->temporal_precision(MYSQL_TYPE_TIME), interval_dec); if (int_type >= INTERVAL_DAY && int_type != INTERVAL_YEAR_MONTH) - set_handler_by_field_type(arg0_field_type); + { + set_handler(&type_handler_time2); + fix_attributes_time(dec); + } else - set_handler_by_field_type(MYSQL_TYPE_DATETIME); + { + set_handler(&type_handler_datetime2); + fix_attributes_datetime(dec); + } } else - decimals= MY_MAX(args[0]->temporal_precision(MYSQL_TYPE_DATETIME), interval_dec); - Item_temporal_func::fix_length_and_dec(); + { + uint dec= MY_MAX(args[0]->temporal_precision(MYSQL_TYPE_DATETIME), + interval_dec); + set_handler(&type_handler_string); + collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII); + fix_char_length_temporal_not_fixed_dec(MAX_DATETIME_WIDTH, dec); + } + maybe_null= true; } @@ -2649,8 +2644,15 @@ err: void Item_func_add_time::fix_length_and_dec() { enum_field_types arg0_field_type; - decimals= MY_MAX(args[0]->decimals, args[1]->decimals); + if (!args[0]->type_handler()->is_traditional_type() || + !args[1]->type_handler()->is_traditional_type()) + { + my_error(ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION, MYF(0), + args[0]->type_handler()->name().ptr(), + args[1]->type_handler()->name().ptr(), func_name()); + return; + } /* The field type for the result of an Item_func_add_time function is defined as follows: @@ -2661,24 +2663,32 @@ void Item_func_add_time::fix_length_and_dec() - Otherwise the result is MYSQL_TYPE_STRING */ - set_handler_by_field_type(MYSQL_TYPE_STRING); arg0_field_type= args[0]->field_type(); if (arg0_field_type == MYSQL_TYPE_DATE || arg0_field_type == MYSQL_TYPE_DATETIME || arg0_field_type == MYSQL_TYPE_TIMESTAMP || is_date) { - set_handler_by_field_type(MYSQL_TYPE_DATETIME); - decimals= MY_MAX(args[0]->temporal_precision(MYSQL_TYPE_DATETIME), + uint dec= MY_MAX(args[0]->temporal_precision(MYSQL_TYPE_DATETIME), args[1]->temporal_precision(MYSQL_TYPE_TIME)); + set_handler(&type_handler_datetime2); + fix_attributes_datetime(dec); } else if (arg0_field_type == MYSQL_TYPE_TIME) { - set_handler_by_field_type(MYSQL_TYPE_TIME); - decimals= MY_MAX(args[0]->temporal_precision(MYSQL_TYPE_TIME), + uint dec= MY_MAX(args[0]->temporal_precision(MYSQL_TYPE_TIME), args[1]->temporal_precision(MYSQL_TYPE_TIME)); + set_handler(&type_handler_time2); + fix_attributes_time(dec); } - Item_temporal_func::fix_length_and_dec(); + else + { + uint dec= MY_MAX(args[0]->decimals, args[1]->decimals); + set_handler(&type_handler_string); + collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII); + fix_char_length_temporal_not_fixed_dec(MAX_DATETIME_WIDTH, dec); + } + maybe_null= true; } /** @@ -3169,6 +3179,14 @@ get_date_time_result_type(const char *format, uint length) void Item_func_str_to_date::fix_length_and_dec() { + if (!args[0]->type_handler()->is_traditional_type() || + !args[1]->type_handler()->is_traditional_type()) + { + my_error(ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION, MYF(0), + args[0]->type_handler()->name().ptr(), + args[1]->type_handler()->name().ptr(), func_name()); + return; + } if (agg_arg_charsets(collation, args, 2, MY_COLL_ALLOW_CONV, 1)) return; if (collation.collation->mbminlen > 1) @@ -3180,8 +3198,10 @@ void Item_func_str_to_date::fix_length_and_dec() #endif } - set_handler_by_field_type(MYSQL_TYPE_DATETIME); - decimals= TIME_SECOND_PART_DIGITS; + maybe_null= true; + set_handler(&type_handler_datetime2); + fix_attributes_datetime(TIME_SECOND_PART_DIGITS); + if ((const_item= args[1]->const_item())) { char format_buff[64]; @@ -3195,25 +3215,29 @@ void Item_func_str_to_date::fix_length_and_dec() get_date_time_result_type(format->ptr(), format->length()); switch (cached_format_type) { case DATE_ONLY: - set_handler_by_field_type(MYSQL_TYPE_DATE); + set_handler(&type_handler_newdate); + fix_attributes_date(); break; case TIME_MICROSECOND: - decimals= 6; - /* fall through */ + set_handler(&type_handler_time2); + fix_attributes_time(TIME_SECOND_PART_DIGITS); + break; case TIME_ONLY: - set_handler_by_field_type(MYSQL_TYPE_TIME); + set_handler(&type_handler_time2); + fix_attributes_time(0); break; case DATE_TIME_MICROSECOND: - decimals= 6; - /* fall through */ + set_handler(&type_handler_datetime2); + fix_attributes_datetime(TIME_SECOND_PART_DIGITS); + break; case DATE_TIME: - set_handler_by_field_type(MYSQL_TYPE_DATETIME); + set_handler(&type_handler_datetime2); + fix_attributes_datetime(0); break; } } } cached_timestamp_type= mysql_type_to_time_type(field_type()); - Item_temporal_func::fix_length_and_dec(); } diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 6ee565236c3..40b8c169c80 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -31,16 +31,6 @@ enum date_time_format_types }; -static inline uint -mysql_temporal_int_part_length(enum enum_field_types mysql_type) -{ - static uint max_time_type_width[5]= - { MAX_DATETIME_WIDTH, MAX_DATETIME_WIDTH, MAX_DATE_WIDTH, - MAX_DATETIME_WIDTH, MIN_TIME_WIDTH }; - return max_time_type_width[mysql_type_to_time_type(mysql_type)+2]; -} - - bool get_interval_value(Item *args,interval_type int_type, INTERVAL *interval); class Item_func_period_add :public Item_int_func @@ -531,7 +521,6 @@ public: class Item_temporal_func: public Item_func { - sql_mode_t sql_mode; public: Item_temporal_func(THD *thd): Item_func(thd) {} Item_temporal_func(THD *thd, Item *a): Item_func(thd, a) {} @@ -549,7 +538,6 @@ public: { return tmp_table_field_from_field_type(table, false, false); } int save_in_field(Field *field, bool no_conversions) { return save_date_in_field(field, no_conversions); } - void fix_length_and_dec(); }; @@ -557,22 +545,20 @@ public: Abstract class for functions returning TIME, DATE, DATETIME or string values, whose data type depends on parameters and is set at fix_fields time. */ -class Item_temporal_hybrid_func: public Item_temporal_func, - public Type_handler_hybrid_field_type +class Item_temporal_hybrid_func: public Item_hybrid_func { protected: String ascii_buf; // Conversion buffer public: Item_temporal_hybrid_func(THD *thd, Item *a, Item *b): - Item_temporal_func(thd, a, b) {} - const Type_handler *type_handler() const - { return Type_handler_hybrid_field_type::type_handler(); } - enum_field_types field_type() const - { return Type_handler_hybrid_field_type::field_type(); } - enum Item_result result_type () const - { return Type_handler_hybrid_field_type::result_type(); } - enum Item_result cmp_type () const - { return Type_handler_hybrid_field_type::cmp_type(); } + Item_hybrid_func(thd, a, b) {} + + longlong val_int() { return val_int_from_date(); } + double val_real() { return val_real_from_date(); } + bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date)= 0; + my_decimal *val_decimal(my_decimal *decimal_value) + { return val_decimal_from_date(decimal_value); } + /** Fix the returned timestamp to match field_type(), which is important for val_str(). @@ -597,7 +583,13 @@ class Item_datefunc :public Item_temporal_func public: Item_datefunc(THD *thd): Item_temporal_func(thd) { } Item_datefunc(THD *thd, Item *a): Item_temporal_func(thd, a) { } + Item_datefunc(THD *thd, Item *a, Item *b): Item_temporal_func(thd, a, b) { } enum_field_types field_type() const { return MYSQL_TYPE_DATE; } + void fix_length_and_dec() + { + fix_attributes_date(); + maybe_null= (arg_count > 0); + } }; @@ -634,6 +626,7 @@ public: Item_func_curtime(THD *thd, uint dec): Item_timefunc(thd), last_query_id(0) { decimals= dec; } bool fix_fields(THD *, Item **); + void fix_length_and_dec() { fix_attributes_time(decimals); } bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date); /* Abstract method that defines which time zone is used for conversion. @@ -721,6 +714,7 @@ public: Item_func_now(THD *thd, uint dec): Item_datetimefunc(thd), last_query_id(0) { decimals= dec; } bool fix_fields(THD *, Item **); + void fix_length_and_dec() { fix_attributes_datetime(decimals); } bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date); virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)=0; bool check_vcol_func_processor(void *arg) @@ -885,8 +879,8 @@ public: bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date); void fix_length_and_dec() { - decimals= MY_MIN(args[0]->decimals, TIME_SECOND_PART_DIGITS); - Item_timefunc::fix_length_and_dec(); + fix_attributes_time(args[0]->decimals); + maybe_null= true; } const char *func_name() const { return "sec_to_time"; } Item *get_copy(THD *thd, MEM_ROOT *mem_root) @@ -1065,11 +1059,12 @@ public: Item_temporal_typecast(THD *thd, Item *a): Item_temporal_func(thd, a) {} virtual const char *cast_type() const = 0; void print(String *str, enum_query_type query_type); - void fix_length_and_dec_generic() + void fix_length_and_dec_generic(uint int_part_len) { if (decimals == NOT_FIXED_DEC) decimals= args[0]->temporal_precision(field_type()); - Item_temporal_func::fix_length_and_dec(); + fix_attributes_temporal(int_part_len, decimals); + maybe_null= true; } }; @@ -1126,13 +1121,12 @@ public: }; -class Item_func_makedate :public Item_temporal_func +class Item_func_makedate :public Item_datefunc { public: Item_func_makedate(THD *thd, Item *a, Item *b): - Item_temporal_func(thd, a, b) {} + Item_datefunc(thd, a, b) {} const char *func_name() const { return "makedate"; } - enum_field_types field_type() const { return MYSQL_TYPE_DATE; } bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date); Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } @@ -1163,9 +1157,10 @@ public: const char *func_name() const { return "timediff"; } void fix_length_and_dec() { - decimals= MY_MAX(args[0]->temporal_precision(MYSQL_TYPE_TIME), + uint dec= MY_MAX(args[0]->temporal_precision(MYSQL_TYPE_TIME), args[1]->temporal_precision(MYSQL_TYPE_TIME)); - Item_timefunc::fix_length_and_dec(); + fix_attributes_time(dec); + maybe_null= true; } bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date); Item *get_copy(THD *thd, MEM_ROOT *mem_root) @@ -1180,8 +1175,8 @@ public: {} void fix_length_and_dec() { - decimals= MY_MIN(args[2]->decimals, TIME_SECOND_PART_DIGITS); - Item_timefunc::fix_length_and_dec(); + fix_attributes_time(args[2]->decimals); + maybe_null= true; } const char *func_name() const { return "maketime"; } bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date); diff --git a/sql/key.cc b/sql/key.cc index 0c931184da7..c2d22005736 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -112,7 +112,7 @@ int find_ref_key(KEY *key, uint key_count, uchar *record, Field *field, @param with_zerofill skipped bytes in the key buffer to be filled with 0 */ -void key_copy(uchar *to_key, uchar *from_record, KEY *key_info, +void key_copy(uchar *to_key, const uchar *from_record, KEY *key_info, uint key_length, bool with_zerofill) { uint length; diff --git a/sql/key.h b/sql/key.h index f2521e4a665..7b83d74c901 100644 --- a/sql/key.h +++ b/sql/key.h @@ -27,8 +27,8 @@ typedef struct st_key_part_info KEY_PART_INFO; int find_ref_key(KEY *key, uint key_count, uchar *record, Field *field, uint *key_length, uint *keypart); -void key_copy(uchar *to_key, uchar *from_record, KEY *key_info, uint key_length, - bool with_zerofill= FALSE); +void key_copy(uchar *to_key, const uchar *from_record, KEY *key_info, + uint key_length, bool with_zerofill= FALSE); void key_restore(uchar *to_record, const uchar *from_key, KEY *key_info, uint key_length); bool key_cmp_if_same(TABLE *form,const uchar *key,uint index,uint key_length); diff --git a/sql/log_event.h b/sql/log_event.h index ccbc0527bd2..57692803b5b 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -3459,7 +3459,7 @@ public: The three elements in the body repeat COUNT times to form the GTID list. - At the time of writing, only one flag bit is in use. + At the time of writing, only two flag bit are in use. Bit 28 of `count' is used for flag FLAG_UNTIL_REACHED, which is sent in a Gtid_list event from the master to the slave to indicate that the START @@ -3477,9 +3477,12 @@ public: uint64 *sub_id_list; static const uint element_size= 4+4+8; - static const uint32 FLAG_UNTIL_REACHED= (1<<28); - static const uint32 FLAG_IGN_GTIDS= (1<<29); - + /* Upper bits stored in 'count'. See comment above */ + enum gtid_flags + { + FLAG_UNTIL_REACHED= (1<<28), + FLAG_IGN_GTIDS= (1<<29), + }; #ifdef MYSQL_SERVER Gtid_list_log_event(rpl_binlog_state *gtid_set, uint32 gl_flags); Gtid_list_log_event(slave_connection_state *gtid_set, uint32 gl_flags); diff --git a/sql/rpl_gtid.h b/sql/rpl_gtid.h index f638a084e38..f8a13d7bf3f 100644 --- a/sql/rpl_gtid.h +++ b/sql/rpl_gtid.h @@ -270,8 +270,12 @@ struct slave_connection_state rpl_gtid gtid; uint32 flags; }; - static const uint32 START_OWN_SLAVE_POS= 0x1; - static const uint32 START_ON_EMPTY_DOMAIN= 0x2; + /* Bits for 'flags' */ + enum start_flags + { + START_OWN_SLAVE_POS= 0x1, + START_ON_EMPTY_DOMAIN= 0x2 + }; /* Mapping from domain_id to the entry with GTID requested for that domain. */ HASH hash; diff --git a/sql/rpl_parallel.h b/sql/rpl_parallel.h index a0faeae815c..4579d0da9bc 100644 --- a/sql/rpl_parallel.h +++ b/sql/rpl_parallel.h @@ -68,23 +68,27 @@ struct group_commit_orderer { */ bool installed; - /* - This flag is set for a GCO in which we have event groups with multiple - different commit_id values from the master. This happens when we - optimistically try to execute in parallel transactions not known to be - conflict-free. + enum force_switch_bits + { + /* + This flag is set for a GCO in which we have event groups with multiple + different commit_id values from the master. This happens when we + optimistically try to execute in parallel transactions not known to be + conflict-free. - When this flag is set, in case of DDL we need to start a new GCO regardless - of current commit_id, as DDL is not safe to speculatively apply in parallel - with prior event groups. - */ - static const uint8 MULTI_BATCH = 0x01; - /* - This flag is set for a GCO that contains DDL. If set, it forces a switch to - a new GCO upon seeing a new commit_id, as DDL is not safe to speculatively - replicate in parallel with subsequent transactions. - */ - static const uint8 FORCE_SWITCH = 0x02; + When this flag is set, in case of DDL we need to start a new GCO + regardless of current commit_id, as DDL is not safe to + speculatively apply in parallel with prior event groups. + */ + MULTI_BATCH= 1, + /* + This flag is set for a GCO that contains DDL. If set, it forces + a switch to a new GCO upon seeing a new commit_id, as DDL is not + safe to speculatively replicate in parallel with subsequent + transactions. + */ + FORCE_SWITCH= 2 + }; uint8 flags; }; diff --git a/sql/sql_alter.h b/sql/sql_alter.h index 5668a0f52be..4650e2b6a25 100644 --- a/sql/sql_alter.h +++ b/sql/sql_alter.h @@ -38,91 +38,65 @@ public: type of index to be added/dropped. */ - // Set for ADD [COLUMN] - static const uint ALTER_ADD_COLUMN = 1L << 0; - - // Set for DROP [COLUMN] - static const uint ALTER_DROP_COLUMN = 1L << 1; - - // Set for CHANGE [COLUMN] | MODIFY [CHANGE] - // Set by mysql_recreate_table() - static const uint ALTER_CHANGE_COLUMN = 1L << 2; - - // Set for ADD INDEX | ADD KEY | ADD PRIMARY KEY | ADD UNIQUE KEY | - // ADD UNIQUE INDEX | ALTER ADD [COLUMN] - static const uint ALTER_ADD_INDEX = 1L << 3; - - // Set for DROP PRIMARY KEY | DROP FOREIGN KEY | DROP KEY | DROP INDEX - static const uint ALTER_DROP_INDEX = 1L << 4; - - // Set for RENAME [TO] - static const uint ALTER_RENAME = 1L << 5; - - // Set for ORDER BY - static const uint ALTER_ORDER = 1L << 6; - - // Set for table_options - static const uint ALTER_OPTIONS = 1L << 7; - - // Set for ALTER [COLUMN] ... SET DEFAULT ... | DROP DEFAULT - static const uint ALTER_CHANGE_COLUMN_DEFAULT = 1L << 8; - - // Set for DISABLE KEYS | ENABLE KEYS - static const uint ALTER_KEYS_ONOFF = 1L << 9; - - // Set for FORCE - // Set for ENGINE(same engine) - // Set by mysql_recreate_table() - static const uint ALTER_RECREATE = 1L << 10; - - // Set for ADD PARTITION - static const uint ALTER_ADD_PARTITION = 1L << 11; - - // Set for DROP PARTITION - static const uint ALTER_DROP_PARTITION = 1L << 12; - - // Set for COALESCE PARTITION - static const uint ALTER_COALESCE_PARTITION = 1L << 13; - - // Set for REORGANIZE PARTITION ... INTO - static const uint ALTER_REORGANIZE_PARTITION = 1L << 14; - - // Set for partition_options - static const uint ALTER_PARTITION = 1L << 15; - - // Set for LOAD INDEX INTO CACHE ... PARTITION - // Set for CACHE INDEX ... PARTITION - static const uint ALTER_ADMIN_PARTITION = 1L << 16; - - // Set for REORGANIZE PARTITION - static const uint ALTER_TABLE_REORG = 1L << 17; - - // Set for REBUILD PARTITION - static const uint ALTER_REBUILD_PARTITION = 1L << 18; - - // Set for partitioning operations specifying ALL keyword - static const uint ALTER_ALL_PARTITION = 1L << 19; - - // Set for REMOVE PARTITIONING - static const uint ALTER_REMOVE_PARTITIONING = 1L << 20; - - // Set for ADD FOREIGN KEY - static const uint ADD_FOREIGN_KEY = 1L << 21; - - // Set for DROP FOREIGN KEY - static const uint DROP_FOREIGN_KEY = 1L << 22; - - // Set for EXCHANGE PARITION - static const uint ALTER_EXCHANGE_PARTITION = 1L << 23; - - // Set by Sql_cmd_alter_table_truncate_partition::execute() - static const uint ALTER_TRUNCATE_PARTITION = 1L << 24; - - // Set for ADD [COLUMN] FIRST | AFTER - static const uint ALTER_COLUMN_ORDER = 1L << 25; - - static const uint ALTER_ADD_CHECK_CONSTRAINT = 1L << 27; - static const uint ALTER_DROP_CHECK_CONSTRAINT = 1L << 28; + enum operations_used_flags + { + // Set for ADD [COLUMN] + ALTER_ADD_COLUMN = 1L << 0, + // Set for DROP [COLUMN] + ALTER_DROP_COLUMN = 1L << 1, + // Set for CHANGE [COLUMN] | MODIFY [CHANGE] & mysql_recreate_table + ALTER_CHANGE_COLUMN = 1L << 2, + // Set for ADD INDEX | ADD KEY | ADD PRIMARY KEY | ADD UNIQUE KEY | + // ADD UNIQUE INDEX | ALTER ADD [COLUMN] + ALTER_ADD_INDEX = 1L << 3, + // Set for DROP PRIMARY KEY | DROP FOREIGN KEY | DROP KEY | DROP INDEX + ALTER_DROP_INDEX = 1L << 4, + // Set for RENAME [TO] + ALTER_RENAME = 1L << 5, + // Set for ORDER BY + ALTER_ORDER = 1L << 6, + // Set for table_options + ALTER_OPTIONS = 1L << 7, + // Set for ALTER [COLUMN] ... SET DEFAULT ... | DROP DEFAULT + ALTER_CHANGE_COLUMN_DEFAULT = 1L << 8, + // Set for DISABLE KEYS | ENABLE KEYS + ALTER_KEYS_ONOFF = 1L << 9, + // Set for FORCE, ENGINE(same engine), by mysql_recreate_table() + ALTER_RECREATE = 1L << 10, + // Set for ADD PARTITION + ALTER_ADD_PARTITION = 1L << 11, + // Set for DROP PARTITION + ALTER_DROP_PARTITION = 1L << 12, + // Set for COALESCE PARTITION + ALTER_COALESCE_PARTITION = 1L << 13, + // Set for REORGANIZE PARTITION ... INTO + ALTER_REORGANIZE_PARTITION = 1L << 14, + // Set for partition_options + ALTER_PARTITION = 1L << 15, + // Set for LOAD INDEX INTO CACHE ... PARTITION + // Set for CACHE INDEX ... PARTITION + ALTER_ADMIN_PARTITION = 1L << 16, + // Set for REORGANIZE PARTITION + ALTER_TABLE_REORG = 1L << 17, + // Set for REBUILD PARTITION + ALTER_REBUILD_PARTITION = 1L << 18, + // Set for partitioning operations specifying ALL keyword + ALTER_ALL_PARTITION = 1L << 19, + // Set for REMOVE PARTITIONING + ALTER_REMOVE_PARTITIONING = 1L << 20, + // Set for ADD FOREIGN KEY + ADD_FOREIGN_KEY = 1L << 21, + // Set for DROP FOREIGN KEY + DROP_FOREIGN_KEY = 1L << 22, + // Set for EXCHANGE PARITION + ALTER_EXCHANGE_PARTITION = 1L << 23, + // Set by Sql_cmd_alter_table_truncate_partition::execute() + ALTER_TRUNCATE_PARTITION = 1L << 24, + // Set for ADD [COLUMN] FIRST | AFTER + ALTER_COLUMN_ORDER = 1L << 25, + ALTER_ADD_CHECK_CONSTRAINT = 1L << 27, + ALTER_DROP_CHECK_CONSTRAINT = 1L << 28 + }; enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE }; @@ -172,7 +146,10 @@ public: // List of columns, used by both CREATE and ALTER TABLE. List create_list; - static const uint CHECK_CONSTRAINT_IF_NOT_EXISTS= 1; + enum flags_bits + { + CHECK_CONSTRAINT_IF_NOT_EXISTS= 1 + }; List check_constraint_list; // Type of ALTER TABLE operation. uint flags; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 077c57a953e..f06b074dbe4 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3012,7 +3012,7 @@ static int mysql_create_routine(THD *thd, LEX *lex) return false; } #ifdef WITH_WSREP -error: +error: /* Used by WSREP_TO_ISOLATION_BEGIN */ #endif return true; } diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 0a146aeb12b..d226f7e05ba 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -282,7 +282,7 @@ bool partition_default_handling(THD *thd, TABLE *table, partition_info *part_inf > 0 Error code */ -int get_parts_for_update(const uchar *old_data, uchar *new_data, +int get_parts_for_update(const uchar *old_data, const uchar *new_data, const uchar *rec0, partition_info *part_info, uint32 *old_part_id, uint32 *new_part_id, longlong *new_func_value) diff --git a/sql/sql_partition.h b/sql/sql_partition.h index c2665a8366b..93e3bbba641 100644 --- a/sql/sql_partition.h +++ b/sql/sql_partition.h @@ -85,7 +85,7 @@ bool check_reorganise_list(partition_info *new_part_info, partition_info *old_part_info, List list_part_names); handler *get_ha_partition(partition_info *part_info); -int get_parts_for_update(const uchar *old_data, uchar *new_data, +int get_parts_for_update(const uchar *old_data, const uchar *new_data, const uchar *rec0, partition_info *part_info, uint32 *old_part_id, uint32 *new_part_id, longlong *func_value); diff --git a/sql/sql_type.cc b/sql/sql_type.cc index 337111f6e53..cf5e4e46400 100644 --- a/sql/sql_type.cc +++ b/sql/sql_type.cc @@ -26,14 +26,10 @@ static Type_handler_long type_handler_long; static Type_handler_int24 type_handler_int24; static Type_handler_year type_handler_year; static Type_handler_time type_handler_time; -static Type_handler_time2 type_handler_time2; static Type_handler_date type_handler_date; -static Type_handler_newdate type_handler_newdate; -static Type_handler_datetime2 type_handler_datetime2; static Type_handler_timestamp type_handler_timestamp; static Type_handler_timestamp2 type_handler_timestamp2; static Type_handler_olddecimal type_handler_olddecimal; -static Type_handler_string type_handler_string; static Type_handler_tiny_blob type_handler_tiny_blob; static Type_handler_medium_blob type_handler_medium_blob; static Type_handler_long_blob type_handler_long_blob; @@ -42,6 +38,7 @@ static Type_handler_blob type_handler_blob; Type_handler_null type_handler_null; Type_handler_row type_handler_row; +Type_handler_string type_handler_string; Type_handler_varchar type_handler_varchar; Type_handler_longlong type_handler_longlong; Type_handler_float type_handler_float; @@ -52,6 +49,10 @@ Type_handler_bit type_handler_bit; Type_handler_enum type_handler_enum; Type_handler_set type_handler_set; +Type_handler_time2 type_handler_time2; +Type_handler_newdate type_handler_newdate; +Type_handler_datetime2 type_handler_datetime2; + #ifdef HAVE_SPATIAL Type_handler_geometry type_handler_geometry; #endif @@ -1346,7 +1347,7 @@ bool Type_handler_date_common:: Item_hybrid_func_fix_attributes(THD *thd, Item_hybrid_func *func, Item **items, uint nitems) const { - func->set_attributes_temporal(MAX_DATE_WIDTH, 0); + func->fix_attributes_date(); return false; } @@ -2688,7 +2689,7 @@ bool Type_handler_numeric:: bool Type_handler:: Item_time_typecast_fix_length_and_dec(Item_time_typecast *item) const { - item->fix_length_and_dec_generic(); + item->fix_length_and_dec_generic(MIN_TIME_WIDTH); return false; } @@ -2696,7 +2697,7 @@ bool Type_handler:: bool Type_handler:: Item_date_typecast_fix_length_and_dec(Item_date_typecast *item) const { - item->fix_length_and_dec_generic(); + item->fix_length_and_dec_generic(MAX_DATE_WIDTH); return false; } @@ -2705,7 +2706,7 @@ bool Type_handler:: Item_datetime_typecast_fix_length_and_dec(Item_datetime_typecast *item) const { - item->fix_length_and_dec_generic(); + item->fix_length_and_dec_generic(MAX_DATETIME_WIDTH); return false; } diff --git a/sql/sql_type.h b/sql/sql_type.h index 891c785fef2..bd5290ad1fe 100644 --- a/sql/sql_type.h +++ b/sql/sql_type.h @@ -23,6 +23,8 @@ #include "mysqld.h" #include "sql_array.h" +#include "sql_const.h" +#include "my_time.h" class Field; class Item; @@ -261,6 +263,54 @@ public: max_length= char_to_byte_length_safe(max_char_length_arg, collation.collation->mbmaxlen); } + void fix_char_length_temporal_not_fixed_dec(uint int_part_length, uint dec) + { + uint char_length= int_part_length; + if ((decimals= dec)) + { + if (decimals == NOT_FIXED_DEC) + char_length+= TIME_SECOND_PART_DIGITS + 1; + else + { + set_if_smaller(decimals, TIME_SECOND_PART_DIGITS); + char_length+= decimals + 1; + } + } + fix_char_length(char_length); + } + void fix_attributes_temporal_not_fixed_dec(uint int_part_length, uint dec) + { + collation.set_numeric(); + unsigned_flag= 0; + fix_char_length_temporal_not_fixed_dec(int_part_length, dec); + } + void fix_attributes_time_not_fixed_dec(uint dec) + { + fix_attributes_temporal_not_fixed_dec(MIN_TIME_WIDTH, dec); + } + void fix_attributes_datetime_not_fixed_dec(uint dec) + { + fix_attributes_temporal_not_fixed_dec(MAX_DATETIME_WIDTH, dec); + } + void fix_attributes_temporal(uint int_part_length, uint dec) + { + collation.set_numeric(); + unsigned_flag= 0; + decimals= MY_MIN(dec, TIME_SECOND_PART_DIGITS); + max_length= decimals + int_part_length + (dec ? 1 : 0); + } + void fix_attributes_date() + { + fix_attributes_temporal(MAX_DATE_WIDTH, 0); + } + void fix_attributes_time(uint dec) + { + fix_attributes_temporal(MIN_TIME_WIDTH, dec); + } + void fix_attributes_datetime(uint dec) + { + fix_attributes_temporal(MAX_DATETIME_WIDTH, dec); + } }; @@ -1585,6 +1635,7 @@ public: extern Type_handler_row type_handler_row; extern Type_handler_null type_handler_null; +extern Type_handler_string type_handler_string; extern Type_handler_varchar type_handler_varchar; extern Type_handler_longlong type_handler_longlong; extern Type_handler_float type_handler_float; @@ -1596,6 +1647,10 @@ extern Type_handler_bit type_handler_bit; extern Type_handler_enum type_handler_enum; extern Type_handler_set type_handler_set; +extern Type_handler_time2 type_handler_time2; +extern Type_handler_newdate type_handler_newdate; +extern Type_handler_datetime2 type_handler_datetime2; + class Type_aggregator { diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc index 56d8000d64d..ed9b03dc82b 100644 --- a/storage/blackhole/ha_blackhole.cc +++ b/storage/blackhole/ha_blackhole.cc @@ -105,7 +105,7 @@ int ha_blackhole::write_row(uchar * buf) DBUG_RETURN(table->next_number_field ? update_auto_increment() : 0); } -int ha_blackhole::update_row(const uchar *old_data, uchar *new_data) +int ha_blackhole::update_row(const uchar *old_data, const uchar *new_data) { DBUG_ENTER("ha_blackhole::update_row"); THD *thd= ha_thd(); diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h index b70320848d7..9a4b34809f8 100644 --- a/storage/blackhole/ha_blackhole.h +++ b/storage/blackhole/ha_blackhole.h @@ -97,6 +97,6 @@ public: enum thr_lock_type lock_type); private: virtual int write_row(uchar *buf); - virtual int update_row(const uchar *old_data, uchar *new_data); + virtual int update_row(const uchar *old_data, const uchar *new_data); virtual int delete_row(const uchar *buf); }; diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index f2727ba15f7..e655655fb9c 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -2097,7 +2097,7 @@ int ha_connect::MakeRecord(char *buf) /***********************************************************************/ /* Set row values from a MySQL pseudo record. Specific to MySQL. */ /***********************************************************************/ -int ha_connect::ScanRecord(PGLOBAL g, uchar *) +int ha_connect::ScanRecord(PGLOBAL g, const uchar *) { char attr_buffer[1024]; char data_buffer[1024]; @@ -2239,7 +2239,7 @@ int ha_connect::ScanRecord(PGLOBAL g, uchar *) /* Check change in index column. Specific to MySQL. */ /* Should be elaborated to check for real changes. */ /***********************************************************************/ -int ha_connect::CheckRecord(PGLOBAL g, const uchar *, uchar *newbuf) +int ha_connect::CheckRecord(PGLOBAL g, const uchar *, const uchar *newbuf) { return ScanRecord(g, newbuf); } // end of dummy CheckRecord @@ -3417,7 +3417,7 @@ int ha_connect::write_row(uchar *buf) @see sql_select.cc, sql_acl.cc, sql_update.cc and sql_insert.cc */ -int ha_connect::update_row(const uchar *old_data, uchar *new_data) +int ha_connect::update_row(const uchar *old_data, const uchar *new_data) { int rc= 0; PGLOBAL& g= xp->g; diff --git a/storage/connect/ha_connect.h b/storage/connect/ha_connect.h index cb15d371b5c..4757f6edfe1 100644 --- a/storage/connect/ha_connect.h +++ b/storage/connect/ha_connect.h @@ -206,8 +206,8 @@ public: bool IsOpened(void); int CloseTable(PGLOBAL g); int MakeRecord(char *buf); - int ScanRecord(PGLOBAL g, uchar *buf); - int CheckRecord(PGLOBAL g, const uchar *oldbuf, uchar *newbuf); + int ScanRecord(PGLOBAL g, const uchar *buf); + int CheckRecord(PGLOBAL g, const uchar *oldbuf, const uchar *newbuf); int ReadIndexed(uchar *buf, OPVAL op, const key_range *kr= NULL); bool IsIndexed(Field *fp); bool MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL op, char q, @@ -388,7 +388,7 @@ PFIL CondFilter(PGLOBAL g, Item *cond); We implement this in ha_connect.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int update_row(const uchar *old_data, uchar *new_data); + int update_row(const uchar *old_data, const uchar *new_data); /** @brief We implement this in ha_connect.cc. It's not an obligatory method; diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 308e6f12d73..363fb993fe7 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -519,7 +519,7 @@ ha_tina::ha_tina(handlerton *hton, TABLE_SHARE *table_arg) Encode a buffer into the quoted format. */ -int ha_tina::encode_quote(uchar *buf) +int ha_tina::encode_quote(const uchar *buf) { char attribute_buffer[1024]; String attribute(attribute_buffer, sizeof(attribute_buffer), @@ -1063,7 +1063,7 @@ int ha_tina::open_update_temp_file_if_needed() This will be called in a table scan right before the previous ::rnd_next() call. */ -int ha_tina::update_row(const uchar * old_data, uchar * new_data) +int ha_tina::update_row(const uchar * old_data, const uchar * new_data) { int size; int rc= -1; diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h index 127c6053a53..c75a64faa52 100644 --- a/storage/csv/ha_tina.h +++ b/storage/csv/ha_tina.h @@ -137,7 +137,7 @@ public: int open(const char *name, int mode, uint open_options); int close(void); int write_row(uchar * buf); - int update_row(const uchar * old_data, uchar * new_data); + int update_row(const uchar * old_data, const uchar * new_data); int delete_row(const uchar * buf); int rnd_init(bool scan=1); int rnd_next(uchar *buf); @@ -173,7 +173,7 @@ public: void update_status(); /* The following methods were added just for TINA */ - int encode_quote(uchar *buf); + int encode_quote(const uchar *buf); int find_current_row(uchar *buf); int chain_append(); }; diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index 3a5b269e79f..13062c0bf7c 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -431,7 +431,7 @@ int ha_example::write_row(uchar *buf) @see sql_select.cc, sql_acl.cc, sql_update.cc and sql_insert.cc */ -int ha_example::update_row(const uchar *old_data, uchar *new_data) +int ha_example::update_row(const uchar *old_data, const uchar *new_data) { DBUG_ENTER("ha_example::update_row"); diff --git a/storage/example/ha_example.h b/storage/example/ha_example.h index 2d3d0c81ed9..3a9654bbb7b 100644 --- a/storage/example/ha_example.h +++ b/storage/example/ha_example.h @@ -186,7 +186,7 @@ public: We implement this in ha_example.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int update_row(const uchar *old_data, uchar *new_data); + int update_row(const uchar *old_data, const uchar *new_data); /** @brief We implement this in ha_example.cc. It's not an obligatory method; diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 879a17782aa..b4b781ca534 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -2125,7 +2125,7 @@ int ha_federated::repair(THD* thd, HA_CHECK_OPT* check_opt) Called from sql_select.cc, sql_acl.cc, sql_update.cc, and sql_insert.cc. */ -int ha_federated::update_row(const uchar *old_data, uchar *new_data) +int ha_federated::update_row(const uchar *old_data, const uchar *new_data) { /* This used to control how the query was built. If there was a diff --git a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h index a23375cbe58..e264258a63a 100644 --- a/storage/federated/ha_federated.h +++ b/storage/federated/ha_federated.h @@ -210,7 +210,7 @@ public: void start_bulk_insert(ha_rows rows, uint flags); int end_bulk_insert(); int write_row(uchar *buf); - int update_row(const uchar *old_data, uchar *new_data); + int update_row(const uchar *old_data, const uchar *new_data); int delete_row(const uchar *buf); int index_init(uint keynr, bool sorted); ha_rows estimate_rows_upper_bound(); diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc index e3506e1a4df..a7b1edd0086 100644 --- a/storage/federatedx/ha_federatedx.cc +++ b/storage/federatedx/ha_federatedx.cc @@ -2276,7 +2276,7 @@ int ha_federatedx::repair(THD* thd, HA_CHECK_OPT* check_opt) Called from sql_select.cc, sql_acl.cc, sql_update.cc, and sql_insert.cc. */ -int ha_federatedx::update_row(const uchar *old_data, uchar *new_data) +int ha_federatedx::update_row(const uchar *old_data, const uchar *new_data) { /* This used to control how the query was built. If there was a diff --git a/storage/federatedx/ha_federatedx.h b/storage/federatedx/ha_federatedx.h index 2c2c6eef26b..759ddfdfe71 100644 --- a/storage/federatedx/ha_federatedx.h +++ b/storage/federatedx/ha_federatedx.h @@ -394,7 +394,7 @@ public: void start_bulk_insert(ha_rows rows, uint flags); int end_bulk_insert(); int write_row(uchar *buf); - int update_row(const uchar *old_data, uchar *new_data); + int update_row(const uchar *old_data, const uchar *new_data); int delete_row(const uchar *buf); int index_init(uint keynr, bool sorted); ha_rows estimate_rows_upper_bound(); diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index e87c878d11b..ef6530e98e1 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -251,7 +251,7 @@ int ha_heap::write_row(uchar * buf) return res; } -int ha_heap::update_row(const uchar * old_data, uchar * new_data) +int ha_heap::update_row(const uchar * old_data, const uchar * new_data) { int res; res= heap_update(file,old_data,new_data); diff --git a/storage/heap/ha_heap.h b/storage/heap/ha_heap.h index 6443ff55646..e17c18c8b14 100644 --- a/storage/heap/ha_heap.h +++ b/storage/heap/ha_heap.h @@ -71,7 +71,7 @@ public: int close(void); void set_keys_for_scanning(void); int write_row(uchar * buf); - int update_row(const uchar * old_data, uchar * new_data); + int update_row(const uchar * old_data, const uchar * new_data); int delete_row(const uchar * buf); virtual void get_auto_increment(ulonglong offset, ulonglong increment, ulonglong nb_desired_values, diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 2c44077c541..cd1761d170f 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -8910,7 +8910,7 @@ dberr_t calc_row_difference( upd_t* uvect, const uchar* old_row, - uchar* new_row, + const uchar* new_row, TABLE* table, uchar* upd_buff, ulint buff_len, @@ -9406,7 +9406,7 @@ if its index columns are updated! int ha_innobase::update_row( const uchar* old_row, - uchar* new_row) + const uchar* new_row) { int err; diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 463717ee6b2..429c6eb0b86 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -138,7 +138,7 @@ public: int write_row(uchar * buf); - int update_row(const uchar * old_data, uchar * new_data); + int update_row(const uchar * old_data, const uchar * new_data); int delete_row(const uchar * buf); diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 86bb49c5625..adf32b4f68c 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -2311,7 +2311,7 @@ bool ha_maria::is_crashed() const } \ } while(0) -int ha_maria::update_row(const uchar * old_data, uchar * new_data) +int ha_maria::update_row(const uchar * old_data, const uchar * new_data) { CHECK_UNTIL_WE_FULLY_IMPLEMENTED_VERSIONING("UPDATE in WRITE CONCURRENT"); return maria_update(file, old_data, new_data); diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h index 58d13ca3cf4..49ee2afc827 100644 --- a/storage/maria/ha_maria.h +++ b/storage/maria/ha_maria.h @@ -75,7 +75,7 @@ public: int open(const char *name, int mode, uint test_if_locked); int close(void); int write_row(uchar * buf); - int update_row(const uchar * old_data, uchar * new_data); + int update_row(const uchar * old_data, const uchar * new_data); int delete_row(const uchar * buf); int index_read_map(uchar * buf, const uchar * key, key_part_map keypart_map, enum ha_rkey_function find_flag); diff --git a/storage/maria/ma_unique.c b/storage/maria/ma_unique.c index 72104e25e3f..dfbb471f31e 100644 --- a/storage/maria/ma_unique.c +++ b/storage/maria/ma_unique.c @@ -27,8 +27,9 @@ isn't any versioning information. */ -my_bool _ma_check_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, uchar *record, - ha_checksum unique_hash, my_off_t disk_pos) +my_bool _ma_check_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, + const uchar *record, + ha_checksum unique_hash, my_off_t disk_pos) { my_off_t lastpos=info->cur_row.lastpos; MARIA_KEYDEF *keyinfo= &info->s->keyinfo[def->key]; @@ -38,6 +39,7 @@ my_bool _ma_check_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, uchar *record, DBUG_ENTER("_ma_check_unique"); DBUG_PRINT("enter",("unique_hash: %lu", (ulong) unique_hash)); + /* We need to store the hash value as a key in the record, breaking const */ maria_unique_store(record+keyinfo->seg->start, unique_hash); /* Can't be spatial so it's ok to call _ma_make_key directly here */ _ma_make_key(info, &key, def->key, key_buff, record, 0, 0); diff --git a/storage/maria/ma_update.c b/storage/maria/ma_update.c index 0e006d2473d..6e150f727d6 100644 --- a/storage/maria/ma_update.c +++ b/storage/maria/ma_update.c @@ -21,7 +21,8 @@ Update an old row in a MARIA table */ -int maria_update(register MARIA_HA *info, const uchar *oldrec, uchar *newrec) +int maria_update(register MARIA_HA *info, const uchar *oldrec, + const uchar *newrec) { int flag,key_changed,save_errno; reg3 my_off_t pos; diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index 8664157a65a..0e33f1c938d 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -1323,7 +1323,7 @@ ulong _ma_calc_total_blob_length(MARIA_HA *info, const uchar *record); ha_checksum _ma_checksum(MARIA_HA *info, const uchar *buf); ha_checksum _ma_static_checksum(MARIA_HA *info, const uchar *buf); my_bool _ma_check_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, - uchar *record, ha_checksum unique_hash, + const uchar *record, ha_checksum unique_hash, MARIA_RECORD_POS pos); ha_checksum _ma_unique_hash(MARIA_UNIQUEDEF *def, const uchar *buf); my_bool _ma_cmp_static_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp index 27a3e7b3294..ba3d910f936 100644 --- a/storage/mroonga/ha_mroonga.cpp +++ b/storage/mroonga/ha_mroonga.cpp @@ -5674,7 +5674,7 @@ err: DBUG_RETURN(error); } -int ha_mroonga::storage_write_row_unique_index(uchar *buf, +int ha_mroonga::storage_write_row_unique_index(const uchar *buf, KEY *key_info, grn_obj *index_table, grn_obj *index_column, @@ -5856,7 +5856,8 @@ int ha_mroonga::wrapper_get_record_id(uchar *data, grn_id *record_id, DBUG_RETURN(error); } -int ha_mroonga::wrapper_update_row(const uchar *old_data, uchar *new_data) +int ha_mroonga::wrapper_update_row(const uchar *old_data, + const uchar *new_data) { MRN_DBUG_ENTER_METHOD(); @@ -5877,7 +5878,8 @@ int ha_mroonga::wrapper_update_row(const uchar *old_data, uchar *new_data) DBUG_RETURN(error); } -int ha_mroonga::wrapper_update_row_index(const uchar *old_data, uchar *new_data) +int ha_mroonga::wrapper_update_row_index(const uchar *old_data, + const uchar *new_data) { MRN_DBUG_ENTER_METHOD(); @@ -5989,7 +5991,8 @@ err: DBUG_RETURN(error); } -int ha_mroonga::storage_update_row(const uchar *old_data, uchar *new_data) +int ha_mroonga::storage_update_row(const uchar *old_data, + const uchar *new_data) { MRN_DBUG_ENTER_METHOD(); int error = 0; @@ -6152,7 +6155,8 @@ err: DBUG_RETURN(error); } -int ha_mroonga::storage_update_row_index(const uchar *old_data, uchar *new_data) +int ha_mroonga::storage_update_row_index(const uchar *old_data, + const uchar *new_data) { MRN_DBUG_ENTER_METHOD(); int error = 0; @@ -6244,7 +6248,7 @@ err: DBUG_RETURN(error); } -int ha_mroonga::storage_update_row_unique_indexes(uchar *new_data) +int ha_mroonga::storage_update_row_unique_indexes(const uchar *new_data) { int error; uint i; @@ -6321,7 +6325,7 @@ err: DBUG_RETURN(error); } -int ha_mroonga::update_row(const uchar *old_data, uchar *new_data) +int ha_mroonga::update_row(const uchar *old_data, const uchar *new_data) { MRN_DBUG_ENTER_METHOD(); int error = 0; @@ -11015,7 +11019,7 @@ void ha_mroonga::storage_store_fields(uchar *buf, grn_id record_id) } void ha_mroonga::storage_store_fields_for_prep_update(const uchar *old_data, - uchar *new_data, + const uchar *new_data, grn_id record_id) { MRN_DBUG_ENTER_METHOD(); diff --git a/storage/mroonga/ha_mroonga.hpp b/storage/mroonga/ha_mroonga.hpp index 37059210dd1..579107f9465 100644 --- a/storage/mroonga/ha_mroonga.hpp +++ b/storage/mroonga/ha_mroonga.hpp @@ -384,7 +384,7 @@ public: int delete_table(const char *name); int write_row(uchar *buf); - int update_row(const uchar *old_data, uchar *new_data); + int update_row(const uchar *old_data, const uchar *new_data); int delete_row(const uchar *buf); uint max_supported_record_length() const; @@ -692,7 +692,7 @@ private: int nth_column, grn_id record_id); void storage_store_fields(uchar *buf, grn_id record_id); void storage_store_fields_for_prep_update(const uchar *old_data, - uchar *new_data, + const uchar *new_data, grn_id record_id); void storage_store_fields_by_index(uchar *buf); @@ -827,18 +827,21 @@ private: KEY *key_info, grn_obj *index_column); int storage_write_row_multiple_column_indexes(uchar *buf, grn_id record_id); - int storage_write_row_unique_index(uchar *buf, + int storage_write_row_unique_index(const uchar *buf, KEY *key_info, grn_obj *index_table, grn_obj *index_column, grn_id *key_id); int storage_write_row_unique_indexes(uchar *buf); - int wrapper_get_record_id(uchar *data, grn_id *record_id, const char *context); - int wrapper_update_row(const uchar *old_data, uchar *new_data); - int wrapper_update_row_index(const uchar *old_data, uchar *new_data); - int storage_update_row(const uchar *old_data, uchar *new_data); - int storage_update_row_index(const uchar *old_data, uchar *new_data); - int storage_update_row_unique_indexes(uchar *new_data); + int wrapper_get_record_id(uchar *data, grn_id *record_id, + const char *context); + int wrapper_update_row(const uchar *old_data, const uchar *new_data); + int wrapper_update_row_index(const uchar *old_data, + const uchar *new_data); + int storage_update_row(const uchar *old_data, const uchar *new_data); + int storage_update_row_index(const uchar *old_data, + const uchar *new_data); + int storage_update_row_unique_indexes(const uchar *new_data); int wrapper_delete_row(const uchar *buf); int wrapper_delete_row_index(const uchar *buf); int storage_delete_row(const uchar *buf); diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 9a0d3ab7b5f..99073a2caa1 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1779,7 +1779,7 @@ bool ha_myisam::is_crashed() const (my_disable_locking && file->s->state.open_count)); } -int ha_myisam::update_row(const uchar *old_data, uchar *new_data) +int ha_myisam::update_row(const uchar *old_data, const uchar *new_data) { return mi_update(file,old_data,new_data); } diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h index 4068720e39e..531c96baacc 100644 --- a/storage/myisam/ha_myisam.h +++ b/storage/myisam/ha_myisam.h @@ -71,7 +71,7 @@ class ha_myisam: public handler int open(const char *name, int mode, uint test_if_locked); int close(void); int write_row(uchar * buf); - int update_row(const uchar * old_data, uchar * new_data); + int update_row(const uchar * old_data, const uchar * new_data); int delete_row(const uchar * buf); int index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag); diff --git a/storage/myisam/mi_unique.c b/storage/myisam/mi_unique.c index dae453beaec..371c1a7fd6c 100644 --- a/storage/myisam/mi_unique.c +++ b/storage/myisam/mi_unique.c @@ -19,7 +19,7 @@ #include "myisamdef.h" #include -my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, uchar *record, +my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, const uchar *record, ha_checksum unique_hash, my_off_t disk_pos) { my_off_t lastpos=info->lastpos; @@ -27,7 +27,8 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, uchar *record, uchar *key_buff=info->lastkey2; DBUG_ENTER("mi_check_unique"); - mi_unique_store(record+key->seg->start, unique_hash); + /* We need to store the hash value as a key in the record, breaking const */ + mi_unique_store(((uchar*) record)+key->seg->start, unique_hash); _mi_make_key(info,def->key,key_buff,record,0); /* The above changed info->lastkey2. Inform mi_rnext_same(). */ diff --git a/storage/myisam/mi_update.c b/storage/myisam/mi_update.c index b75bd4bf2aa..459ce0eade3 100644 --- a/storage/myisam/mi_update.c +++ b/storage/myisam/mi_update.c @@ -19,7 +19,8 @@ #include "fulltext.h" #include "rt_index.h" -int mi_update(register MI_INFO *info, const uchar *oldrec, uchar *newrec) +int mi_update(register MI_INFO *info, const uchar *oldrec, + const uchar *newrec) { int flag,key_changed,save_errno; reg3 my_off_t pos; diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h index ff12cb53dd9..0d718f0a22e 100644 --- a/storage/myisam/myisamdef.h +++ b/storage/myisam/myisamdef.h @@ -696,7 +696,7 @@ extern int mi_indexes_are_disabled(MI_INFO *info); ulong _mi_calc_total_blob_length(MI_INFO *info, const uchar *record); ha_checksum mi_checksum(MI_INFO *info, const uchar *buf); ha_checksum mi_static_checksum(MI_INFO *info, const uchar *buf); -my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, uchar *record, +my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, const uchar *record, ha_checksum unique_hash, my_off_t pos); ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const uchar *buf); int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def, diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index 3d91aa67793..8f4997cf795 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -1104,7 +1104,7 @@ int ha_myisammrg::write_row(uchar * buf) DBUG_RETURN(myrg_write(file,buf)); } -int ha_myisammrg::update_row(const uchar * old_data, uchar * new_data) +int ha_myisammrg::update_row(const uchar * old_data, const uchar * new_data) { DBUG_ASSERT(this->file->children_attached); return myrg_update(file,old_data,new_data); diff --git a/storage/myisammrg/ha_myisammrg.h b/storage/myisammrg/ha_myisammrg.h index b6db549119d..6ace880ab99 100644 --- a/storage/myisammrg/ha_myisammrg.h +++ b/storage/myisammrg/ha_myisammrg.h @@ -112,7 +112,7 @@ public: virtual handler *clone(const char *name, MEM_ROOT *mem_root); int close(void); int write_row(uchar * buf); - int update_row(const uchar * old_data, uchar * new_data); + int update_row(const uchar * old_data, const uchar * new_data); int delete_row(const uchar * buf); int index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag); diff --git a/storage/myisammrg/myrg_update.c b/storage/myisammrg/myrg_update.c index add6f9f819b..fd28b2699e9 100644 --- a/storage/myisammrg/myrg_update.c +++ b/storage/myisammrg/myrg_update.c @@ -18,7 +18,8 @@ #include "myrg_def.h" -int myrg_update(register MYRG_INFO *info,const uchar *oldrec, uchar *newrec) +int myrg_update(register MYRG_INFO *info,const uchar *oldrec, + const uchar *newrec) { if (!info->current_table) return (my_errno=HA_ERR_NO_ACTIVE_RECORD); diff --git a/storage/oqgraph/ha_oqgraph.cc b/storage/oqgraph/ha_oqgraph.cc index 66a20e9a6a1..2380ab8157e 100644 --- a/storage/oqgraph/ha_oqgraph.cc +++ b/storage/oqgraph/ha_oqgraph.cc @@ -803,7 +803,7 @@ int ha_oqgraph::write_row(byte * buf) return HA_ERR_TABLE_READONLY; } -int ha_oqgraph::update_row(const byte * old, byte * buf) +int ha_oqgraph::update_row(const uchar * old, const uchar * buf) { return HA_ERR_TABLE_READONLY; } diff --git a/storage/oqgraph/ha_oqgraph.h b/storage/oqgraph/ha_oqgraph.h index 07f47bd1239..ad0cdd61256 100644 --- a/storage/oqgraph/ha_oqgraph.h +++ b/storage/oqgraph/ha_oqgraph.h @@ -84,7 +84,7 @@ public: int open(const char *name, int mode, uint test_if_locked); int close(void); int write_row(byte * buf); - int update_row(const byte * old_data, byte * new_data); + int update_row(const uchar * old_data, const uchar * new_data); int delete_row(const byte * buf); int index_read(byte * buf, const byte * key, uint key_len, enum ha_rkey_function find_flag); diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc index 57dd266fb3d..ecce3c5e627 100644 --- a/storage/perfschema/ha_perfschema.cc +++ b/storage/perfschema/ha_perfschema.cc @@ -275,7 +275,7 @@ void ha_perfschema::use_hidden_primary_key(void) table->column_bitmaps_set_no_signal(&table->s->all_set, table->write_set); } -int ha_perfschema::update_row(const uchar *old_data, uchar *new_data) +int ha_perfschema::update_row(const uchar *old_data, const uchar *new_data) { DBUG_ENTER("ha_perfschema::update_row"); if (!pfs_initialized) diff --git a/storage/perfschema/ha_perfschema.h b/storage/perfschema/ha_perfschema.h index ff87b1fd665..62996e12fe0 100644 --- a/storage/perfschema/ha_perfschema.h +++ b/storage/perfschema/ha_perfschema.h @@ -130,7 +130,7 @@ public: @param new_data the row new values @return 0 on success */ - int update_row(const uchar *old_data, uchar *new_data); + int update_row(const uchar *old_data, const uchar *new_data); /** Delete a row. diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc index 9e9ab02df46..579d3ccd74e 100644 --- a/storage/perfschema/pfs_engine_table.cc +++ b/storage/perfschema/pfs_engine_table.cc @@ -284,7 +284,7 @@ int PFS_engine_table::read_row(TABLE *table, */ int PFS_engine_table::update_row(TABLE *table, const unsigned char *old_buf, - unsigned char *new_buf, + const unsigned char *new_buf, Field **fields) { my_bitmap_map *org_bitmap; @@ -428,7 +428,7 @@ PFS_engine_table::get_field_varchar_utf8(Field *f, String *val) int PFS_engine_table::update_row_values(TABLE *, const unsigned char *, - unsigned char *, + const unsigned char *, Field **) { return HA_ERR_WRONG_COMMAND; diff --git a/storage/perfschema/pfs_engine_table.h b/storage/perfschema/pfs_engine_table.h index 2bbf8891420..bae27172810 100644 --- a/storage/perfschema/pfs_engine_table.h +++ b/storage/perfschema/pfs_engine_table.h @@ -46,7 +46,7 @@ public: int read_row(TABLE *table, unsigned char *buf, Field **fields); int update_row(TABLE *table, const unsigned char *old_buf, - unsigned char *new_buf, Field **fields); + const unsigned char *new_buf, Field **fields); /** Delete a row from this table. @@ -165,7 +165,7 @@ protected: @param fields Table fields */ virtual int update_row_values(TABLE *table, const unsigned char *old_buf, - unsigned char *new_buf, Field **fields); + const unsigned char *new_buf, Field **fields); /** Delete a row. diff --git a/storage/perfschema/table_setup_actors.cc b/storage/perfschema/table_setup_actors.cc index c82d67fba2d..bf6006057df 100644 --- a/storage/perfschema/table_setup_actors.cc +++ b/storage/perfschema/table_setup_actors.cc @@ -217,7 +217,7 @@ int table_setup_actors::read_row_values(TABLE *table, int table_setup_actors::update_row_values(TABLE *table, const unsigned char *old_buf, - unsigned char *new_buf, + const unsigned char *new_buf, Field **fields) { Field *f; diff --git a/storage/perfschema/table_setup_actors.h b/storage/perfschema/table_setup_actors.h index 2a9395dfac7..66379593cc5 100644 --- a/storage/perfschema/table_setup_actors.h +++ b/storage/perfschema/table_setup_actors.h @@ -71,7 +71,7 @@ protected: virtual int update_row_values(TABLE *table, const unsigned char *old_buf, - unsigned char *new_buf, + const unsigned char *new_buf, Field **fields); virtual int delete_row_values(TABLE *table, diff --git a/storage/perfschema/table_setup_consumers.cc b/storage/perfschema/table_setup_consumers.cc index c09853ffeca..f3529eb8846 100644 --- a/storage/perfschema/table_setup_consumers.cc +++ b/storage/perfschema/table_setup_consumers.cc @@ -190,7 +190,7 @@ int table_setup_consumers::read_row_values(TABLE *table, int table_setup_consumers::update_row_values(TABLE *table, const unsigned char *, - unsigned char *, + const unsigned char *, Field **fields) { Field *f; diff --git a/storage/perfschema/table_setup_consumers.h b/storage/perfschema/table_setup_consumers.h index e59033c0ad1..f5a386829a1 100644 --- a/storage/perfschema/table_setup_consumers.h +++ b/storage/perfschema/table_setup_consumers.h @@ -60,7 +60,7 @@ protected: virtual int update_row_values(TABLE *table, const unsigned char *old_buf, - unsigned char *new_buf, + const unsigned char *new_buf, Field **fields); table_setup_consumers(); diff --git a/storage/perfschema/table_setup_instruments.cc b/storage/perfschema/table_setup_instruments.cc index d911128ce94..f5ac1cafe63 100644 --- a/storage/perfschema/table_setup_instruments.cc +++ b/storage/perfschema/table_setup_instruments.cc @@ -217,7 +217,7 @@ int table_setup_instruments::read_row_values(TABLE *table, int table_setup_instruments::update_row_values(TABLE *table, const unsigned char *, - unsigned char *, + const unsigned char *, Field **fields) { Field *f; diff --git a/storage/perfschema/table_setup_instruments.h b/storage/perfschema/table_setup_instruments.h index 2e70a528bbd..dfe9070721b 100644 --- a/storage/perfschema/table_setup_instruments.h +++ b/storage/perfschema/table_setup_instruments.h @@ -92,7 +92,7 @@ protected: virtual int update_row_values(TABLE *table, const unsigned char *old_buf, - unsigned char *new_buf, + const unsigned char *new_buf, Field **fields); table_setup_instruments(); diff --git a/storage/perfschema/table_setup_objects.cc b/storage/perfschema/table_setup_objects.cc index 5321271a62d..994622f4a52 100644 --- a/storage/perfschema/table_setup_objects.cc +++ b/storage/perfschema/table_setup_objects.cc @@ -265,7 +265,7 @@ int table_setup_objects::read_row_values(TABLE *table, int table_setup_objects::update_row_values(TABLE *table, const unsigned char *, - unsigned char *, + const unsigned char *, Field **fields) { int result; diff --git a/storage/perfschema/table_setup_objects.h b/storage/perfschema/table_setup_objects.h index 55423ffd90f..7fcefa45407 100644 --- a/storage/perfschema/table_setup_objects.h +++ b/storage/perfschema/table_setup_objects.h @@ -74,7 +74,7 @@ protected: virtual int update_row_values(TABLE *table, const unsigned char *old_buf, - unsigned char *new_buf, + const unsigned char *new_buf, Field **fields); virtual int delete_row_values(TABLE *table, diff --git a/storage/perfschema/table_setup_timers.cc b/storage/perfschema/table_setup_timers.cc index 911fa121e06..9c6af49595d 100644 --- a/storage/perfschema/table_setup_timers.cc +++ b/storage/perfschema/table_setup_timers.cc @@ -145,7 +145,7 @@ int table_setup_timers::read_row_values(TABLE *table, int table_setup_timers::update_row_values(TABLE *table, const unsigned char *, - unsigned char *, + const unsigned char *, Field **fields) { Field *f; diff --git a/storage/perfschema/table_setup_timers.h b/storage/perfschema/table_setup_timers.h index 46af68bb9e3..f230a68af98 100644 --- a/storage/perfschema/table_setup_timers.h +++ b/storage/perfschema/table_setup_timers.h @@ -58,7 +58,7 @@ protected: virtual int update_row_values(TABLE *table, const unsigned char *old_buf, - unsigned char *new_buf, + const unsigned char *new_buf, Field **fields); table_setup_timers(); diff --git a/storage/perfschema/table_threads.cc b/storage/perfschema/table_threads.cc index 5c78b567b8c..7be51b2bb20 100644 --- a/storage/perfschema/table_threads.cc +++ b/storage/perfschema/table_threads.cc @@ -292,7 +292,7 @@ int table_threads::read_row_values(TABLE *table, int table_threads::update_row_values(TABLE *table, const unsigned char *old_buf, - unsigned char *new_buf, + const unsigned char *new_buf, Field **fields) { Field *f; diff --git a/storage/perfschema/table_threads.h b/storage/perfschema/table_threads.h index 10afbe14e74..fb843f5ca36 100644 --- a/storage/perfschema/table_threads.h +++ b/storage/perfschema/table_threads.h @@ -87,7 +87,7 @@ protected: virtual int update_row_values(TABLE *table, const unsigned char *old_buf, - unsigned char *new_buf, + const unsigned char *new_buf, Field **fields); protected: diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 981acdf22b0..1344bdc497f 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -8303,7 +8303,8 @@ void ha_rocksdb::calc_updated_indexes() { } } -int ha_rocksdb::update_row(const uchar *const old_data, uchar *const new_data) { +int ha_rocksdb::update_row(const uchar *const old_data, + const uchar *const new_data) { DBUG_ENTER_FUNC(); DBUG_ASSERT(old_data != nullptr); diff --git a/storage/rocksdb/ha_rocksdb.h b/storage/rocksdb/ha_rocksdb.h index 5852ad4e954..1ac48111636 100644 --- a/storage/rocksdb/ha_rocksdb.h +++ b/storage/rocksdb/ha_rocksdb.h @@ -887,7 +887,7 @@ public: int write_row(uchar *const buf) override MY_ATTRIBUTE((__warn_unused_result__)); - int update_row(const uchar *const old_data, uchar *const new_data) override + int update_row(const uchar *const old_data, const uchar *const new_data) override MY_ATTRIBUTE((__warn_unused_result__)); int delete_row(const uchar *const buf) override MY_ATTRIBUTE((__warn_unused_result__)); diff --git a/storage/rocksdb/rdb_datadic.h b/storage/rocksdb/rdb_datadic.h index 2ffd3f6e8db..8742a0794a4 100644 --- a/storage/rocksdb/rdb_datadic.h +++ b/storage/rocksdb/rdb_datadic.h @@ -751,6 +751,7 @@ public: interface Rdb_tables_scanner { virtual int add_table(Rdb_tbl_def * tdef) = 0; + virtual ~Rdb_tables_scanner() {} }; /* diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc index 541ccf62260..d65f5ac900a 100644 --- a/storage/sphinx/ha_sphinx.cc +++ b/storage/sphinx/ha_sphinx.cc @@ -2457,7 +2457,7 @@ int ha_sphinx::delete_row ( const byte * ) } -int ha_sphinx::update_row ( const byte *, byte * ) +int ha_sphinx::update_row ( const byte *, const byte * ) { SPH_ENTER_METHOD(); SPH_RET ( HA_ERR_WRONG_COMMAND ); diff --git a/storage/sphinx/ha_sphinx.h b/storage/sphinx/ha_sphinx.h index c310deb7060..8e6af908aab 100644 --- a/storage/sphinx/ha_sphinx.h +++ b/storage/sphinx/ha_sphinx.h @@ -86,7 +86,7 @@ public: int close (); int write_row ( byte * buf ); - int update_row ( const byte * old_data, byte * new_data ); + int update_row ( const byte * old_data, const byte * new_data ); int delete_row ( const byte * buf ); int extra ( enum ha_extra_function op ); diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 6ded5992c79..fef18e0e652 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -9747,7 +9747,7 @@ void ha_spider::end_bulk_update( int ha_spider::bulk_update_row( const uchar *old_data, - uchar *new_data, + const uchar *new_data, uint *dup_key_found ) { DBUG_ENTER("ha_spider::bulk_update_row"); @@ -9758,7 +9758,7 @@ int ha_spider::bulk_update_row( int ha_spider::update_row( const uchar *old_data, - uchar *new_data + const uchar *new_data ) { int error_num; THD *thd = ha_thd(); @@ -9990,7 +9990,7 @@ int ha_spider::pre_direct_update_rows_init( KEY_MULTI_RANGE *ranges, uint range_count, bool sorted, - uchar *new_data + const uchar *new_data ) { int error_num; DBUG_ENTER("ha_spider::pre_direct_update_rows_init"); diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index 50d890dc854..bd02e34043d 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -569,12 +569,12 @@ public: void end_bulk_update(); int bulk_update_row( const uchar *old_data, - uchar *new_data, + const uchar *new_data, uint *dup_key_found ); int update_row( const uchar *old_data, - uchar *new_data + const uchar *new_data ); #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS int direct_update_rows_init( @@ -582,7 +582,7 @@ public: KEY_MULTI_RANGE *ranges, uint range_count, bool sorted, - uchar *new_data + const uchar *new_data ); #ifdef HA_CAN_BULK_ACCESS int pre_direct_update_rows_init( diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc index 227c8ae6b15..ceab0b29d61 100644 --- a/storage/tokudb/ha_tokudb.cc +++ b/storage/tokudb/ha_tokudb.cc @@ -3604,7 +3604,7 @@ cleanup: return error; } -int ha_tokudb::is_val_unique(bool* is_unique, uchar* record, KEY* key_info, uint dict_index, DB_TXN* txn) { +int ha_tokudb::is_val_unique(bool* is_unique, const uchar* record, KEY* key_info, uint dict_index, DB_TXN* txn) { int error = 0; bool has_null; DBC* tmp_cursor = NULL; @@ -4160,7 +4160,7 @@ bool ha_tokudb::key_changed(uint keynr, const uchar * old_row, const uchar * new // 0 on success // error otherwise // -int ha_tokudb::update_row(const uchar * old_row, uchar * new_row) { +int ha_tokudb::update_row(const uchar * old_row, const uchar * new_row) { TOKUDB_HANDLER_DBUG_ENTER(""); DBT prim_key, old_prim_key, prim_row, old_prim_row; int UNINIT_VAR(error); diff --git a/storage/tokudb/ha_tokudb.h b/storage/tokudb/ha_tokudb.h index 4a7e395d0d1..d240cf1169d 100644 --- a/storage/tokudb/ha_tokudb.h +++ b/storage/tokudb/ha_tokudb.h @@ -708,7 +708,7 @@ private: int create_main_dictionary(const char* name, TABLE* form, DB_TXN* txn, KEY_AND_COL_INFO* kc_info, toku_compression_method compression_method); void trace_create_table_info(const char *name, TABLE * form); int is_index_unique(bool* is_unique, DB_TXN* txn, DB* db, KEY* key_info, int lock_flags); - int is_val_unique(bool* is_unique, uchar* record, KEY* key_info, uint dict_index, DB_TXN* txn); + int is_val_unique(bool* is_unique, const uchar* record, KEY* key_info, uint dict_index, DB_TXN* txn); int do_uniqueness_checks(uchar* record, DB_TXN* txn, THD* thd); void set_main_dict_put_flags(THD* thd, bool opt_eligible, uint32_t* put_flags); int insert_row_to_main_dictionary(uchar* record, DBT* pk_key, DBT* pk_val, DB_TXN* txn); @@ -792,7 +792,7 @@ public: int optimize(THD * thd, HA_CHECK_OPT * check_opt); int analyze(THD * thd, HA_CHECK_OPT * check_opt); int write_row(uchar * buf); - int update_row(const uchar * old_data, uchar * new_data); + int update_row(const uchar * old_data, const uchar * new_data); int delete_row(const uchar * buf); #if MYSQL_VERSION_ID >= 100000 void start_bulk_insert(ha_rows rows, uint flags); diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 11779a66e7c..4a9cfb975fe 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -9389,7 +9389,7 @@ int ha_innobase::update_row( /*====================*/ const uchar* old_row, /*!< in: old row in MySQL format */ - uchar* new_row) /*!< in: new row in MySQL format */ + const uchar* new_row) /*!< in: new row in MySQL format */ { upd_t* uvect; dberr_t error; diff --git a/storage/xtradb/handler/ha_innodb.h b/storage/xtradb/handler/ha_innodb.h index 62b80c492a1..d1ec566b043 100644 --- a/storage/xtradb/handler/ha_innodb.h +++ b/storage/xtradb/handler/ha_innodb.h @@ -148,7 +148,7 @@ class ha_innobase: public handler my_bool is_fake_change_enabled(THD *thd); int write_row(uchar * buf); - int update_row(const uchar * old_data, uchar * new_data); + int update_row(const uchar * old_data, const uchar * new_data); int delete_row(const uchar * buf); bool was_semi_consistent_read(); void try_semi_consistent_read(bool yes);