Skip to content

Commit

Permalink
Merge branch '10.0' into 10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sanja-byelkin committed Aug 21, 2018
2 parents 75dfd4a + bcc677b commit b4210f3
Show file tree
Hide file tree
Showing 19 changed files with 169 additions and 27 deletions.
20 changes: 20 additions & 0 deletions mysql-test/r/func_isnull.result
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,25 @@ Note 1003 select `test`.`t2`.`d1` AS `d1`,`test`.`t1`.`d1` AS `d1` from `test`.`
DROP VIEW v1;
DROP TABLE t1,t2;
#
# MDEV-15475: Assertion `!table || (!table->read_set ||
# bitmap_is_set(table->read_set, field_index))'
# failed on EXPLAIN EXTENDED with constant table and view
#
CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=MyISAM;
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1);
EXPLAIN EXTENDED SELECT ISNULL(pk) FROM v1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1003 select isnull(/*always not null*/ 1) AS `ISNULL(pk)` from dual
EXPLAIN EXTENDED SELECT IFNULL(pk,0) FROM v1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1003 select ifnull(1,0) AS `IFNULL(pk,0)` from dual
DROP VIEW v1;
DROP TABLE t1;
#
# End of 5.5 tests
#
5 changes: 5 additions & 0 deletions mysql-test/r/func_time.result
Original file line number Diff line number Diff line change
Expand Up @@ -2796,6 +2796,11 @@ SEC_TO_TIME(MAKEDATE(0,RAND(~0)))
838:59:59
Warnings:
Warning 1292 Truncated incorrect time value: '20000101'
SELECT PERIOD_DIFF(2018, AES_ENCRYPT('Rae Bareli', 'Rae Bareli'));
PERIOD_DIFF(2018, AES_ENCRYPT('Rae Bareli', 'Rae Bareli'))
24257
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '-3S\xFA\xDE?\x00\x00\xCA\xB3\xEEE\xA4\xD1\xC1\xA8'
#
# End of 5.5 tests
#
Expand Down
19 changes: 19 additions & 0 deletions mysql-test/r/subselect_extra_no_semijoin.result
Original file line number Diff line number Diff line change
Expand Up @@ -482,3 +482,22 @@ DROP TABLE t1,t2;
set optimizer_switch= @tmp_subselect_extra_derived;
set optimizer_switch= @subselect_extra_no_sj_tmp;
set @optimizer_switch_for_subselect_extra_test=null;
#
# MDEV-6439: Server crashes in Explain_union::print_explain with explain in slow log, tis620 charset
#
SET NAMES tis620;
set @tmp= @@global.slow_query_log;
SET GLOBAL slow_query_log = 1;
SET long_query_time = 0.000001;
SET log_slow_verbosity = 'explain';
CREATE TABLE t1 (a VARCHAR(3)) ENGINE=MyISAM;
SELECT * FROM t1 WHERE a >= ANY ( SELECT 'foo');
a
SELECT * FROM t1 WHERE a >= ANY ( SELECT 'foo' UNION SELECT 'bar' );
ERROR HY000: Illegal mix of collations (tis620_thai_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation '<='
create table t2 (b int);
insert into t2 values (1),(2),(3);
SELECT * FROM t1 WHERE a >= ANY ( SELECT 'foo' FROM t2);
ERROR HY000: Illegal mix of collations (tis620_thai_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation '<='
drop table t1,t2;
SET GLOBAL slow_query_log=@tmp;
6 changes: 3 additions & 3 deletions mysql-test/r/subselect_mat.result
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01','2 - 01' having (((<cache>(`test`.`t1`.`a1`) = '1 - 01') or isnull('1 - 01')) and ((<cache>(`test`.`t1`.`a2`) = '2 - 01') or isnull('2 - 01')) and <is_not_null_test>('1 - 01') and <is_not_null_test>('2 - 01')))))
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01','2 - 01' having (((<cache>(`test`.`t1`.`a1`) = '1 - 01') or isnull(/*always not null*/ 1)) and ((<cache>(`test`.`t1`.`a2`) = '2 - 01') or isnull(/*always not null*/ 1)) and <is_not_null_test>('1 - 01') and <is_not_null_test>('2 - 01')))))
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01');
a1 a2
1 - 01 2 - 01
Expand All @@ -509,7 +509,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01','2 - 01' having (((<cache>(`test`.`t1`.`a1`) = '1 - 01') or isnull('1 - 01')) and ((<cache>(`test`.`t1`.`a2`) = '2 - 01') or isnull('2 - 01')) and <is_not_null_test>('1 - 01') and <is_not_null_test>('2 - 01')))))
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01','2 - 01' having (((<cache>(`test`.`t1`.`a1`) = '1 - 01') or isnull(/*always not null*/ 1)) and ((<cache>(`test`.`t1`.`a2`) = '2 - 01') or isnull(/*always not null*/ 1)) and <is_not_null_test>('1 - 01') and <is_not_null_test>('2 - 01')))))
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01' from dual);
a1 a2
1 - 01 2 - 01
Expand Down Expand Up @@ -1925,7 +1925,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where ((`test`.`t1`.`b` = 7) and (`test`.`t1`.`a` = `<subquery2>`.`MAX(c)`) and (<cache>(isnull(`<subquery2>`.`MAX(c)`)) or (`<subquery2>`.`MAX(c)` = 7)))
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where ((`test`.`t1`.`b` = 7) and (`test`.`t1`.`a` = `<subquery2>`.`MAX(c)`) and (<cache>(isnull(/*always not null*/ 1)) or (`<subquery2>`.`MAX(c)` = 7)))
SELECT * FROM t1
WHERE a IN (SELECT MAX(c) FROM t2) AND b=7 AND (a IS NULL OR a=b);
a b
Expand Down
6 changes: 3 additions & 3 deletions mysql-test/r/subselect_sj_mat.result
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01','2 - 01' having (((<cache>(`test`.`t1`.`a1`) = '1 - 01') or isnull('1 - 01')) and ((<cache>(`test`.`t1`.`a2`) = '2 - 01') or isnull('2 - 01')) and <is_not_null_test>('1 - 01') and <is_not_null_test>('2 - 01')))))
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01','2 - 01' having (((<cache>(`test`.`t1`.`a1`) = '1 - 01') or isnull(/*always not null*/ 1)) and ((<cache>(`test`.`t1`.`a2`) = '2 - 01') or isnull(/*always not null*/ 1)) and <is_not_null_test>('1 - 01') and <is_not_null_test>('2 - 01')))))
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01');
a1 a2
1 - 01 2 - 01
Expand All @@ -530,7 +530,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01','2 - 01' having (((<cache>(`test`.`t1`.`a1`) = '1 - 01') or isnull('1 - 01')) and ((<cache>(`test`.`t1`.`a2`) = '2 - 01') or isnull('2 - 01')) and <is_not_null_test>('1 - 01') and <is_not_null_test>('2 - 01')))))
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01','2 - 01' having (((<cache>(`test`.`t1`.`a1`) = '1 - 01') or isnull(/*always not null*/ 1)) and ((<cache>(`test`.`t1`.`a2`) = '2 - 01') or isnull(/*always not null*/ 1)) and <is_not_null_test>('1 - 01') and <is_not_null_test>('2 - 01')))))
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01' from dual);
a1 a2
1 - 01 2 - 01
Expand Down Expand Up @@ -1963,7 +1963,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where ((`test`.`t1`.`b` = 7) and (`test`.`t1`.`a` = `<subquery2>`.`MAX(c)`) and (<cache>(isnull(`<subquery2>`.`MAX(c)`)) or (`<subquery2>`.`MAX(c)` = 7)))
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where ((`test`.`t1`.`b` = 7) and (`test`.`t1`.`a` = `<subquery2>`.`MAX(c)`) and (<cache>(isnull(/*always not null*/ 1)) or (`<subquery2>`.`MAX(c)` = 7)))
SELECT * FROM t1
WHERE a IN (SELECT MAX(c) FROM t2) AND b=7 AND (a IS NULL OR a=b);
a b
Expand Down
14 changes: 14 additions & 0 deletions mysql-test/suite/rpl/r/rpl_row_spatial.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
include/master-slave.inc
[connection master]
CREATE TABLE t1 (g POINT NOT NULL, SPATIAL INDEX(g));
INSERT INTO t1 VALUES (ST_GEOMFROMTEXT('Point(1 1)'));
INSERT INTO t1 VALUES (ST_GEOMFROMTEXT('Point(2 1)'));
INSERT INTO t1 VALUES (ST_GEOMFROMTEXT('Point(1 2)'));
INSERT INTO t1 VALUES (ST_GEOMFROMTEXT('Point(2 2)'));
DELETE FROM t1 where MBREqual(g, ST_GEOMFROMTEXT('Point(1 2)'));
select count(*) from t1;
count(*)
3
DELETE FROM t1;
drop table t1;
include/rpl_end.inc
17 changes: 17 additions & 0 deletions mysql-test/suite/rpl/t/rpl_row_spatial.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--source include/have_binlog_format_row.inc
--source include/master-slave.inc

CREATE TABLE t1 (g POINT NOT NULL, SPATIAL INDEX(g));
INSERT INTO t1 VALUES (ST_GEOMFROMTEXT('Point(1 1)'));
INSERT INTO t1 VALUES (ST_GEOMFROMTEXT('Point(2 1)'));
INSERT INTO t1 VALUES (ST_GEOMFROMTEXT('Point(1 2)'));
INSERT INTO t1 VALUES (ST_GEOMFROMTEXT('Point(2 2)'));
DELETE FROM t1 where MBREqual(g, ST_GEOMFROMTEXT('Point(1 2)'));

--sync_slave_with_master
select count(*) from t1;

--connection master
DELETE FROM t1;
drop table t1;
--source include/rpl_end.inc
16 changes: 16 additions & 0 deletions mysql-test/t/func_isnull.test
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,22 @@ SELECT * FROM t2 LEFT JOIN v1 ON t2.d1=v1.d1 WHERE v1.d1 IS NULL;
DROP VIEW v1;
DROP TABLE t1,t2;


--echo #
--echo # MDEV-15475: Assertion `!table || (!table->read_set ||
--echo # bitmap_is_set(table->read_set, field_index))'
--echo # failed on EXPLAIN EXTENDED with constant table and view
--echo #

CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=MyISAM;
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1);
EXPLAIN EXTENDED SELECT ISNULL(pk) FROM v1;
EXPLAIN EXTENDED SELECT IFNULL(pk,0) FROM v1;
# Cleanup
DROP VIEW v1;
DROP TABLE t1;

--echo #
--echo # End of 5.5 tests
--echo #
4 changes: 4 additions & 0 deletions mysql-test/t/func_time.test
Original file line number Diff line number Diff line change
Expand Up @@ -1701,6 +1701,10 @@ DO TO_DAYS(SEC_TO_TIME(TIME(CEILING(UUID()))));
DO TO_DAYS(SEC_TO_TIME(MAKEDATE('',RAND(~('')))));
SELECT SEC_TO_TIME(MAKEDATE(0,RAND(~0)));

#
# MDEV-16810 AddressSanitizer: stack-buffer-overflow in int10_to_str
#
SELECT PERIOD_DIFF(2018, AES_ENCRYPT('Rae Bareli', 'Rae Bareli'));

--echo #
--echo # End of 5.5 tests
Expand Down
31 changes: 30 additions & 1 deletion mysql-test/t/subselect_extra_no_semijoin.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,33 @@ set @optimizer_switch_for_subselect_extra_test='semijoin=off,firstmatch=off,loo

set optimizer_switch= @subselect_extra_no_sj_tmp;

set @optimizer_switch_for_subselect_extra_test=null;
set @optimizer_switch_for_subselect_extra_test=null;

--echo #
--echo # MDEV-6439: Server crashes in Explain_union::print_explain with explain in slow log, tis620 charset
--echo #

## Using a separate client connection is easier than restoring state
connect(con1,localhost,root,,);

SET NAMES tis620;
set @tmp= @@global.slow_query_log;
SET GLOBAL slow_query_log = 1;
SET long_query_time = 0.000001;
SET log_slow_verbosity = 'explain';

CREATE TABLE t1 (a VARCHAR(3)) ENGINE=MyISAM;
SELECT * FROM t1 WHERE a >= ANY ( SELECT 'foo');
--error ER_CANT_AGGREGATE_2COLLATIONS
SELECT * FROM t1 WHERE a >= ANY ( SELECT 'foo' UNION SELECT 'bar' );

create table t2 (b int);
insert into t2 values (1),(2),(3);

--error ER_CANT_AGGREGATE_2COLLATIONS
SELECT * FROM t1 WHERE a >= ANY ( SELECT 'foo' FROM t2);

drop table t1,t2;
SET GLOBAL slow_query_log=@tmp;
disconnect con1;
connection default;
2 changes: 1 addition & 1 deletion sql/item.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6813,7 +6813,7 @@ Item *Item_field::update_value_transformer(THD *thd, uchar *select_arg)
void Item_field::print(String *str, enum_query_type query_type)
{
if (field && field->table->const_table &&
!(query_type & QT_NO_DATA_EXPANSION))
!(query_type & (QT_NO_DATA_EXPANSION | QT_VIEW_INTERNAL)))
{
print_value(str);
return;
Expand Down
13 changes: 13 additions & 0 deletions sql/item_cmpfunc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5120,6 +5120,19 @@ bool Item_func_null_predicate::count_sargable_conds(uchar *arg)
}


void Item_func_isnull::print(String *str, enum_query_type query_type)
{
str->append(func_name());
str->append('(');
if (const_item() && !args[0]->maybe_null &&
!(query_type & (QT_NO_DATA_EXPANSION | QT_VIEW_INTERNAL)))
str->append("/*always not null*/ 1");
else
args[0]->print(str, query_type);
str->append(')');
}


longlong Item_func_isnull::val_int()
{
DBUG_ASSERT(fixed == 1);
Expand Down
1 change: 1 addition & 0 deletions sql/item_cmpfunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1720,6 +1720,7 @@ class Item_func_isnull :public Item_func_null_predicate
}
COND *remove_eq_conds(THD *thd, Item::cond_result *cond_value,
bool top_level);
virtual void print(String *str, enum_query_type query_type);
table_map not_null_tables() const { return 0; }
Item *neg_transformer(THD *thd);
};
Expand Down
3 changes: 2 additions & 1 deletion sql/key.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ void key_copy(uchar *to_key, uchar *from_record, KEY *key_info,
{
key_length-= HA_KEY_BLOB_LENGTH;
length= min<uint>(key_length, key_part->length);
uint bytes= key_part->field->get_key_image(to_key, length, Field::itRAW);
uint bytes= key_part->field->get_key_image(to_key, length,
key_info->flags & HA_SPATIAL ? Field::itMBR : Field::itRAW);
if (with_zerofill && bytes < length)
bzero((char*) to_key + bytes, length - bytes);
to_key+= HA_KEY_BLOB_LENGTH;
Expand Down
22 changes: 11 additions & 11 deletions sql/mysqld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1413,9 +1413,9 @@ static NTService Service; ///< Service object for WinNT
#endif /* __WIN__ */

#ifdef _WIN32
#include <sddl.h> /* ConvertStringSecurityDescriptorToSecurityDescriptor */
static char pipe_name[512];
static SECURITY_ATTRIBUTES saPipeSecurity;
static SECURITY_DESCRIPTOR sdPipeDescriptor;
static HANDLE hPipe = INVALID_HANDLE_VALUE;
#endif

Expand Down Expand Up @@ -2612,21 +2612,20 @@ static void network_init(void)

strxnmov(pipe_name, sizeof(pipe_name)-1, "\\\\.\\pipe\\",
mysqld_unix_port, NullS);
bzero((char*) &saPipeSecurity, sizeof(saPipeSecurity));
bzero((char*) &sdPipeDescriptor, sizeof(sdPipeDescriptor));
if (!InitializeSecurityDescriptor(&sdPipeDescriptor,
SECURITY_DESCRIPTOR_REVISION))
/*
Create a security descriptor for pipe.
- Use low integrity level, so that it is possible to connect
from any process.
- Give Everyone read/write access to pipe.
*/
if (!ConvertStringSecurityDescriptorToSecurityDescriptor(
"S:(ML;; NW;;; LW) D:(A;; FRFW;;; WD)",
SDDL_REVISION_1, &saPipeSecurity.lpSecurityDescriptor, NULL))
{
sql_perror("Can't start server : Initialize security descriptor");
unireg_abort(1);
}
if (!SetSecurityDescriptorDacl(&sdPipeDescriptor, TRUE, NULL, FALSE))
{
sql_perror("Can't start server : Set security descriptor");
unireg_abort(1);
}
saPipeSecurity.nLength = sizeof(SECURITY_ATTRIBUTES);
saPipeSecurity.lpSecurityDescriptor = &sdPipeDescriptor;
saPipeSecurity.bInheritHandle = FALSE;
if ((hPipe= CreateNamedPipe(pipe_name,
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED | FILE_FLAG_FIRST_PIPE_INSTANCE,
Expand Down Expand Up @@ -6826,6 +6825,7 @@ pthread_handler_t handle_connections_namedpipes(void *arg)
create_new_thread(thd);
set_current_thd(0);
}
LocalFree(saPipeSecurity.lpSecurityDescriptor);
CloseHandle(connectOverlapped.hEvent);
DBUG_LEAVE;
decrement_handler_count();
Expand Down
8 changes: 4 additions & 4 deletions sql/protocol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ uchar *net_store_data(uchar *to, const uchar *from, size_t length)

uchar *net_store_data(uchar *to,int32 from)
{
char buff[20];
char buff[22];
uint length=(uint) (int10_to_str(from,buff,10)-buff);
to=net_store_length_fast(to,length);
memcpy(to,buff,length);
Expand Down Expand Up @@ -1071,7 +1071,7 @@ bool Protocol_text::store_tiny(longlong from)
DBUG_ASSERT(field_types == 0 || field_types[field_pos] == MYSQL_TYPE_TINY);
field_pos++;
#endif
char buff[20];
char buff[22];
return net_store_data((uchar*) buff,
(size_t) (int10_to_str((int) from, buff, -10) - buff));
}
Expand All @@ -1085,7 +1085,7 @@ bool Protocol_text::store_short(longlong from)
field_types[field_pos] == MYSQL_TYPE_SHORT);
field_pos++;
#endif
char buff[20];
char buff[22];
return net_store_data((uchar*) buff,
(size_t) (int10_to_str((int) from, buff, -10) -
buff));
Expand All @@ -1100,7 +1100,7 @@ bool Protocol_text::store_long(longlong from)
field_types[field_pos] == MYSQL_TYPE_LONG);
field_pos++;
#endif
char buff[20];
char buff[22];
return net_store_data((uchar*) buff,
(size_t) (int10_to_str((long int)from, buff,
(from <0)?-10:10)-buff));
Expand Down
5 changes: 4 additions & 1 deletion sql/sql_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,13 @@ class base_list :public Sql_alloc
*/
inline void swap(base_list &rhs)
{
list_node **rhs_last=rhs.last;
swap_variables(list_node *, first, rhs.first);
swap_variables(list_node **, last, rhs.last);
swap_variables(uint, elements, rhs.elements);
rhs.last= last == &first ? &rhs.first : last;
last = rhs_last == &rhs.first ? &first : rhs_last;
}

inline list_node* last_node() { return *last; }
inline list_node* first_node() { return first;}
inline void *head() { return first->info; }
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_show.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2389,7 +2389,7 @@ static int show_create_view(THD *thd, TABLE_LIST *table, String *buff)
We can't just use table->query, because our SQL_MODE may trigger
a different syntax, like when ANSI_QUOTES is defined.
*/
table->view->unit.print(buff, enum_query_type(QT_ORDINARY |
table->view->unit.print(buff, enum_query_type(QT_VIEW_INTERNAL |
QT_ITEM_ORIGINAL_FUNC_NULLIF));

if (table->with_check != VIEW_CHECK_NONE)
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_time.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ bool get_date_from_daynr(long daynr,uint *ret_year,uint *ret_month,
ulong convert_period_to_month(ulong period)
{
ulong a,b;
if (period == 0)
if (period == 0 || period > 999912)
return 0L;
if ((a=period/100) < YY_PART_YEAR)
a+=2000;
Expand Down

0 comments on commit b4210f3

Please sign in to comment.