1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-07 17:42:39 +03:00

Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3

This commit is contained in:
Alexander Barkov
2017-04-19 05:21:36 +04:00
93 changed files with 581 additions and 348 deletions

View File

@@ -581,6 +581,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
my_free(table_names_comma_sep); my_free(table_names_comma_sep);
} }
else else
{
for (; tables > 0; tables--, table_names++) for (; tables > 0; tables--, table_names++)
{ {
table= *table_names; table= *table_names;
@@ -590,6 +591,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
continue; continue;
handle_request_for_tables(table, table_len, view == 1, opt_all_in_1); handle_request_for_tables(table, table_len, view == 1, opt_all_in_1);
} }
}
DBUG_RETURN(0); DBUG_RETURN(0);
} /* process_selected_tables */ } /* process_selected_tables */
@@ -909,16 +911,29 @@ static int handle_request_for_tables(char *tables, size_t length,
} }
break; break;
case DO_ANALYZE: case DO_ANALYZE:
if (view)
{
printf("%-50s %s\n", tables, "Can't run anaylyze on a view");
DBUG_RETURN(1);
}
DBUG_ASSERT(!view); DBUG_ASSERT(!view);
op= (opt_write_binlog) ? "ANALYZE" : "ANALYZE NO_WRITE_TO_BINLOG"; op= (opt_write_binlog) ? "ANALYZE" : "ANALYZE NO_WRITE_TO_BINLOG";
if (opt_persistent_all) end = strmov(end, " PERSISTENT FOR ALL"); if (opt_persistent_all) end = strmov(end, " PERSISTENT FOR ALL");
break; break;
case DO_OPTIMIZE: 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"; op= (opt_write_binlog) ? "OPTIMIZE" : "OPTIMIZE NO_WRITE_TO_BINLOG";
break; break;
case DO_FIX_NAMES: 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)); DBUG_RETURN(fix_table_storage_name(tables));
} }

View File

@@ -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(sql_statef, "/* Autogenerated file, please don't edit */\n\n");
fprintf(er_namef, "/* 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); fprintf(er_definef, "#define ER_ERROR_FIRST %d\n", error_head->d_code);
current_d_code= error_head->d_code -1; 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 */ /* finishing off with mysqld_error.h */
fprintf(er_definef, "#define ER_ERROR_LAST %d\n", er_last); 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(er_definef, MYF(0));
my_fclose(sql_statef, MYF(0)); my_fclose(sql_statef, MYF(0));
my_fclose(er_namef, MYF(0)); my_fclose(er_namef, MYF(0));

View File

@@ -14,7 +14,7 @@ void my_exit(int c)
exit(c); exit(c);
} }
void do_usage() void do_usage(void)
{ {
printf("Usage:\n" printf("Usage:\n"
" %s <user> log <filename>\n" " %s <user> log <filename>\n"
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
MY_INIT(argv[0]); MY_INIT(argv[0]);
if (argc < 3) if (argc < 3)
do_usage(argv[0]); do_usage();
user_info= my_check_user(argv[1], MYF(0)); user_info= my_check_user(argv[1], MYF(0));
if (user_info ? my_set_user(argv[1], user_info, MYF(MY_WME)) if (user_info ? my_set_user(argv[1], user_info, MYF(MY_WME))

View File

@@ -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, extern int maria_rsame_with_pos(MARIA_HA *file, uchar *record,
int inx, MARIA_RECORD_POS pos); int inx, MARIA_RECORD_POS pos);
extern int maria_update(MARIA_HA *file, const uchar *old, 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 int maria_write(MARIA_HA *file, uchar *buff);
extern MARIA_RECORD_POS maria_position(MARIA_HA *file); extern MARIA_RECORD_POS maria_position(MARIA_HA *file);
extern int maria_status(MARIA_HA *info, MARIA_INFO *x, uint flag); extern int maria_status(MARIA_HA *info, MARIA_INFO *x, uint flag);

View File

@@ -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, extern int mi_rsame_with_pos(struct st_myisam_info *file,uchar *record,
int inx, my_off_t pos); int inx, my_off_t pos);
extern int mi_update(struct st_myisam_info *file,const uchar *old, 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 int mi_write(struct st_myisam_info *file,uchar *buff);
extern my_off_t mi_position(struct st_myisam_info *file); 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); extern int mi_status(struct st_myisam_info *info, MI_ISAMINFO *x, uint flag);

View File

@@ -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); 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_rrnd(MYRG_INFO *file,uchar *buf,ulonglong pos);
extern int myrg_rsame(MYRG_INFO *file,uchar *record,int inx); 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_write(MYRG_INFO *info,uchar *rec);
extern int myrg_status(MYRG_INFO *file,MYMERGE_INFO *x,int flag); extern int myrg_status(MYRG_INFO *file,MYMERGE_INFO *x,int flag);
extern int myrg_lock_database(MYRG_INFO *file,int lock_type); extern int myrg_lock_database(MYRG_INFO *file,int lock_type);

View File

@@ -3210,3 +3210,48 @@ DROP TABLE t1,t2;
# #
# End of 10.1 tests # 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;

View File

@@ -3902,5 +3902,36 @@ SELECT 1 MOD COALESCE(a) FROM t1;
ERROR HY000: Illegal parameter data types bigint and geometry for operation '%' ERROR HY000: Illegal parameter data types bigint and geometry for operation '%'
DROP TABLE t1; 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 # End of 10.3 tests
# #

View File

@@ -1817,3 +1817,35 @@ DROP TABLE t1,t2;
--echo # --echo #
--echo # End of 10.1 tests --echo # End of 10.1 tests
--echo # --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;

View File

@@ -2090,6 +2090,40 @@ SELECT 1 MOD COALESCE(a) FROM t1;
DROP TABLE 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 #
--echo # End of 10.3 tests --echo # End of 10.3 tests

View File

@@ -4204,7 +4204,7 @@ exit:
old_data is always record[1] 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(); THD *thd= ha_thd();
uint32 new_part_id, old_part_id; 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", DBUG_PRINT("info", ("Update from partition %d to partition %d",
old_part_id, new_part_id)); old_part_id, new_part_id));
tmp_disable_binlog(thd); /* Do not replicate the low-level changes. */ 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); reenable_binlog(thd);
table->next_number_field= saved_next_number_field; table->next_number_field= saved_next_number_field;
if (error) if (error)

View File

@@ -485,7 +485,7 @@ public:
number of calls to write_row. number of calls to write_row.
*/ */
virtual int write_row(uchar * buf); 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_row(const uchar * buf);
virtual int delete_all_rows(void); virtual int delete_all_rows(void);
virtual int truncate(); virtual int truncate();

View File

@@ -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; int error;
sequence_definition tmp_seq; sequence_definition tmp_seq;

View File

@@ -69,7 +69,7 @@ public:
HA_CREATE_INFO *create_info); HA_CREATE_INFO *create_info);
handler *clone(const char *name, MEM_ROOT *mem_root); handler *clone(const char *name, MEM_ROOT *mem_root);
int write_row(uchar *buf); 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; Table_flags table_flags() const;
/* One can't delete from sequence engine */ /* One can't delete from sequence engine */
int delete_row(const uchar *buf) int delete_row(const uchar *buf)

View File

@@ -4042,7 +4042,7 @@ int handler::ha_repair(THD* thd, HA_CHECK_OPT* check_opt)
*/ */
int 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) uint *dup_key_found)
{ {
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE || 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; int error;
Log_func *log_func= Update_rows_log_event::binlog_row_logging_function; Log_func *log_func= Update_rows_log_event::binlog_row_logging_function;

View File

@@ -1483,13 +1483,15 @@ struct THD_TRANS
unsigned int m_unsafe_rollback_flags; 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. Each type occupies one bit in m_unsafe_rollback_flags.
*/ */
static unsigned int const MODIFIED_NON_TRANS_TABLE= 0x01; enum unsafe_statement_types
static unsigned int const CREATED_TEMP_TABLE= 0x02; {
static unsigned int const DROPPED_TEMP_TABLE= 0x04; CREATED_TEMP_TABLE= 2,
static unsigned int const DID_WAIT= 0x08; DROPPED_TEMP_TABLE= 4,
DID_WAIT= 8
};
void mark_created_temp_table() void mark_created_temp_table()
{ {
@@ -2890,7 +2892,7 @@ public:
*/ */
int ha_external_lock(THD *thd, int lock_type); int ha_external_lock(THD *thd, int lock_type);
int ha_write_row(uchar * buf); 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); int ha_delete_row(const uchar * buf);
void ha_release_auto_increment(); void ha_release_auto_increment();
@@ -2929,7 +2931,7 @@ public:
int ret= end_bulk_insert(); int ret= end_bulk_insert();
DBUG_RETURN(ret); 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); uint *dup_key_found);
int ha_delete_all_rows(); int ha_delete_all_rows();
int ha_truncate(); int ha_truncate();
@@ -4047,7 +4049,7 @@ private:
message will contain garbage. message will contain garbage.
*/ */
virtual int update_row(const uchar *old_data __attribute__((unused)), 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; return HA_ERR_WRONG_COMMAND;
} }
@@ -4135,7 +4137,7 @@ public:
@retval 0 Bulk delete used by handler @retval 0 Bulk delete used by handler
@retval 1 Bulk delete not used, normal operation used @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) uint *dup_key_found)
{ {
DBUG_ASSERT(FALSE); DBUG_ASSERT(FALSE);

View File

@@ -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 Classes and function for the IN operator
****************************************************************************/ ****************************************************************************/

View File

@@ -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) String *Item_real_func::val_str(String *str)
{ {
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);

View File

@@ -75,18 +75,10 @@ public:
{ {
return count_string_length(item, nitems); 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, void aggregate_attributes_temporal(uint int_part_length,
Item **item, uint nitems) 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; table_map not_null_tables_cache;

View File

@@ -1153,7 +1153,7 @@ public:
} }
protected: protected:
static const int NUM_BIT_COUNTERS= 64; enum bit_counters { NUM_BIT_COUNTERS= 64 };
ulonglong reset_bits,bits; ulonglong reset_bits,bits;
/* /*
Marks whether the function is to be computed as a window function. Marks whether the function is to be computed as a window function.

View File

@@ -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) String *Item_temporal_func::val_str(String *str)
{ {
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
@@ -2009,8 +1981,8 @@ void Item_func_from_unixtime::fix_length_and_dec()
THD *thd= current_thd; THD *thd= current_thd;
thd->time_zone_used= 1; thd->time_zone_used= 1;
tz= thd->variables.time_zone; tz= thd->variables.time_zone;
decimals= args[0]->decimals; fix_attributes_datetime_not_fixed_dec(args[0]->decimals);
Item_temporal_func::fix_length_and_dec(); 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() void Item_func_convert_tz::fix_length_and_dec()
{ {
decimals= args[0]->temporal_precision(MYSQL_TYPE_DATETIME); fix_attributes_datetime(args[0]->temporal_precision(MYSQL_TYPE_DATETIME));
Item_temporal_func::fix_length_and_dec(); maybe_null= true;
} }
@@ -2093,6 +2065,13 @@ void Item_date_add_interval::fix_length_and_dec()
{ {
enum_field_types arg0_field_type; 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 The field type for the result of an Item_datefunc is defined as
follows: 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, (This is because you can't know if the string contains a DATE,
MYSQL_TIME or DATETIME argument) MYSQL_TIME or DATETIME argument)
*/ */
set_handler_by_field_type(MYSQL_TYPE_STRING);
arg0_field_type= args[0]->field_type(); arg0_field_type= args[0]->field_type();
uint interval_dec= 0; uint interval_dec= 0;
if (int_type == INTERVAL_MICROSECOND || 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 || if (arg0_field_type == MYSQL_TYPE_DATETIME ||
arg0_field_type == MYSQL_TYPE_TIMESTAMP) arg0_field_type == MYSQL_TYPE_TIMESTAMP)
{ {
decimals= MY_MAX(args[0]->temporal_precision(MYSQL_TYPE_DATETIME), interval_dec); uint dec= MY_MAX(args[0]->temporal_precision(MYSQL_TYPE_DATETIME),
set_handler_by_field_type(MYSQL_TYPE_DATETIME); interval_dec);
set_handler(&type_handler_datetime);
fix_attributes_datetime(dec);
} }
else if (arg0_field_type == MYSQL_TYPE_DATE) else if (arg0_field_type == MYSQL_TYPE_DATE)
{ {
if (int_type <= INTERVAL_DAY || int_type == INTERVAL_YEAR_MONTH) 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 else
{ {
decimals= interval_dec; set_handler(&type_handler_datetime2);
set_handler_by_field_type(MYSQL_TYPE_DATETIME); fix_attributes_datetime(interval_dec);
} }
} }
else if (arg0_field_type == MYSQL_TYPE_TIME) 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) 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 else
set_handler_by_field_type(MYSQL_TYPE_DATETIME); {
set_handler(&type_handler_datetime2);
fix_attributes_datetime(dec);
}
} }
else 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() void Item_func_add_time::fix_length_and_dec()
{ {
enum_field_types arg0_field_type; 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 The field type for the result of an Item_func_add_time function is defined
as follows: as follows:
@@ -2661,24 +2663,32 @@ void Item_func_add_time::fix_length_and_dec()
- Otherwise the result is MYSQL_TYPE_STRING - Otherwise the result is MYSQL_TYPE_STRING
*/ */
set_handler_by_field_type(MYSQL_TYPE_STRING);
arg0_field_type= args[0]->field_type(); arg0_field_type= args[0]->field_type();
if (arg0_field_type == MYSQL_TYPE_DATE || if (arg0_field_type == MYSQL_TYPE_DATE ||
arg0_field_type == MYSQL_TYPE_DATETIME || arg0_field_type == MYSQL_TYPE_DATETIME ||
arg0_field_type == MYSQL_TYPE_TIMESTAMP || arg0_field_type == MYSQL_TYPE_TIMESTAMP ||
is_date) is_date)
{ {
set_handler_by_field_type(MYSQL_TYPE_DATETIME); uint dec= MY_MAX(args[0]->temporal_precision(MYSQL_TYPE_DATETIME),
decimals= MY_MAX(args[0]->temporal_precision(MYSQL_TYPE_DATETIME),
args[1]->temporal_precision(MYSQL_TYPE_TIME)); args[1]->temporal_precision(MYSQL_TYPE_TIME));
set_handler(&type_handler_datetime2);
fix_attributes_datetime(dec);
} }
else if (arg0_field_type == MYSQL_TYPE_TIME) else if (arg0_field_type == MYSQL_TYPE_TIME)
{ {
set_handler_by_field_type(MYSQL_TYPE_TIME); uint dec= MY_MAX(args[0]->temporal_precision(MYSQL_TYPE_TIME),
decimals= MY_MAX(args[0]->temporal_precision(MYSQL_TYPE_TIME),
args[1]->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() 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)) if (agg_arg_charsets(collation, args, 2, MY_COLL_ALLOW_CONV, 1))
return; return;
if (collation.collation->mbminlen > 1) if (collation.collation->mbminlen > 1)
@@ -3180,8 +3198,10 @@ void Item_func_str_to_date::fix_length_and_dec()
#endif #endif
} }
set_handler_by_field_type(MYSQL_TYPE_DATETIME); maybe_null= true;
decimals= TIME_SECOND_PART_DIGITS; set_handler(&type_handler_datetime2);
fix_attributes_datetime(TIME_SECOND_PART_DIGITS);
if ((const_item= args[1]->const_item())) if ((const_item= args[1]->const_item()))
{ {
char format_buff[64]; 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()); get_date_time_result_type(format->ptr(), format->length());
switch (cached_format_type) { switch (cached_format_type) {
case DATE_ONLY: case DATE_ONLY:
set_handler_by_field_type(MYSQL_TYPE_DATE); set_handler(&type_handler_newdate);
fix_attributes_date();
break; break;
case TIME_MICROSECOND: case TIME_MICROSECOND:
decimals= 6; set_handler(&type_handler_time2);
/* fall through */ fix_attributes_time(TIME_SECOND_PART_DIGITS);
break;
case TIME_ONLY: case TIME_ONLY:
set_handler_by_field_type(MYSQL_TYPE_TIME); set_handler(&type_handler_time2);
fix_attributes_time(0);
break; break;
case DATE_TIME_MICROSECOND: case DATE_TIME_MICROSECOND:
decimals= 6; set_handler(&type_handler_datetime2);
/* fall through */ fix_attributes_datetime(TIME_SECOND_PART_DIGITS);
break;
case DATE_TIME: case DATE_TIME:
set_handler_by_field_type(MYSQL_TYPE_DATETIME); set_handler(&type_handler_datetime2);
fix_attributes_datetime(0);
break; break;
} }
} }
} }
cached_timestamp_type= mysql_type_to_time_type(field_type()); cached_timestamp_type= mysql_type_to_time_type(field_type());
Item_temporal_func::fix_length_and_dec();
} }

View File

@@ -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); bool get_interval_value(Item *args,interval_type int_type, INTERVAL *interval);
class Item_func_period_add :public Item_int_func class Item_func_period_add :public Item_int_func
@@ -531,7 +521,6 @@ public:
class Item_temporal_func: public Item_func class Item_temporal_func: public Item_func
{ {
sql_mode_t sql_mode;
public: public:
Item_temporal_func(THD *thd): Item_func(thd) {} Item_temporal_func(THD *thd): Item_func(thd) {}
Item_temporal_func(THD *thd, Item *a): Item_func(thd, a) {} 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); } { return tmp_table_field_from_field_type(table, false, false); }
int save_in_field(Field *field, bool no_conversions) int save_in_field(Field *field, bool no_conversions)
{ return save_date_in_field(field, 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, Abstract class for functions returning TIME, DATE, DATETIME or string values,
whose data type depends on parameters and is set at fix_fields time. whose data type depends on parameters and is set at fix_fields time.
*/ */
class Item_temporal_hybrid_func: public Item_temporal_func, class Item_temporal_hybrid_func: public Item_hybrid_func
public Type_handler_hybrid_field_type
{ {
protected: protected:
String ascii_buf; // Conversion buffer String ascii_buf; // Conversion buffer
public: public:
Item_temporal_hybrid_func(THD *thd, Item *a, Item *b): Item_temporal_hybrid_func(THD *thd, Item *a, Item *b):
Item_temporal_func(thd, a, b) {} Item_hybrid_func(thd, a, b) {}
const Type_handler *type_handler() const
{ return Type_handler_hybrid_field_type::type_handler(); } longlong val_int() { return val_int_from_date(); }
enum_field_types field_type() const double val_real() { return val_real_from_date(); }
{ return Type_handler_hybrid_field_type::field_type(); } bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date)= 0;
enum Item_result result_type () const my_decimal *val_decimal(my_decimal *decimal_value)
{ return Type_handler_hybrid_field_type::result_type(); } { return val_decimal_from_date(decimal_value); }
enum Item_result cmp_type () const
{ return Type_handler_hybrid_field_type::cmp_type(); }
/** /**
Fix the returned timestamp to match field_type(), Fix the returned timestamp to match field_type(),
which is important for val_str(). which is important for val_str().
@@ -597,7 +583,13 @@ class Item_datefunc :public Item_temporal_func
public: public:
Item_datefunc(THD *thd): Item_temporal_func(thd) { } 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_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; } 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) Item_func_curtime(THD *thd, uint dec): Item_timefunc(thd), last_query_id(0)
{ decimals= dec; } { decimals= dec; }
bool fix_fields(THD *, Item **); bool fix_fields(THD *, Item **);
void fix_length_and_dec() { fix_attributes_time(decimals); }
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date); bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
/* /*
Abstract method that defines which time zone is used for conversion. 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) Item_func_now(THD *thd, uint dec): Item_datetimefunc(thd), last_query_id(0)
{ decimals= dec; } { decimals= dec; }
bool fix_fields(THD *, Item **); bool fix_fields(THD *, Item **);
void fix_length_and_dec() { fix_attributes_datetime(decimals); }
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date); bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)=0; virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)=0;
bool check_vcol_func_processor(void *arg) bool check_vcol_func_processor(void *arg)
@@ -885,8 +879,8 @@ public:
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date); bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
void fix_length_and_dec() void fix_length_and_dec()
{ {
decimals= MY_MIN(args[0]->decimals, TIME_SECOND_PART_DIGITS); fix_attributes_time(args[0]->decimals);
Item_timefunc::fix_length_and_dec(); maybe_null= true;
} }
const char *func_name() const { return "sec_to_time"; } const char *func_name() const { return "sec_to_time"; }
Item *get_copy(THD *thd, MEM_ROOT *mem_root) 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) {} Item_temporal_typecast(THD *thd, Item *a): Item_temporal_func(thd, a) {}
virtual const char *cast_type() const = 0; virtual const char *cast_type() const = 0;
void print(String *str, enum_query_type query_type); 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) if (decimals == NOT_FIXED_DEC)
decimals= args[0]->temporal_precision(field_type()); 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: public:
Item_func_makedate(THD *thd, Item *a, Item *b): 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"; } 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); bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
Item *get_copy(THD *thd, MEM_ROOT *mem_root) Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_makedate>(thd, mem_root, this); } { return get_item_copy<Item_func_makedate>(thd, mem_root, this); }
@@ -1163,9 +1157,10 @@ public:
const char *func_name() const { return "timediff"; } const char *func_name() const { return "timediff"; }
void fix_length_and_dec() 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)); 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); bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
Item *get_copy(THD *thd, MEM_ROOT *mem_root) Item *get_copy(THD *thd, MEM_ROOT *mem_root)
@@ -1180,8 +1175,8 @@ public:
{} {}
void fix_length_and_dec() void fix_length_and_dec()
{ {
decimals= MY_MIN(args[2]->decimals, TIME_SECOND_PART_DIGITS); fix_attributes_time(args[2]->decimals);
Item_timefunc::fix_length_and_dec(); maybe_null= true;
} }
const char *func_name() const { return "maketime"; } const char *func_name() const { return "maketime"; }
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date); bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);

View File

@@ -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 @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 key_length, bool with_zerofill)
{ {
uint length; uint length;

View File

@@ -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, int find_ref_key(KEY *key, uint key_count, uchar *record, Field *field,
uint *key_length, uint *keypart); uint *key_length, uint *keypart);
void key_copy(uchar *to_key, uchar *from_record, KEY *key_info, uint key_length, void key_copy(uchar *to_key, const uchar *from_record, KEY *key_info,
bool with_zerofill= FALSE); uint key_length, bool with_zerofill= FALSE);
void key_restore(uchar *to_record, const uchar *from_key, KEY *key_info, void key_restore(uchar *to_record, const uchar *from_key, KEY *key_info,
uint key_length); uint key_length);
bool key_cmp_if_same(TABLE *form,const uchar *key,uint index,uint key_length); bool key_cmp_if_same(TABLE *form,const uchar *key,uint index,uint key_length);

View File

@@ -3459,7 +3459,7 @@ public:
The three elements in the body repeat COUNT times to form the GTID list. 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 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 Gtid_list event from the master to the slave to indicate that the START
@@ -3477,9 +3477,12 @@ public:
uint64 *sub_id_list; uint64 *sub_id_list;
static const uint element_size= 4+4+8; static const uint element_size= 4+4+8;
static const uint32 FLAG_UNTIL_REACHED= (1<<28); /* Upper bits stored in 'count'. See comment above */
static const uint32 FLAG_IGN_GTIDS= (1<<29); enum gtid_flags
{
FLAG_UNTIL_REACHED= (1<<28),
FLAG_IGN_GTIDS= (1<<29),
};
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
Gtid_list_log_event(rpl_binlog_state *gtid_set, uint32 gl_flags); Gtid_list_log_event(rpl_binlog_state *gtid_set, uint32 gl_flags);
Gtid_list_log_event(slave_connection_state *gtid_set, uint32 gl_flags); Gtid_list_log_event(slave_connection_state *gtid_set, uint32 gl_flags);

View File

@@ -270,8 +270,12 @@ struct slave_connection_state
rpl_gtid gtid; rpl_gtid gtid;
uint32 flags; uint32 flags;
}; };
static const uint32 START_OWN_SLAVE_POS= 0x1; /* Bits for 'flags' */
static const uint32 START_ON_EMPTY_DOMAIN= 0x2; 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. */ /* Mapping from domain_id to the entry with GTID requested for that domain. */
HASH hash; HASH hash;

View File

@@ -68,23 +68,27 @@ struct group_commit_orderer {
*/ */
bool installed; bool installed;
/* 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 This flag is set for a GCO in which we have event groups with multiple
conflict-free. 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 When this flag is set, in case of DDL we need to start a new GCO
of current commit_id, as DDL is not safe to speculatively apply in parallel regardless of current commit_id, as DDL is not safe to
with prior event groups. speculatively apply in parallel with prior event groups.
*/ */
static const uint8 MULTI_BATCH = 0x01; MULTI_BATCH= 1,
/* /*
This flag is set for a GCO that contains DDL. If set, it forces a switch to This flag is set for a GCO that contains DDL. If set, it forces
a new GCO upon seeing a new commit_id, as DDL is not safe to speculatively a switch to a new GCO upon seeing a new commit_id, as DDL is not
replicate in parallel with subsequent transactions. safe to speculatively replicate in parallel with subsequent
*/ transactions.
static const uint8 FORCE_SWITCH = 0x02; */
FORCE_SWITCH= 2
};
uint8 flags; uint8 flags;
}; };

View File

@@ -38,91 +38,65 @@ public:
type of index to be added/dropped. type of index to be added/dropped.
*/ */
// Set for ADD [COLUMN] enum operations_used_flags
static const uint ALTER_ADD_COLUMN = 1L << 0; {
// Set for ADD [COLUMN]
// Set for DROP [COLUMN] ALTER_ADD_COLUMN = 1L << 0,
static const uint ALTER_DROP_COLUMN = 1L << 1; // Set for DROP [COLUMN]
ALTER_DROP_COLUMN = 1L << 1,
// Set for CHANGE [COLUMN] | MODIFY [CHANGE] // Set for CHANGE [COLUMN] | MODIFY [CHANGE] & mysql_recreate_table
// Set by mysql_recreate_table() ALTER_CHANGE_COLUMN = 1L << 2,
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]
// Set for ADD INDEX | ADD KEY | ADD PRIMARY KEY | ADD UNIQUE KEY | ALTER_ADD_INDEX = 1L << 3,
// ADD UNIQUE INDEX | ALTER ADD [COLUMN] // Set for DROP PRIMARY KEY | DROP FOREIGN KEY | DROP KEY | DROP INDEX
static const uint ALTER_ADD_INDEX = 1L << 3; ALTER_DROP_INDEX = 1L << 4,
// Set for RENAME [TO]
// Set for DROP PRIMARY KEY | DROP FOREIGN KEY | DROP KEY | DROP INDEX ALTER_RENAME = 1L << 5,
static const uint ALTER_DROP_INDEX = 1L << 4; // Set for ORDER BY
ALTER_ORDER = 1L << 6,
// Set for RENAME [TO] // Set for table_options
static const uint ALTER_RENAME = 1L << 5; ALTER_OPTIONS = 1L << 7,
// Set for ALTER [COLUMN] ... SET DEFAULT ... | DROP DEFAULT
// Set for ORDER BY ALTER_CHANGE_COLUMN_DEFAULT = 1L << 8,
static const uint ALTER_ORDER = 1L << 6; // Set for DISABLE KEYS | ENABLE KEYS
ALTER_KEYS_ONOFF = 1L << 9,
// Set for table_options // Set for FORCE, ENGINE(same engine), by mysql_recreate_table()
static const uint ALTER_OPTIONS = 1L << 7; ALTER_RECREATE = 1L << 10,
// Set for ADD PARTITION
// Set for ALTER [COLUMN] ... SET DEFAULT ... | DROP DEFAULT ALTER_ADD_PARTITION = 1L << 11,
static const uint ALTER_CHANGE_COLUMN_DEFAULT = 1L << 8; // Set for DROP PARTITION
ALTER_DROP_PARTITION = 1L << 12,
// Set for DISABLE KEYS | ENABLE KEYS // Set for COALESCE PARTITION
static const uint ALTER_KEYS_ONOFF = 1L << 9; ALTER_COALESCE_PARTITION = 1L << 13,
// Set for REORGANIZE PARTITION ... INTO
// Set for FORCE ALTER_REORGANIZE_PARTITION = 1L << 14,
// Set for ENGINE(same engine) // Set for partition_options
// Set by mysql_recreate_table() ALTER_PARTITION = 1L << 15,
static const uint ALTER_RECREATE = 1L << 10; // Set for LOAD INDEX INTO CACHE ... PARTITION
// Set for CACHE INDEX ... PARTITION
// Set for ADD PARTITION ALTER_ADMIN_PARTITION = 1L << 16,
static const uint ALTER_ADD_PARTITION = 1L << 11; // Set for REORGANIZE PARTITION
ALTER_TABLE_REORG = 1L << 17,
// Set for DROP PARTITION // Set for REBUILD PARTITION
static const uint ALTER_DROP_PARTITION = 1L << 12; ALTER_REBUILD_PARTITION = 1L << 18,
// Set for partitioning operations specifying ALL keyword
// Set for COALESCE PARTITION ALTER_ALL_PARTITION = 1L << 19,
static const uint ALTER_COALESCE_PARTITION = 1L << 13; // Set for REMOVE PARTITIONING
ALTER_REMOVE_PARTITIONING = 1L << 20,
// Set for REORGANIZE PARTITION ... INTO // Set for ADD FOREIGN KEY
static const uint ALTER_REORGANIZE_PARTITION = 1L << 14; ADD_FOREIGN_KEY = 1L << 21,
// Set for DROP FOREIGN KEY
// Set for partition_options DROP_FOREIGN_KEY = 1L << 22,
static const uint ALTER_PARTITION = 1L << 15; // Set for EXCHANGE PARITION
ALTER_EXCHANGE_PARTITION = 1L << 23,
// Set for LOAD INDEX INTO CACHE ... PARTITION // Set by Sql_cmd_alter_table_truncate_partition::execute()
// Set for CACHE INDEX ... PARTITION ALTER_TRUNCATE_PARTITION = 1L << 24,
static const uint ALTER_ADMIN_PARTITION = 1L << 16; // Set for ADD [COLUMN] FIRST | AFTER
ALTER_COLUMN_ORDER = 1L << 25,
// Set for REORGANIZE PARTITION ALTER_ADD_CHECK_CONSTRAINT = 1L << 27,
static const uint ALTER_TABLE_REORG = 1L << 17; ALTER_DROP_CHECK_CONSTRAINT = 1L << 28
};
// 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 enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE }; 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 of columns, used by both CREATE and ALTER TABLE.
List<Create_field> create_list; List<Create_field> create_list;
static const uint CHECK_CONSTRAINT_IF_NOT_EXISTS= 1; enum flags_bits
{
CHECK_CONSTRAINT_IF_NOT_EXISTS= 1
};
List<Virtual_column_info> check_constraint_list; List<Virtual_column_info> check_constraint_list;
// Type of ALTER TABLE operation. // Type of ALTER TABLE operation.
uint flags; uint flags;

View File

@@ -3012,7 +3012,7 @@ static int mysql_create_routine(THD *thd, LEX *lex)
return false; return false;
} }
#ifdef WITH_WSREP #ifdef WITH_WSREP
error: error: /* Used by WSREP_TO_ISOLATION_BEGIN */
#endif #endif
return true; return true;
} }

View File

@@ -282,7 +282,7 @@ bool partition_default_handling(THD *thd, TABLE *table, partition_info *part_inf
> 0 Error code > 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, const uchar *rec0, partition_info *part_info,
uint32 *old_part_id, uint32 *new_part_id, uint32 *old_part_id, uint32 *new_part_id,
longlong *new_func_value) longlong *new_func_value)

View File

@@ -85,7 +85,7 @@ bool check_reorganise_list(partition_info *new_part_info,
partition_info *old_part_info, partition_info *old_part_info,
List<char> list_part_names); List<char> list_part_names);
handler *get_ha_partition(partition_info *part_info); 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, const uchar *rec0, partition_info *part_info,
uint32 *old_part_id, uint32 *new_part_id, uint32 *old_part_id, uint32 *new_part_id,
longlong *func_value); longlong *func_value);

View File

@@ -26,14 +26,10 @@ static Type_handler_long type_handler_long;
static Type_handler_int24 type_handler_int24; static Type_handler_int24 type_handler_int24;
static Type_handler_year type_handler_year; static Type_handler_year type_handler_year;
static Type_handler_time type_handler_time; static Type_handler_time type_handler_time;
static Type_handler_time2 type_handler_time2;
static Type_handler_date type_handler_date; 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_timestamp type_handler_timestamp;
static Type_handler_timestamp2 type_handler_timestamp2; static Type_handler_timestamp2 type_handler_timestamp2;
static Type_handler_olddecimal type_handler_olddecimal; 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_tiny_blob type_handler_tiny_blob;
static Type_handler_medium_blob type_handler_medium_blob; static Type_handler_medium_blob type_handler_medium_blob;
static Type_handler_long_blob type_handler_long_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_null type_handler_null;
Type_handler_row type_handler_row; Type_handler_row type_handler_row;
Type_handler_string type_handler_string;
Type_handler_varchar type_handler_varchar; Type_handler_varchar type_handler_varchar;
Type_handler_longlong type_handler_longlong; Type_handler_longlong type_handler_longlong;
Type_handler_float type_handler_float; Type_handler_float type_handler_float;
@@ -52,6 +49,10 @@ Type_handler_bit type_handler_bit;
Type_handler_enum type_handler_enum; Type_handler_enum type_handler_enum;
Type_handler_set type_handler_set; 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 #ifdef HAVE_SPATIAL
Type_handler_geometry type_handler_geometry; Type_handler_geometry type_handler_geometry;
#endif #endif
@@ -1346,7 +1347,7 @@ bool Type_handler_date_common::
Item_hybrid_func_fix_attributes(THD *thd, Item_hybrid_func *func, Item_hybrid_func_fix_attributes(THD *thd, Item_hybrid_func *func,
Item **items, uint nitems) const Item **items, uint nitems) const
{ {
func->set_attributes_temporal(MAX_DATE_WIDTH, 0); func->fix_attributes_date();
return false; return false;
} }
@@ -2688,7 +2689,7 @@ bool Type_handler_numeric::
bool Type_handler:: bool Type_handler::
Item_time_typecast_fix_length_and_dec(Item_time_typecast *item) const 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; return false;
} }
@@ -2696,7 +2697,7 @@ bool Type_handler::
bool Type_handler:: bool Type_handler::
Item_date_typecast_fix_length_and_dec(Item_date_typecast *item) const 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; return false;
} }
@@ -2705,7 +2706,7 @@ bool Type_handler::
Item_datetime_typecast_fix_length_and_dec(Item_datetime_typecast *item) Item_datetime_typecast_fix_length_and_dec(Item_datetime_typecast *item)
const const
{ {
item->fix_length_and_dec_generic(); item->fix_length_and_dec_generic(MAX_DATETIME_WIDTH);
return false; return false;
} }

View File

@@ -23,6 +23,8 @@
#include "mysqld.h" #include "mysqld.h"
#include "sql_array.h" #include "sql_array.h"
#include "sql_const.h"
#include "my_time.h"
class Field; class Field;
class Item; class Item;
@@ -261,6 +263,54 @@ public:
max_length= char_to_byte_length_safe(max_char_length_arg, max_length= char_to_byte_length_safe(max_char_length_arg,
collation.collation->mbmaxlen); 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_row type_handler_row;
extern Type_handler_null type_handler_null; extern Type_handler_null type_handler_null;
extern Type_handler_string type_handler_string;
extern Type_handler_varchar type_handler_varchar; extern Type_handler_varchar type_handler_varchar;
extern Type_handler_longlong type_handler_longlong; extern Type_handler_longlong type_handler_longlong;
extern Type_handler_float type_handler_float; 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_enum type_handler_enum;
extern Type_handler_set type_handler_set; 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 class Type_aggregator
{ {

View File

@@ -105,7 +105,7 @@ int ha_blackhole::write_row(uchar * buf)
DBUG_RETURN(table->next_number_field ? update_auto_increment() : 0); 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"); DBUG_ENTER("ha_blackhole::update_row");
THD *thd= ha_thd(); THD *thd= ha_thd();

View File

@@ -97,6 +97,6 @@ public:
enum thr_lock_type lock_type); enum thr_lock_type lock_type);
private: private:
virtual int write_row(uchar *buf); 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_row(const uchar *buf);
}; };

View File

@@ -2097,7 +2097,7 @@ int ha_connect::MakeRecord(char *buf)
/***********************************************************************/ /***********************************************************************/
/* Set row values from a MySQL pseudo record. Specific to MySQL. */ /* 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 attr_buffer[1024];
char data_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. */ /* Check change in index column. Specific to MySQL. */
/* Should be elaborated to check for real changes. */ /* 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); return ScanRecord(g, newbuf);
} // end of dummy CheckRecord } // end of dummy CheckRecord
@@ -3417,7 +3417,7 @@ int ha_connect::write_row(uchar *buf)
@see @see
sql_select.cc, sql_acl.cc, sql_update.cc and sql_insert.cc 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; int rc= 0;
PGLOBAL& g= xp->g; PGLOBAL& g= xp->g;

View File

@@ -206,8 +206,8 @@ public:
bool IsOpened(void); bool IsOpened(void);
int CloseTable(PGLOBAL g); int CloseTable(PGLOBAL g);
int MakeRecord(char *buf); int MakeRecord(char *buf);
int ScanRecord(PGLOBAL g, uchar *buf); int ScanRecord(PGLOBAL g, const uchar *buf);
int CheckRecord(PGLOBAL g, const uchar *oldbuf, uchar *newbuf); int CheckRecord(PGLOBAL g, const uchar *oldbuf, const uchar *newbuf);
int ReadIndexed(uchar *buf, OPVAL op, const key_range *kr= NULL); int ReadIndexed(uchar *buf, OPVAL op, const key_range *kr= NULL);
bool IsIndexed(Field *fp); bool IsIndexed(Field *fp);
bool MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL op, char q, 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; We implement this in ha_connect.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented. 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 /** @brief
We implement this in ha_connect.cc. It's not an obligatory method; We implement this in ha_connect.cc. It's not an obligatory method;

View File

@@ -519,7 +519,7 @@ ha_tina::ha_tina(handlerton *hton, TABLE_SHARE *table_arg)
Encode a buffer into the quoted format. 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]; char attribute_buffer[1024];
String attribute(attribute_buffer, sizeof(attribute_buffer), 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() This will be called in a table scan right before the previous ::rnd_next()
call. 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 size;
int rc= -1; int rc= -1;

View File

@@ -137,7 +137,7 @@ public:
int open(const char *name, int mode, uint open_options); int open(const char *name, int mode, uint open_options);
int close(void); int close(void);
int write_row(uchar * buf); 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 delete_row(const uchar * buf);
int rnd_init(bool scan=1); int rnd_init(bool scan=1);
int rnd_next(uchar *buf); int rnd_next(uchar *buf);
@@ -173,7 +173,7 @@ public:
void update_status(); void update_status();
/* The following methods were added just for TINA */ /* 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 find_current_row(uchar *buf);
int chain_append(); int chain_append();
}; };

View File

@@ -431,7 +431,7 @@ int ha_example::write_row(uchar *buf)
@see @see
sql_select.cc, sql_acl.cc, sql_update.cc and sql_insert.cc 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"); DBUG_ENTER("ha_example::update_row");

View File

@@ -186,7 +186,7 @@ public:
We implement this in ha_example.cc. It's not an obligatory method; We implement this in ha_example.cc. It's not an obligatory method;
skip it and and MySQL will treat it as not implemented. 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 /** @brief
We implement this in ha_example.cc. It's not an obligatory method; We implement this in ha_example.cc. It's not an obligatory method;

View File

@@ -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. 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 This used to control how the query was built. If there was a

View File

@@ -210,7 +210,7 @@ public:
void start_bulk_insert(ha_rows rows, uint flags); void start_bulk_insert(ha_rows rows, uint flags);
int end_bulk_insert(); int end_bulk_insert();
int write_row(uchar *buf); 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 delete_row(const uchar *buf);
int index_init(uint keynr, bool sorted); int index_init(uint keynr, bool sorted);
ha_rows estimate_rows_upper_bound(); ha_rows estimate_rows_upper_bound();

View File

@@ -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. 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 This used to control how the query was built. If there was a

View File

@@ -394,7 +394,7 @@ public:
void start_bulk_insert(ha_rows rows, uint flags); void start_bulk_insert(ha_rows rows, uint flags);
int end_bulk_insert(); int end_bulk_insert();
int write_row(uchar *buf); 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 delete_row(const uchar *buf);
int index_init(uint keynr, bool sorted); int index_init(uint keynr, bool sorted);
ha_rows estimate_rows_upper_bound(); ha_rows estimate_rows_upper_bound();

View File

@@ -251,7 +251,7 @@ int ha_heap::write_row(uchar * buf)
return res; 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; int res;
res= heap_update(file,old_data,new_data); res= heap_update(file,old_data,new_data);

View File

@@ -71,7 +71,7 @@ public:
int close(void); int close(void);
void set_keys_for_scanning(void); void set_keys_for_scanning(void);
int write_row(uchar * buf); 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 delete_row(const uchar * buf);
virtual void get_auto_increment(ulonglong offset, ulonglong increment, virtual void get_auto_increment(ulonglong offset, ulonglong increment,
ulonglong nb_desired_values, ulonglong nb_desired_values,

View File

@@ -8910,7 +8910,7 @@ dberr_t
calc_row_difference( calc_row_difference(
upd_t* uvect, upd_t* uvect,
const uchar* old_row, const uchar* old_row,
uchar* new_row, const uchar* new_row,
TABLE* table, TABLE* table,
uchar* upd_buff, uchar* upd_buff,
ulint buff_len, ulint buff_len,
@@ -9406,7 +9406,7 @@ if its index columns are updated!
int int
ha_innobase::update_row( ha_innobase::update_row(
const uchar* old_row, const uchar* old_row,
uchar* new_row) const uchar* new_row)
{ {
int err; int err;

View File

@@ -138,7 +138,7 @@ public:
int write_row(uchar * buf); 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 delete_row(const uchar * buf);

View File

@@ -2311,7 +2311,7 @@ bool ha_maria::is_crashed() const
} \ } \
} while(0) } 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"); CHECK_UNTIL_WE_FULLY_IMPLEMENTED_VERSIONING("UPDATE in WRITE CONCURRENT");
return maria_update(file, old_data, new_data); return maria_update(file, old_data, new_data);

View File

@@ -75,7 +75,7 @@ public:
int open(const char *name, int mode, uint test_if_locked); int open(const char *name, int mode, uint test_if_locked);
int close(void); int close(void);
int write_row(uchar * buf); 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 delete_row(const uchar * buf);
int index_read_map(uchar * buf, const uchar * key, key_part_map keypart_map, int index_read_map(uchar * buf, const uchar * key, key_part_map keypart_map,
enum ha_rkey_function find_flag); enum ha_rkey_function find_flag);

View File

@@ -27,8 +27,9 @@
isn't any versioning information. isn't any versioning information.
*/ */
my_bool _ma_check_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, uchar *record, my_bool _ma_check_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
ha_checksum unique_hash, my_off_t disk_pos) const uchar *record,
ha_checksum unique_hash, my_off_t disk_pos)
{ {
my_off_t lastpos=info->cur_row.lastpos; my_off_t lastpos=info->cur_row.lastpos;
MARIA_KEYDEF *keyinfo= &info->s->keyinfo[def->key]; 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_ENTER("_ma_check_unique");
DBUG_PRINT("enter",("unique_hash: %lu", (ulong) unique_hash)); 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); maria_unique_store(record+keyinfo->seg->start, unique_hash);
/* Can't be spatial so it's ok to call _ma_make_key directly here */ /* 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); _ma_make_key(info, &key, def->key, key_buff, record, 0, 0);

View File

@@ -21,7 +21,8 @@
Update an old row in a MARIA table 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; int flag,key_changed,save_errno;
reg3 my_off_t pos; reg3 my_off_t pos;

View File

@@ -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_checksum(MARIA_HA *info, const uchar *buf);
ha_checksum _ma_static_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, 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); MARIA_RECORD_POS pos);
ha_checksum _ma_unique_hash(MARIA_UNIQUEDEF *def, const uchar *buf); ha_checksum _ma_unique_hash(MARIA_UNIQUEDEF *def, const uchar *buf);
my_bool _ma_cmp_static_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def, my_bool _ma_cmp_static_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,

View File

@@ -5674,7 +5674,7 @@ err:
DBUG_RETURN(error); 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, KEY *key_info,
grn_obj *index_table, grn_obj *index_table,
grn_obj *index_column, grn_obj *index_column,
@@ -5856,7 +5856,8 @@ int ha_mroonga::wrapper_get_record_id(uchar *data, grn_id *record_id,
DBUG_RETURN(error); 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(); MRN_DBUG_ENTER_METHOD();
@@ -5877,7 +5878,8 @@ int ha_mroonga::wrapper_update_row(const uchar *old_data, uchar *new_data)
DBUG_RETURN(error); 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(); MRN_DBUG_ENTER_METHOD();
@@ -5989,7 +5991,8 @@ err:
DBUG_RETURN(error); 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(); MRN_DBUG_ENTER_METHOD();
int error = 0; int error = 0;
@@ -6152,7 +6155,8 @@ err:
DBUG_RETURN(error); 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(); MRN_DBUG_ENTER_METHOD();
int error = 0; int error = 0;
@@ -6244,7 +6248,7 @@ err:
DBUG_RETURN(error); 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; int error;
uint i; uint i;
@@ -6321,7 +6325,7 @@ err:
DBUG_RETURN(error); 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(); MRN_DBUG_ENTER_METHOD();
int error = 0; 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, void ha_mroonga::storage_store_fields_for_prep_update(const uchar *old_data,
uchar *new_data, const uchar *new_data,
grn_id record_id) grn_id record_id)
{ {
MRN_DBUG_ENTER_METHOD(); MRN_DBUG_ENTER_METHOD();

View File

@@ -384,7 +384,7 @@ public:
int delete_table(const char *name); int delete_table(const char *name);
int write_row(uchar *buf); 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 delete_row(const uchar *buf);
uint max_supported_record_length() const; uint max_supported_record_length() const;
@@ -692,7 +692,7 @@ private:
int nth_column, grn_id record_id); int nth_column, grn_id record_id);
void storage_store_fields(uchar *buf, 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, void storage_store_fields_for_prep_update(const uchar *old_data,
uchar *new_data, const uchar *new_data,
grn_id record_id); grn_id record_id);
void storage_store_fields_by_index(uchar *buf); void storage_store_fields_by_index(uchar *buf);
@@ -827,18 +827,21 @@ private:
KEY *key_info, KEY *key_info,
grn_obj *index_column); grn_obj *index_column);
int storage_write_row_multiple_column_indexes(uchar *buf, grn_id record_id); 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, KEY *key_info,
grn_obj *index_table, grn_obj *index_table,
grn_obj *index_column, grn_obj *index_column,
grn_id *key_id); grn_id *key_id);
int storage_write_row_unique_indexes(uchar *buf); int storage_write_row_unique_indexes(uchar *buf);
int wrapper_get_record_id(uchar *data, grn_id *record_id, const char *context); int wrapper_get_record_id(uchar *data, grn_id *record_id,
int wrapper_update_row(const uchar *old_data, uchar *new_data); const char *context);
int wrapper_update_row_index(const uchar *old_data, uchar *new_data); int wrapper_update_row(const uchar *old_data, const uchar *new_data);
int storage_update_row(const uchar *old_data, uchar *new_data); int wrapper_update_row_index(const uchar *old_data,
int storage_update_row_index(const uchar *old_data, uchar *new_data); const uchar *new_data);
int storage_update_row_unique_indexes(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(const uchar *buf);
int wrapper_delete_row_index(const uchar *buf); int wrapper_delete_row_index(const uchar *buf);
int storage_delete_row(const uchar *buf); int storage_delete_row(const uchar *buf);

View File

@@ -1779,7 +1779,7 @@ bool ha_myisam::is_crashed() const
(my_disable_locking && file->s->state.open_count)); (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); return mi_update(file,old_data,new_data);
} }

View File

@@ -71,7 +71,7 @@ class ha_myisam: public handler
int open(const char *name, int mode, uint test_if_locked); int open(const char *name, int mode, uint test_if_locked);
int close(void); int close(void);
int write_row(uchar * buf); 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 delete_row(const uchar * buf);
int index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map, int index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map,
enum ha_rkey_function find_flag); enum ha_rkey_function find_flag);

View File

@@ -19,7 +19,7 @@
#include "myisamdef.h" #include "myisamdef.h"
#include <m_ctype.h> #include <m_ctype.h>
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) ha_checksum unique_hash, my_off_t disk_pos)
{ {
my_off_t lastpos=info->lastpos; 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; uchar *key_buff=info->lastkey2;
DBUG_ENTER("mi_check_unique"); 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); _mi_make_key(info,def->key,key_buff,record,0);
/* The above changed info->lastkey2. Inform mi_rnext_same(). */ /* The above changed info->lastkey2. Inform mi_rnext_same(). */

View File

@@ -19,7 +19,8 @@
#include "fulltext.h" #include "fulltext.h"
#include "rt_index.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; int flag,key_changed,save_errno;
reg3 my_off_t pos; reg3 my_off_t pos;

View File

@@ -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); 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_checksum(MI_INFO *info, const uchar *buf);
ha_checksum mi_static_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 unique_hash, my_off_t pos);
ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const uchar *buf); ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const uchar *buf);
int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def, int _mi_cmp_static_unique(MI_INFO *info, MI_UNIQUEDEF *def,

View File

@@ -1104,7 +1104,7 @@ int ha_myisammrg::write_row(uchar * buf)
DBUG_RETURN(myrg_write(file,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); DBUG_ASSERT(this->file->children_attached);
return myrg_update(file,old_data,new_data); return myrg_update(file,old_data,new_data);

View File

@@ -112,7 +112,7 @@ public:
virtual handler *clone(const char *name, MEM_ROOT *mem_root); virtual handler *clone(const char *name, MEM_ROOT *mem_root);
int close(void); int close(void);
int write_row(uchar * buf); 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 delete_row(const uchar * buf);
int index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map, int index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map,
enum ha_rkey_function find_flag); enum ha_rkey_function find_flag);

View File

@@ -18,7 +18,8 @@
#include "myrg_def.h" #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) if (!info->current_table)
return (my_errno=HA_ERR_NO_ACTIVE_RECORD); return (my_errno=HA_ERR_NO_ACTIVE_RECORD);

View File

@@ -803,7 +803,7 @@ int ha_oqgraph::write_row(byte * buf)
return HA_ERR_TABLE_READONLY; 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; return HA_ERR_TABLE_READONLY;
} }

View File

@@ -84,7 +84,7 @@ public:
int open(const char *name, int mode, uint test_if_locked); int open(const char *name, int mode, uint test_if_locked);
int close(void); int close(void);
int write_row(byte * buf); 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 delete_row(const byte * buf);
int index_read(byte * buf, const byte * key, int index_read(byte * buf, const byte * key,
uint key_len, enum ha_rkey_function find_flag); uint key_len, enum ha_rkey_function find_flag);

View File

@@ -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); 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"); DBUG_ENTER("ha_perfschema::update_row");
if (!pfs_initialized) if (!pfs_initialized)

View File

@@ -130,7 +130,7 @@ public:
@param new_data the row new values @param new_data the row new values
@return 0 on success @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. Delete a row.

View File

@@ -284,7 +284,7 @@ int PFS_engine_table::read_row(TABLE *table,
*/ */
int PFS_engine_table::update_row(TABLE *table, int PFS_engine_table::update_row(TABLE *table,
const unsigned char *old_buf, const unsigned char *old_buf,
unsigned char *new_buf, const unsigned char *new_buf,
Field **fields) Field **fields)
{ {
my_bitmap_map *org_bitmap; 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 *, int PFS_engine_table::update_row_values(TABLE *,
const unsigned char *, const unsigned char *,
unsigned char *, const unsigned char *,
Field **) Field **)
{ {
return HA_ERR_WRONG_COMMAND; return HA_ERR_WRONG_COMMAND;

View File

@@ -46,7 +46,7 @@ public:
int read_row(TABLE *table, unsigned char *buf, Field **fields); int read_row(TABLE *table, unsigned char *buf, Field **fields);
int update_row(TABLE *table, const unsigned char *old_buf, 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. Delete a row from this table.
@@ -165,7 +165,7 @@ protected:
@param fields Table fields @param fields Table fields
*/ */
virtual int update_row_values(TABLE *table, const unsigned char *old_buf, 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. Delete a row.

View File

@@ -217,7 +217,7 @@ int table_setup_actors::read_row_values(TABLE *table,
int table_setup_actors::update_row_values(TABLE *table, int table_setup_actors::update_row_values(TABLE *table,
const unsigned char *old_buf, const unsigned char *old_buf,
unsigned char *new_buf, const unsigned char *new_buf,
Field **fields) Field **fields)
{ {
Field *f; Field *f;

View File

@@ -71,7 +71,7 @@ protected:
virtual int update_row_values(TABLE *table, virtual int update_row_values(TABLE *table,
const unsigned char *old_buf, const unsigned char *old_buf,
unsigned char *new_buf, const unsigned char *new_buf,
Field **fields); Field **fields);
virtual int delete_row_values(TABLE *table, virtual int delete_row_values(TABLE *table,

View File

@@ -190,7 +190,7 @@ int table_setup_consumers::read_row_values(TABLE *table,
int table_setup_consumers::update_row_values(TABLE *table, int table_setup_consumers::update_row_values(TABLE *table,
const unsigned char *, const unsigned char *,
unsigned char *, const unsigned char *,
Field **fields) Field **fields)
{ {
Field *f; Field *f;

View File

@@ -60,7 +60,7 @@ protected:
virtual int update_row_values(TABLE *table, virtual int update_row_values(TABLE *table,
const unsigned char *old_buf, const unsigned char *old_buf,
unsigned char *new_buf, const unsigned char *new_buf,
Field **fields); Field **fields);
table_setup_consumers(); table_setup_consumers();

View File

@@ -217,7 +217,7 @@ int table_setup_instruments::read_row_values(TABLE *table,
int table_setup_instruments::update_row_values(TABLE *table, int table_setup_instruments::update_row_values(TABLE *table,
const unsigned char *, const unsigned char *,
unsigned char *, const unsigned char *,
Field **fields) Field **fields)
{ {
Field *f; Field *f;

View File

@@ -92,7 +92,7 @@ protected:
virtual int update_row_values(TABLE *table, virtual int update_row_values(TABLE *table,
const unsigned char *old_buf, const unsigned char *old_buf,
unsigned char *new_buf, const unsigned char *new_buf,
Field **fields); Field **fields);
table_setup_instruments(); table_setup_instruments();

View File

@@ -265,7 +265,7 @@ int table_setup_objects::read_row_values(TABLE *table,
int table_setup_objects::update_row_values(TABLE *table, int table_setup_objects::update_row_values(TABLE *table,
const unsigned char *, const unsigned char *,
unsigned char *, const unsigned char *,
Field **fields) Field **fields)
{ {
int result; int result;

View File

@@ -74,7 +74,7 @@ protected:
virtual int update_row_values(TABLE *table, virtual int update_row_values(TABLE *table,
const unsigned char *old_buf, const unsigned char *old_buf,
unsigned char *new_buf, const unsigned char *new_buf,
Field **fields); Field **fields);
virtual int delete_row_values(TABLE *table, virtual int delete_row_values(TABLE *table,

View File

@@ -145,7 +145,7 @@ int table_setup_timers::read_row_values(TABLE *table,
int table_setup_timers::update_row_values(TABLE *table, int table_setup_timers::update_row_values(TABLE *table,
const unsigned char *, const unsigned char *,
unsigned char *, const unsigned char *,
Field **fields) Field **fields)
{ {
Field *f; Field *f;

View File

@@ -58,7 +58,7 @@ protected:
virtual int update_row_values(TABLE *table, virtual int update_row_values(TABLE *table,
const unsigned char *old_buf, const unsigned char *old_buf,
unsigned char *new_buf, const unsigned char *new_buf,
Field **fields); Field **fields);
table_setup_timers(); table_setup_timers();

View File

@@ -292,7 +292,7 @@ int table_threads::read_row_values(TABLE *table,
int table_threads::update_row_values(TABLE *table, int table_threads::update_row_values(TABLE *table,
const unsigned char *old_buf, const unsigned char *old_buf,
unsigned char *new_buf, const unsigned char *new_buf,
Field **fields) Field **fields)
{ {
Field *f; Field *f;

View File

@@ -87,7 +87,7 @@ protected:
virtual int update_row_values(TABLE *table, virtual int update_row_values(TABLE *table,
const unsigned char *old_buf, const unsigned char *old_buf,
unsigned char *new_buf, const unsigned char *new_buf,
Field **fields); Field **fields);
protected: protected:

View File

@@ -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_ENTER_FUNC();
DBUG_ASSERT(old_data != nullptr); DBUG_ASSERT(old_data != nullptr);

View File

@@ -887,7 +887,7 @@ public:
int write_row(uchar *const buf) override int write_row(uchar *const buf) override
MY_ATTRIBUTE((__warn_unused_result__)); 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__)); MY_ATTRIBUTE((__warn_unused_result__));
int delete_row(const uchar *const buf) override int delete_row(const uchar *const buf) override
MY_ATTRIBUTE((__warn_unused_result__)); MY_ATTRIBUTE((__warn_unused_result__));

View File

@@ -751,6 +751,7 @@ public:
interface Rdb_tables_scanner { interface Rdb_tables_scanner {
virtual int add_table(Rdb_tbl_def * tdef) = 0; virtual int add_table(Rdb_tbl_def * tdef) = 0;
virtual ~Rdb_tables_scanner() {}
}; };
/* /*

View File

@@ -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_ENTER_METHOD();
SPH_RET ( HA_ERR_WRONG_COMMAND ); SPH_RET ( HA_ERR_WRONG_COMMAND );

View File

@@ -86,7 +86,7 @@ public:
int close (); int close ();
int write_row ( byte * buf ); 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 delete_row ( const byte * buf );
int extra ( enum ha_extra_function op ); int extra ( enum ha_extra_function op );

View File

@@ -9747,7 +9747,7 @@ void ha_spider::end_bulk_update(
int ha_spider::bulk_update_row( int ha_spider::bulk_update_row(
const uchar *old_data, const uchar *old_data,
uchar *new_data, const uchar *new_data,
uint *dup_key_found uint *dup_key_found
) { ) {
DBUG_ENTER("ha_spider::bulk_update_row"); DBUG_ENTER("ha_spider::bulk_update_row");
@@ -9758,7 +9758,7 @@ int ha_spider::bulk_update_row(
int ha_spider::update_row( int ha_spider::update_row(
const uchar *old_data, const uchar *old_data,
uchar *new_data const uchar *new_data
) { ) {
int error_num; int error_num;
THD *thd = ha_thd(); THD *thd = ha_thd();
@@ -9990,7 +9990,7 @@ int ha_spider::pre_direct_update_rows_init(
KEY_MULTI_RANGE *ranges, KEY_MULTI_RANGE *ranges,
uint range_count, uint range_count,
bool sorted, bool sorted,
uchar *new_data const uchar *new_data
) { ) {
int error_num; int error_num;
DBUG_ENTER("ha_spider::pre_direct_update_rows_init"); DBUG_ENTER("ha_spider::pre_direct_update_rows_init");

View File

@@ -569,12 +569,12 @@ public:
void end_bulk_update(); void end_bulk_update();
int bulk_update_row( int bulk_update_row(
const uchar *old_data, const uchar *old_data,
uchar *new_data, const uchar *new_data,
uint *dup_key_found uint *dup_key_found
); );
int update_row( int update_row(
const uchar *old_data, const uchar *old_data,
uchar *new_data const uchar *new_data
); );
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
int direct_update_rows_init( int direct_update_rows_init(
@@ -582,7 +582,7 @@ public:
KEY_MULTI_RANGE *ranges, KEY_MULTI_RANGE *ranges,
uint range_count, uint range_count,
bool sorted, bool sorted,
uchar *new_data const uchar *new_data
); );
#ifdef HA_CAN_BULK_ACCESS #ifdef HA_CAN_BULK_ACCESS
int pre_direct_update_rows_init( int pre_direct_update_rows_init(

View File

@@ -3604,7 +3604,7 @@ cleanup:
return error; 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; int error = 0;
bool has_null; bool has_null;
DBC* tmp_cursor = 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 // 0 on success
// error otherwise // 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(""); TOKUDB_HANDLER_DBUG_ENTER("");
DBT prim_key, old_prim_key, prim_row, old_prim_row; DBT prim_key, old_prim_key, prim_row, old_prim_row;
int UNINIT_VAR(error); int UNINIT_VAR(error);

View File

@@ -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); 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); 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_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); 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); 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); 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 optimize(THD * thd, HA_CHECK_OPT * check_opt);
int analyze(THD * thd, HA_CHECK_OPT * check_opt); int analyze(THD * thd, HA_CHECK_OPT * check_opt);
int write_row(uchar * buf); 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 delete_row(const uchar * buf);
#if MYSQL_VERSION_ID >= 100000 #if MYSQL_VERSION_ID >= 100000
void start_bulk_insert(ha_rows rows, uint flags); void start_bulk_insert(ha_rows rows, uint flags);

View File

@@ -9389,7 +9389,7 @@ int
ha_innobase::update_row( ha_innobase::update_row(
/*====================*/ /*====================*/
const uchar* old_row, /*!< in: old row in MySQL format */ 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; upd_t* uvect;
dberr_t error; dberr_t error;

View File

@@ -148,7 +148,7 @@ class ha_innobase: public handler
my_bool is_fake_change_enabled(THD *thd); my_bool is_fake_change_enabled(THD *thd);
int write_row(uchar * buf); 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 delete_row(const uchar * buf);
bool was_semi_consistent_read(); bool was_semi_consistent_read();
void try_semi_consistent_read(bool yes); void try_semi_consistent_read(bool yes);