mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into mysql.com:/usr/local/home/marty/MySQL/test/mysql-5.0-ndb sql/filesort.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/sql_select.cc: Auto merged
This commit is contained in:
@@ -222,6 +222,7 @@ serg@sergbook.mysql.com
|
|||||||
sergefp@mysql.com
|
sergefp@mysql.com
|
||||||
sinisa@rhols221.adsl.netsonic.fi
|
sinisa@rhols221.adsl.netsonic.fi
|
||||||
stewart@mysql.com
|
stewart@mysql.com
|
||||||
|
svoj@mysql.com
|
||||||
tfr@beta.frontier86.ee
|
tfr@beta.frontier86.ee
|
||||||
tfr@indrek.tfr.cafe.ee
|
tfr@indrek.tfr.cafe.ee
|
||||||
tfr@sarvik.tfr.cafe.ee
|
tfr@sarvik.tfr.cafe.ee
|
||||||
|
@@ -253,6 +253,7 @@ VAR var_reg[10];
|
|||||||
/*Perl/shell-like variable registers */
|
/*Perl/shell-like variable registers */
|
||||||
HASH var_hash;
|
HASH var_hash;
|
||||||
my_bool disable_query_log=0, disable_result_log=0, disable_warnings=0;
|
my_bool disable_query_log=0, disable_result_log=0, disable_warnings=0;
|
||||||
|
my_bool disable_ps_warnings= 0;
|
||||||
my_bool disable_info= 1; /* By default off */
|
my_bool disable_info= 1; /* By default off */
|
||||||
my_bool abort_on_error= 1;
|
my_bool abort_on_error= 1;
|
||||||
|
|
||||||
@@ -283,6 +284,7 @@ Q_ENABLE_RESULT_LOG, Q_DISABLE_RESULT_LOG,
|
|||||||
Q_SERVER_START, Q_SERVER_STOP,Q_REQUIRE_MANAGER,
|
Q_SERVER_START, Q_SERVER_STOP,Q_REQUIRE_MANAGER,
|
||||||
Q_WAIT_FOR_SLAVE_TO_STOP,
|
Q_WAIT_FOR_SLAVE_TO_STOP,
|
||||||
Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS,
|
Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS,
|
||||||
|
Q_ENABLE_PS_WARNINGS, Q_DISABLE_PS_WARNINGS,
|
||||||
Q_ENABLE_INFO, Q_DISABLE_INFO,
|
Q_ENABLE_INFO, Q_DISABLE_INFO,
|
||||||
Q_ENABLE_METADATA, Q_DISABLE_METADATA,
|
Q_ENABLE_METADATA, Q_DISABLE_METADATA,
|
||||||
Q_EXEC, Q_DELIMITER,
|
Q_EXEC, Q_DELIMITER,
|
||||||
@@ -360,6 +362,8 @@ const char *command_names[]=
|
|||||||
"wait_for_slave_to_stop",
|
"wait_for_slave_to_stop",
|
||||||
"enable_warnings",
|
"enable_warnings",
|
||||||
"disable_warnings",
|
"disable_warnings",
|
||||||
|
"enable_ps_warnings",
|
||||||
|
"disable_ps_warnings",
|
||||||
"enable_info",
|
"enable_info",
|
||||||
"disable_info",
|
"disable_info",
|
||||||
"enable_metadata",
|
"enable_metadata",
|
||||||
@@ -3021,6 +3025,7 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags)
|
|||||||
|
|
||||||
/* We may have got warnings already, collect them if any */
|
/* We may have got warnings already, collect them if any */
|
||||||
/* FIXME we only want this if the statement succeeds I think */
|
/* FIXME we only want this if the statement succeeds I think */
|
||||||
|
if (!disable_ps_warnings)
|
||||||
run_query_stmt_handle_warnings(mysql, ds);
|
run_query_stmt_handle_warnings(mysql, ds);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3711,6 +3716,8 @@ int main(int argc, char **argv)
|
|||||||
case Q_DISABLE_RESULT_LOG: disable_result_log=1; break;
|
case Q_DISABLE_RESULT_LOG: disable_result_log=1; break;
|
||||||
case Q_ENABLE_WARNINGS: disable_warnings=0; break;
|
case Q_ENABLE_WARNINGS: disable_warnings=0; break;
|
||||||
case Q_DISABLE_WARNINGS: disable_warnings=1; break;
|
case Q_DISABLE_WARNINGS: disable_warnings=1; break;
|
||||||
|
case Q_ENABLE_PS_WARNINGS: disable_ps_warnings=0; break;
|
||||||
|
case Q_DISABLE_PS_WARNINGS: disable_ps_warnings=1; break;
|
||||||
case Q_ENABLE_INFO: disable_info=0; break;
|
case Q_ENABLE_INFO: disable_info=0; break;
|
||||||
case Q_DISABLE_INFO: disable_info=1; break;
|
case Q_DISABLE_INFO: disable_info=1; break;
|
||||||
case Q_ENABLE_METADATA: display_metadata=1; break;
|
case Q_ENABLE_METADATA: display_metadata=1; break;
|
||||||
|
@@ -71,9 +71,11 @@ void Querycache_stream::store_int(uint i)
|
|||||||
cur_data+= 4;
|
cur_data+= 4;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memcpy(cur_data, &i, rest_len);
|
char buf[4];
|
||||||
|
int4store(buf, i);
|
||||||
|
memcpy(cur_data, buf, rest_len);
|
||||||
use_next_block();
|
use_next_block();
|
||||||
memcpy(cur_data, ((byte*)&i)+rest_len, 4-rest_len);
|
memcpy(cur_data, buf+rest_len, 4-rest_len);
|
||||||
cur_data+= 4-rest_len;
|
cur_data+= 4-rest_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,10 +188,12 @@ uint Querycache_stream::load_int()
|
|||||||
cur_data+= 4;
|
cur_data+= 4;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
memcpy(&result, cur_data, rest_len);
|
char buf[4];
|
||||||
|
memcpy(buf, cur_data, rest_len);
|
||||||
use_next_block();
|
use_next_block();
|
||||||
memcpy(((byte*)&result)+rest_len, cur_data, 4-rest_len);
|
memcpy(buf+rest_len, cur_data, 4-rest_len);
|
||||||
cur_data+= 4-rest_len;
|
cur_data+= 4-rest_len;
|
||||||
|
result= uint4korr(buf);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,10 +274,10 @@ int Querycache_stream::load_column(MEM_ROOT *alloc, char** column)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
len--;
|
len--;
|
||||||
if (!(*column= (char *)alloc_root(alloc, len + 4 + 1)))
|
if (!(*column= (char *)alloc_root(alloc, len + sizeof(uint) + 1)))
|
||||||
return 1;
|
return 1;
|
||||||
int4store(*column, len);
|
*((uint*)*column)= len;
|
||||||
(*column)+= 4;
|
(*column)+= sizeof(uint);
|
||||||
load_str_only(*column, len);
|
load_str_only(*column, len);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@@ -436,32 +436,24 @@ static int _ftb_strstr(const byte *s0, const byte *e0,
|
|||||||
const byte *s1, const byte *e1,
|
const byte *s1, const byte *e1,
|
||||||
CHARSET_INFO *cs)
|
CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
const byte *p0, *p1;
|
const byte *p0= s0;
|
||||||
my_bool s_after, e_before;
|
my_bool s_after= true_word_char(cs, s1[0]);
|
||||||
|
my_bool e_before= true_word_char(cs, e1[-1]);
|
||||||
s_after=true_word_char(cs, s1[0]);
|
uint p0_len;
|
||||||
e_before=true_word_char(cs, e1[-1]);
|
my_match_t m[2];
|
||||||
p0=s0;
|
|
||||||
|
|
||||||
while (p0 < e0)
|
while (p0 < e0)
|
||||||
{
|
{
|
||||||
while (p0 < e0 && cs->to_upper[(uint) (uchar) *p0++] !=
|
if (cs->coll->instr(cs, p0, e0 - p0, s1, e1 - s1, m, 2) != 2)
|
||||||
cs->to_upper[(uint) (uchar) *s1])
|
return(0);
|
||||||
/* no-op */;
|
if ((!s_after || p0 + m[1].beg == s0 || !true_word_char(cs, p0[m[1].beg-1])) &&
|
||||||
if (p0 >= e0)
|
(!e_before || p0 + m[1].end == e0 || !true_word_char(cs, p0[m[1].end])))
|
||||||
return 0;
|
return(1);
|
||||||
|
p0+= m[1].beg;
|
||||||
if (s_after && p0-1 > s0 && true_word_char(cs, p0[-2]))
|
p0+= (p0_len= my_mbcharlen(cs, *(uchar *)p0)) ? p0_len : 1;
|
||||||
continue;
|
|
||||||
|
|
||||||
p1=s1+1;
|
|
||||||
while (p0 < e0 && p1 < e1 && cs->to_upper[(uint) (uchar) *p0] ==
|
|
||||||
cs->to_upper[(uint) (uchar) *p1])
|
|
||||||
p0++, p1++;
|
|
||||||
if (p1 == e1 && (!e_before || p0 == e0 || !true_word_char(cs, p0[0])))
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -77,7 +77,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
|
|||||||
/* Read the next block of index file into the preload buffer */
|
/* Read the next block of index file into the preload buffer */
|
||||||
if ((my_off_t) length > (key_file_length-pos))
|
if ((my_off_t) length > (key_file_length-pos))
|
||||||
length= (ulong) (key_file_length-pos);
|
length= (ulong) (key_file_length-pos);
|
||||||
if (my_pread(share->kfile, (byte*) buff, length, pos, MYF(MY_FAE)))
|
if (my_pread(share->kfile, (byte*) buff, length, pos, MYF(MY_FAE|MY_FNABP)))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (ignore_leaves)
|
if (ignore_leaves)
|
||||||
|
@@ -624,3 +624,17 @@ ucs2_bin 00610009
|
|||||||
ucs2_bin 0061
|
ucs2_bin 0061
|
||||||
ucs2_bin 00610020
|
ucs2_bin 00610020
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
SET NAMES latin1;
|
||||||
|
SET collation_connection='ucs2_swedish_ci';
|
||||||
|
CREATE TABLE t1 (Field1 int(10) default '0');
|
||||||
|
INSERT INTO t1 VALUES ('-1');
|
||||||
|
SELECT * FROM t1;
|
||||||
|
Field1
|
||||||
|
-1
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (Field1 int(10) unsigned default '0');
|
||||||
|
INSERT INTO t1 VALUES ('-1');
|
||||||
|
Warnings:
|
||||||
|
Warning 1264 Out of range value adjusted for column 'Field1' at row 1
|
||||||
|
DROP TABLE t1;
|
||||||
|
SET NAMES latin1;
|
||||||
|
@@ -408,3 +408,10 @@ insert t1 values (1, "aaaa"), (2, "bbbb");
|
|||||||
insert t2 values (10, "aaaa"), (2, "cccc");
|
insert t2 values (10, "aaaa"), (2, "cccc");
|
||||||
replace t1 select * from t2;
|
replace t1 select * from t2;
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
CREATE TABLE t1 (t VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci, FULLTEXT (t));
|
||||||
|
SET NAMES latin1;
|
||||||
|
INSERT INTO t1 VALUES('Mit freundlichem Gr<47><72> aus Osnabr<62>ck');
|
||||||
|
SELECT COUNT(*) FROM t1 WHERE MATCH(t) AGAINST ('"osnabr<62>ck"' IN BOOLEAN MODE);
|
||||||
|
COUNT(*)
|
||||||
|
1
|
||||||
|
DROP TABLE t1;
|
||||||
|
@@ -604,3 +604,9 @@ Variable_name Value
|
|||||||
show global status like "Threads_running";
|
show global status like "Threads_running";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Threads_running 1
|
Threads_running 1
|
||||||
|
create table t1(f1 int);
|
||||||
|
create table t2(f2 int);
|
||||||
|
create view v1 as select * from t1, t2;
|
||||||
|
set @got_val= (select count(*) from information_schema.columns);
|
||||||
|
drop view v1;
|
||||||
|
drop table t1, t2;
|
||||||
|
@@ -167,6 +167,8 @@ show status like 'handler_discover%';
|
|||||||
Variable_name Value
|
Variable_name Value
|
||||||
Handler_discover 0
|
Handler_discover 0
|
||||||
drop table t4;
|
drop table t4;
|
||||||
|
Warnings:
|
||||||
|
Error 1296 Got error 709 'No such table existed' from NDB
|
||||||
flush status;
|
flush status;
|
||||||
create table t4(
|
create table t4(
|
||||||
id int not null primary key,
|
id int not null primary key,
|
||||||
|
@@ -74,15 +74,15 @@ Table Op Msg_type Msg_text
|
|||||||
test.t1 preload_keys status OK
|
test.t1 preload_keys status OK
|
||||||
show status like "key_read%";
|
show status like "key_read%";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Key_read_requests 0
|
Key_read_requests 581
|
||||||
Key_reads 0
|
Key_reads 581
|
||||||
select count(*) from t1 where b = 'test1';
|
select count(*) from t1 where b = 'test1';
|
||||||
count(*)
|
count(*)
|
||||||
4181
|
4181
|
||||||
show status like "key_read%";
|
show status like "key_read%";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Key_read_requests 217
|
Key_read_requests 798
|
||||||
Key_reads 45
|
Key_reads 581
|
||||||
flush tables;
|
flush tables;
|
||||||
flush status;
|
flush status;
|
||||||
show status like "key_read%";
|
show status like "key_read%";
|
||||||
@@ -98,15 +98,15 @@ Table Op Msg_type Msg_text
|
|||||||
test.t1 preload_keys status OK
|
test.t1 preload_keys status OK
|
||||||
show status like "key_read%";
|
show status like "key_read%";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Key_read_requests 0
|
Key_read_requests 10
|
||||||
Key_reads 0
|
Key_reads 10
|
||||||
select count(*) from t1 where b = 'test1';
|
select count(*) from t1 where b = 'test1';
|
||||||
count(*)
|
count(*)
|
||||||
4181
|
4181
|
||||||
show status like "key_read%";
|
show status like "key_read%";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Key_read_requests 217
|
Key_read_requests 227
|
||||||
Key_reads 45
|
Key_reads 52
|
||||||
flush tables;
|
flush tables;
|
||||||
flush status;
|
flush status;
|
||||||
show status like "key_read%";
|
show status like "key_read%";
|
||||||
@@ -123,8 +123,8 @@ test.t1 preload_keys status OK
|
|||||||
test.t2 preload_keys status OK
|
test.t2 preload_keys status OK
|
||||||
show status like "key_read%";
|
show status like "key_read%";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Key_read_requests 0
|
Key_read_requests 587
|
||||||
Key_reads 0
|
Key_reads 587
|
||||||
select count(*) from t1 where b = 'test1';
|
select count(*) from t1 where b = 'test1';
|
||||||
count(*)
|
count(*)
|
||||||
4181
|
4181
|
||||||
@@ -133,8 +133,8 @@ count(*)
|
|||||||
2584
|
2584
|
||||||
show status like "key_read%";
|
show status like "key_read%";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Key_read_requests 351
|
Key_read_requests 938
|
||||||
Key_reads 73
|
Key_reads 613
|
||||||
flush tables;
|
flush tables;
|
||||||
flush status;
|
flush status;
|
||||||
show status like "key_read%";
|
show status like "key_read%";
|
||||||
@@ -147,8 +147,8 @@ test.t3 preload_keys error Table 'test.t3' doesn't exist
|
|||||||
test.t2 preload_keys status OK
|
test.t2 preload_keys status OK
|
||||||
show status like "key_read%";
|
show status like "key_read%";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Key_read_requests 0
|
Key_read_requests 355
|
||||||
Key_reads 0
|
Key_reads 355
|
||||||
flush tables;
|
flush tables;
|
||||||
flush status;
|
flush status;
|
||||||
show status like "key_read%";
|
show status like "key_read%";
|
||||||
|
@@ -1173,3 +1173,25 @@ show columns from t4;
|
|||||||
Field Type Null Key Default Extra
|
Field Type Null Key Default Extra
|
||||||
sdate date YES NULL
|
sdate date YES NULL
|
||||||
drop table t1, t2, t3, t4;
|
drop table t1, t2, t3, t4;
|
||||||
|
create table t1 (a int not null, b char (10) not null);
|
||||||
|
insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
|
||||||
|
select * from ((select * from t1 limit 1)) a;
|
||||||
|
a b
|
||||||
|
1 a
|
||||||
|
select * from ((select * from t1 limit 1) union (select * from t1 limit 1)) a;
|
||||||
|
a b
|
||||||
|
1 a
|
||||||
|
select * from ((select * from t1 limit 1) union (select * from t1 limit 1) union (select * from t1 limit 1)) a;
|
||||||
|
a b
|
||||||
|
1 a
|
||||||
|
select * from ((((select * from t1))) union (select * from t1) union (select * from t1)) a;
|
||||||
|
a b
|
||||||
|
1 a
|
||||||
|
2 b
|
||||||
|
3 c
|
||||||
|
select * from ((select * from t1) union (((select * from t1))) union (select * from t1)) a;
|
||||||
|
a b
|
||||||
|
1 a
|
||||||
|
2 b
|
||||||
|
3 c
|
||||||
|
drop table t1;
|
||||||
|
@@ -392,3 +392,24 @@ SET collation_connection='ucs2_general_ci';
|
|||||||
SET NAMES latin1;
|
SET NAMES latin1;
|
||||||
SET collation_connection='ucs2_bin';
|
SET collation_connection='ucs2_bin';
|
||||||
-- source include/ctype_filesort.inc
|
-- source include/ctype_filesort.inc
|
||||||
|
|
||||||
|
SET NAMES latin1;
|
||||||
|
#
|
||||||
|
# Bug#8235
|
||||||
|
#
|
||||||
|
# This bug also helped to find another problem that
|
||||||
|
# INSERT of a UCS2 string containing a negative number
|
||||||
|
# into a unsigned int column didn't produce warnings.
|
||||||
|
# This test covers both problems.
|
||||||
|
#
|
||||||
|
SET collation_connection='ucs2_swedish_ci';
|
||||||
|
CREATE TABLE t1 (Field1 int(10) default '0');
|
||||||
|
# no warnings, negative numbers are allowed
|
||||||
|
INSERT INTO t1 VALUES ('-1');
|
||||||
|
SELECT * FROM t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (Field1 int(10) unsigned default '0');
|
||||||
|
# this should generate a "Data truncated" warning
|
||||||
|
INSERT INTO t1 VALUES ('-1');
|
||||||
|
DROP TABLE t1;
|
||||||
|
SET NAMES latin1;
|
||||||
|
@@ -322,3 +322,11 @@ insert t2 values (10, "aaaa"), (2, "cccc");
|
|||||||
replace t1 select * from t2;
|
replace t1 select * from t2;
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# bug#8351
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (t VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci, FULLTEXT (t));
|
||||||
|
SET NAMES latin1;
|
||||||
|
INSERT INTO t1 VALUES('Mit freundlichem Gr<47><72> aus Osnabr<62>ck');
|
||||||
|
SELECT COUNT(*) FROM t1 WHERE MATCH(t) AGAINST ('"osnabr<62>ck"' IN BOOLEAN MODE);
|
||||||
|
DROP TABLE t1;
|
||||||
|
@@ -352,3 +352,14 @@ show variables where variable_name like "skip_show_databas";
|
|||||||
# Bug #7981:SHOW GLOBAL STATUS crashes server
|
# Bug #7981:SHOW GLOBAL STATUS crashes server
|
||||||
#
|
#
|
||||||
show global status like "Threads_running";
|
show global status like "Threads_running";
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #7915 crash,JOIN VIEW, subquery,
|
||||||
|
# SELECT .. FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
#
|
||||||
|
create table t1(f1 int);
|
||||||
|
create table t2(f2 int);
|
||||||
|
create view v1 as select * from t1, t2;
|
||||||
|
set @got_val= (select count(*) from information_schema.columns);
|
||||||
|
drop view v1;
|
||||||
|
drop table t1, t2;
|
||||||
|
@@ -7,7 +7,9 @@ select (1,2,3) IN ((3,2,3), (1,2,3), (1,3,3));
|
|||||||
select row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3));
|
select row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3));
|
||||||
select row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
|
select row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
|
||||||
select row(10,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
|
select row(10,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
|
||||||
|
--disable_ps_warnings
|
||||||
select row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'));
|
select row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'));
|
||||||
|
--enable_ps_warnings
|
||||||
select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3));
|
select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3));
|
||||||
select row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3));
|
select row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3));
|
||||||
select row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
|
select row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
|
||||||
|
@@ -2811,6 +2811,12 @@ drop function getcount|
|
|||||||
#
|
#
|
||||||
# BUG#5240: Stored procedure crash if function has cursor declaration
|
# BUG#5240: Stored procedure crash if function has cursor declaration
|
||||||
#
|
#
|
||||||
|
# The following test case fails in --ps-protocol mode due to some bugs
|
||||||
|
# in algorithm which calculates list of tables to be locked for queries
|
||||||
|
# using Stored Functions. It is disabled until Dmitri fixes this.
|
||||||
|
#
|
||||||
|
--disable_ps_protocol
|
||||||
|
|
||||||
--disable_warnings
|
--disable_warnings
|
||||||
drop function if exists bug5240|
|
drop function if exists bug5240|
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
@@ -2831,6 +2837,8 @@ insert into t1 values ("answer", 42)|
|
|||||||
select id, bug5240() from t1|
|
select id, bug5240() from t1|
|
||||||
drop function bug5240|
|
drop function bug5240|
|
||||||
|
|
||||||
|
--enable_ps_protocol
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG#5278: Stored procedure packets out of order if SET PASSWORD.
|
# BUG#5278: Stored procedure packets out of order if SET PASSWORD.
|
||||||
#
|
#
|
||||||
|
@@ -717,3 +717,15 @@ union
|
|||||||
order by sdate;
|
order by sdate;
|
||||||
show columns from t4;
|
show columns from t4;
|
||||||
drop table t1, t2, t3, t4;
|
drop table t1, t2, t3, t4;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #2435 UNION with parentheses not supported
|
||||||
|
#
|
||||||
|
create table t1 (a int not null, b char (10) not null);
|
||||||
|
insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
|
||||||
|
select * from ((select * from t1 limit 1)) a;
|
||||||
|
select * from ((select * from t1 limit 1) union (select * from t1 limit 1)) a;
|
||||||
|
select * from ((select * from t1 limit 1) union (select * from t1 limit 1) union (select * from t1 limit 1)) a;
|
||||||
|
select * from ((((select * from t1))) union (select * from t1) union (select * from t1)) a;
|
||||||
|
select * from ((select * from t1) union (((select * from t1))) union (select * from t1)) a;
|
||||||
|
drop table t1;
|
||||||
|
@@ -10,7 +10,7 @@ test_DATA=daily-basic-tests.txt daily-devel-tests.txt 16node-tests.txt
|
|||||||
test_SCRIPTS=atrt-analyze-result.sh atrt-gather-result.sh atrt-setup.sh \
|
test_SCRIPTS=atrt-analyze-result.sh atrt-gather-result.sh atrt-setup.sh \
|
||||||
atrt-clear-result.sh make-config.sh make-index.sh make-html-reports.sh
|
atrt-clear-result.sh make-config.sh make-index.sh make-html-reports.sh
|
||||||
|
|
||||||
atrt_SOURCES = main.cpp
|
atrt_SOURCES = main.cpp run-test.hpp
|
||||||
INCLUDES_LOC = -I$(top_srcdir)/ndb/test/include
|
INCLUDES_LOC = -I$(top_srcdir)/ndb/test/include
|
||||||
LDADD_LOC = $(top_builddir)/ndb/test/src/libNDBT.a \
|
LDADD_LOC = $(top_builddir)/ndb/test/src/libNDBT.a \
|
||||||
$(top_builddir)/ndb/src/libndbclient.la \
|
$(top_builddir)/ndb/src/libndbclient.la \
|
||||||
@@ -21,7 +21,7 @@ LDADD_LOC = $(top_builddir)/ndb/test/src/libNDBT.a \
|
|||||||
wrappersdir=$(prefix)/bin
|
wrappersdir=$(prefix)/bin
|
||||||
wrappers_SCRIPTS=atrt-testBackup atrt-mysql-test-run
|
wrappers_SCRIPTS=atrt-testBackup atrt-mysql-test-run
|
||||||
|
|
||||||
noinst_HEADERS = run-test.hpp $(test_DATA) $(test_SCRIPTS) $(wrappers_SCRIPTS) README.ATRT
|
EXTRA_DIST = $(test_DATA) $(test_SCRIPTS) $(wrappers_SCRIPTS) README.ATRT
|
||||||
|
|
||||||
# Don't update the files from bitkeeper
|
# Don't update the files from bitkeeper
|
||||||
%::SCCS/s.%
|
%::SCCS/s.%
|
||||||
|
@@ -176,9 +176,7 @@ then
|
|||||||
INSERT INTO user (host,user) values ('localhost','');"
|
INSERT INTO user (host,user) values ('localhost','');"
|
||||||
else
|
else
|
||||||
i_u="$i_u
|
i_u="$i_u
|
||||||
INSERT INTO user VALUES ('%','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
|
INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);"
|
||||||
INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
|
|
||||||
INSERT INTO user VALUES ('%','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0);"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@@ -115,6 +115,8 @@
|
|||||||
data - The data is stored in a "row +blobs" format.
|
data - The data is stored in a "row +blobs" format.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* If the archive storage engine has been inited */
|
||||||
|
static bool archive_inited= 0;
|
||||||
/* Variables for archive share methods */
|
/* Variables for archive share methods */
|
||||||
pthread_mutex_t archive_mutex;
|
pthread_mutex_t archive_mutex;
|
||||||
static HASH archive_open_tables;
|
static HASH archive_open_tables;
|
||||||
@@ -158,6 +160,7 @@ static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length,
|
|||||||
|
|
||||||
bool archive_db_init()
|
bool archive_db_init()
|
||||||
{
|
{
|
||||||
|
archive_inited= 1;
|
||||||
VOID(pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST));
|
VOID(pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST));
|
||||||
return (hash_init(&archive_open_tables, system_charset_info, 32, 0, 0,
|
return (hash_init(&archive_open_tables, system_charset_info, 32, 0, 0,
|
||||||
(hash_get_key) archive_get_key, 0, 0));
|
(hash_get_key) archive_get_key, 0, 0));
|
||||||
@@ -176,9 +179,13 @@ bool archive_db_init()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
bool archive_db_end()
|
bool archive_db_end()
|
||||||
|
{
|
||||||
|
if (archive_inited)
|
||||||
{
|
{
|
||||||
hash_free(&archive_open_tables);
|
hash_free(&archive_open_tables);
|
||||||
VOID(pthread_mutex_destroy(&archive_mutex));
|
VOID(pthread_mutex_destroy(&archive_mutex));
|
||||||
|
}
|
||||||
|
archive_inited= 0;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
53
sql/field.cc
53
sql/field.cc
@@ -572,7 +572,6 @@ my_decimal* Field_num::val_decimal(my_decimal *decimal_value)
|
|||||||
{
|
{
|
||||||
DBUG_ASSERT(result_type() == INT_RESULT);
|
DBUG_ASSERT(result_type() == INT_RESULT);
|
||||||
longlong nr= val_int();
|
longlong nr= val_int();
|
||||||
if (!is_null())
|
|
||||||
int2my_decimal(E_DEC_FATAL_ERROR, nr, unsigned_flag, decimal_value);
|
int2my_decimal(E_DEC_FATAL_ERROR, nr, unsigned_flag, decimal_value);
|
||||||
return decimal_value;
|
return decimal_value;
|
||||||
}
|
}
|
||||||
@@ -605,7 +604,7 @@ void Field_num::make_field(Send_field *field)
|
|||||||
d value for storing
|
d value for storing
|
||||||
|
|
||||||
NOTE
|
NOTE
|
||||||
Field_str is the base class for fields like Field_date, and some
|
Field_str is the base class for fields like Field_enum, Field_date and some
|
||||||
similar. Some dates use fraction and also string value should be
|
similar. Some dates use fraction and also string value should be
|
||||||
converted to floating point value according our rules, so we use double
|
converted to floating point value according our rules, so we use double
|
||||||
to store value of decimal in string
|
to store value of decimal in string
|
||||||
@@ -629,7 +628,6 @@ my_decimal *Field_str::val_decimal(my_decimal *decimal_value)
|
|||||||
{
|
{
|
||||||
DBUG_ASSERT(result_type() == INT_RESULT);
|
DBUG_ASSERT(result_type() == INT_RESULT);
|
||||||
longlong nr= val_int();
|
longlong nr= val_int();
|
||||||
if (is_null())
|
|
||||||
int2my_decimal(E_DEC_FATAL_ERROR, nr, 0, decimal_value);
|
int2my_decimal(E_DEC_FATAL_ERROR, nr, 0, decimal_value);
|
||||||
return decimal_value;
|
return decimal_value;
|
||||||
}
|
}
|
||||||
@@ -733,6 +731,7 @@ Field *Field::new_key_field(MEM_ROOT *root, struct st_table *new_table,
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
Field::quote_data()
|
Field::quote_data()
|
||||||
@@ -749,44 +748,35 @@ Field *Field::new_key_field(MEM_ROOT *root, struct st_table *new_table,
|
|||||||
void Upon prepending/appending quotes on each side of variable
|
void Upon prepending/appending quotes on each side of variable
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool Field::quote_data(String *unquoted_string)
|
bool Field::quote_data(String *unquoted_string)
|
||||||
{
|
{
|
||||||
char escaped_string[IO_SIZE];
|
char escaped_string[IO_SIZE];
|
||||||
char *unquoted_string_buffer= (char *)(unquoted_string->ptr());
|
char *unquoted_string_buffer= (char *)(unquoted_string->ptr());
|
||||||
uint need_quotes;
|
uint need_quotes;
|
||||||
|
|
||||||
DBUG_ENTER("Field::quote_data");
|
DBUG_ENTER("Field::quote_data");
|
||||||
|
|
||||||
// this is the same call that mysql_real_escape_string() calls
|
// this is the same call that mysql_real_escape_string() calls
|
||||||
escape_string_for_mysql(&my_charset_bin, (char *)escaped_string,
|
escape_string_for_mysql(&my_charset_bin, (char *)escaped_string,
|
||||||
unquoted_string->ptr(), unquoted_string->length());
|
unquoted_string->ptr(), unquoted_string->length());
|
||||||
|
|
||||||
|
|
||||||
if (is_null())
|
|
||||||
DBUG_RETURN(0);
|
|
||||||
|
|
||||||
need_quotes= needs_quotes();
|
need_quotes= needs_quotes();
|
||||||
|
|
||||||
if (need_quotes == 0)
|
if (need_quotes == 0)
|
||||||
{
|
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// reset string, then re-append with quotes and escaped values
|
// reset string, then re-append with quotes and escaped values
|
||||||
unquoted_string->length(0);
|
unquoted_string->length(0);
|
||||||
if (unquoted_string->append("'"))
|
if (unquoted_string->append('\''))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
if (unquoted_string->append((char *)escaped_string))
|
if (unquoted_string->append((char *)escaped_string))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
if (unquoted_string->append("'"))
|
if (unquoted_string->append('\''))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
|
||||||
//DBUG_PRINT("Field::quote_data",
|
|
||||||
// ("FINAL quote_flag %d unquoted_string %s escaped_string %s",
|
|
||||||
//needs_quotes, unquoted_string->c_ptr_quick(), escaped_string));
|
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Quote a field type if needed
|
Quote a field type if needed
|
||||||
|
|
||||||
@@ -802,6 +792,7 @@ bool Field::quote_data(String *unquoted_string)
|
|||||||
0 if value is of type NOT needing quotes
|
0 if value is of type NOT needing quotes
|
||||||
1 if value is of type needing quotes
|
1 if value is of type needing quotes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool Field::needs_quotes(void)
|
bool Field::needs_quotes(void)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("Field::type_quote");
|
DBUG_ENTER("Field::type_quote");
|
||||||
@@ -840,9 +831,9 @@ bool Field::needs_quotes(void)
|
|||||||
default: DBUG_RETURN(0);
|
default: DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
Field_null, a field that always return NULL
|
Field_null, a field that always return NULL
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -2441,6 +2432,13 @@ void Field_medium::sql_type(String &res) const
|
|||||||
** long int
|
** long int
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
static bool test_if_minus(CHARSET_INFO *cs,
|
||||||
|
const char *s, const char *e)
|
||||||
|
{
|
||||||
|
my_wc_t wc;
|
||||||
|
return cs->cset->mb_wc(cs, &wc, (uchar*) s, (uchar*) e) > 0 && wc == '-';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
|
int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
@@ -2454,7 +2452,7 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
from+= tmp;
|
from+= tmp;
|
||||||
|
|
||||||
end= (char*) from+len;
|
end= (char*) from+len;
|
||||||
tmp= my_strtoll10(from, &end, &error);
|
tmp= cs->cset->my_strtoll10(cs, from, &end, &error);
|
||||||
|
|
||||||
if (error != MY_ERRNO_EDOM)
|
if (error != MY_ERRNO_EDOM)
|
||||||
{
|
{
|
||||||
@@ -2743,7 +2741,7 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
from+= tmp;
|
from+= tmp;
|
||||||
if (unsigned_flag)
|
if (unsigned_flag)
|
||||||
{
|
{
|
||||||
if (!len || *from == '-')
|
if (!len || test_if_minus(cs, from, from + len))
|
||||||
{
|
{
|
||||||
tmp=0; // Set negative to 0
|
tmp=0; // Set negative to 0
|
||||||
error= 1;
|
error= 1;
|
||||||
@@ -4646,8 +4644,6 @@ String *Field_newdate::val_str(String *val_buffer,
|
|||||||
|
|
||||||
bool Field_newdate::get_date(TIME *ltime,uint fuzzydate)
|
bool Field_newdate::get_date(TIME *ltime,uint fuzzydate)
|
||||||
{
|
{
|
||||||
if (is_null())
|
|
||||||
return 1;
|
|
||||||
uint32 tmp=(uint32) uint3korr(ptr);
|
uint32 tmp=(uint32) uint3korr(ptr);
|
||||||
ltime->day= tmp & 31;
|
ltime->day= tmp & 31;
|
||||||
ltime->month= (tmp >> 5) & 15;
|
ltime->month= (tmp >> 5) & 15;
|
||||||
@@ -5058,17 +5054,16 @@ int Field_string::store(longlong nr)
|
|||||||
return Field_string::store(buff,(uint)l,cs);
|
return Field_string::store(buff,(uint)l,cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Field_longstr::store_decimal(const my_decimal *d)
|
int Field_longstr::store_decimal(const my_decimal *d)
|
||||||
{
|
{
|
||||||
uint buf_size= my_decimal_string_length(d);
|
char buff[DECIMAL_MAX_STR_LENGTH+1];
|
||||||
char *buff= (char *)my_alloca(buf_size);
|
String str(buff, sizeof(buff), &my_charset_bin);
|
||||||
String str(buff, buf_size, &my_charset_bin);
|
|
||||||
my_decimal2string(E_DEC_FATAL_ERROR, d, 0, 0, 0, &str);
|
my_decimal2string(E_DEC_FATAL_ERROR, d, 0, 0, 0, &str);
|
||||||
int result= store(str.ptr(), str.length(), str.charset());
|
return store(str.ptr(), str.length(), str.charset());
|
||||||
my_afree(buff);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double Field_string::val_real(void)
|
double Field_string::val_real(void)
|
||||||
{
|
{
|
||||||
int not_used;
|
int not_used;
|
||||||
|
@@ -367,7 +367,9 @@ public:
|
|||||||
my_decimal *val_decimal(my_decimal *);
|
my_decimal *val_decimal(my_decimal *);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* base class for Item_string, Item_valstring, Item_blob */
|
|
||||||
|
/* base class for Field_string, Field_varstring and Field_blob */
|
||||||
|
|
||||||
class Field_longstr :public Field_str
|
class Field_longstr :public Field_str
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -1181,7 +1183,9 @@ public:
|
|||||||
bool has_charset(void) const
|
bool has_charset(void) const
|
||||||
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
|
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
|
||||||
field_cast_enum field_cast_type() { return FIELD_CAST_BLOB; }
|
field_cast_enum field_cast_type() { return FIELD_CAST_BLOB; }
|
||||||
uint32 max_length();};
|
uint32 max_length();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_SPATIAL
|
#ifdef HAVE_SPATIAL
|
||||||
class Field_geom :public Field_blob {
|
class Field_geom :public Field_blob {
|
||||||
|
@@ -616,20 +616,21 @@ static void make_sortkey(register SORTPARAM *param,
|
|||||||
else
|
else
|
||||||
{ // Item
|
{ // Item
|
||||||
Item *item=sort_field->item;
|
Item *item=sort_field->item;
|
||||||
|
maybe_null= item->maybe_null;
|
||||||
switch (sort_field->result_type) {
|
switch (sort_field->result_type) {
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
{
|
{
|
||||||
CHARSET_INFO *cs=item->collation.collation;
|
CHARSET_INFO *cs=item->collation.collation;
|
||||||
char fill_char= ((cs->state & MY_CS_BINSORT) ? (char) 0 : ' ');
|
char fill_char= ((cs->state & MY_CS_BINSORT) ? (char) 0 : ' ');
|
||||||
|
|
||||||
if ((maybe_null=item->maybe_null))
|
if (maybe_null)
|
||||||
*to++=1;
|
*to++=1;
|
||||||
/* All item->str() to use some extra byte for end null.. */
|
/* All item->str() to use some extra byte for end null.. */
|
||||||
String tmp((char*) to,sort_field->length+4,cs);
|
String tmp((char*) to,sort_field->length+4,cs);
|
||||||
String *res=item->val_str(&tmp);
|
String *res=item->val_str(&tmp);
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
if (item->maybe_null)
|
if (maybe_null)
|
||||||
bzero((char*) to-1,sort_field->length+1);
|
bzero((char*) to-1,sort_field->length+1);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -669,11 +670,12 @@ static void make_sortkey(register SORTPARAM *param,
|
|||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
{
|
{
|
||||||
longlong value=item->val_int();
|
longlong value=item->val_int();
|
||||||
if ((maybe_null=item->maybe_null))
|
if (maybe_null)
|
||||||
|
{
|
||||||
*to++=1; /* purecov: inspected */
|
*to++=1; /* purecov: inspected */
|
||||||
if (item->null_value)
|
if (item->null_value)
|
||||||
{
|
{
|
||||||
if (item->maybe_null)
|
if (maybe_null)
|
||||||
bzero((char*) to-1,sort_field->length+1);
|
bzero((char*) to-1,sort_field->length+1);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -683,6 +685,7 @@ static void make_sortkey(register SORTPARAM *param,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#if SIZEOF_LONG_LONG > 4
|
#if SIZEOF_LONG_LONG > 4
|
||||||
to[7]= (uchar) value;
|
to[7]= (uchar) value;
|
||||||
to[6]= (uchar) (value >> 8);
|
to[6]= (uchar) (value >> 8);
|
||||||
@@ -703,15 +706,17 @@ static void make_sortkey(register SORTPARAM *param,
|
|||||||
case DECIMAL_RESULT:
|
case DECIMAL_RESULT:
|
||||||
{
|
{
|
||||||
my_decimal dec_buf, *dec_val= item->val_decimal(&dec_buf);
|
my_decimal dec_buf, *dec_val= item->val_decimal(&dec_buf);
|
||||||
if ((maybe_null=item->null_value))
|
if (maybe_null)
|
||||||
|
{
|
||||||
|
if (item->null_value)
|
||||||
{
|
{
|
||||||
bzero((char*)to, sort_field->length+1);
|
bzero((char*)to, sort_field->length+1);
|
||||||
to++;
|
to++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((maybe_null=item->maybe_null))
|
|
||||||
*to++=1;
|
*to++=1;
|
||||||
my_decimal2binary(E_DEC_FATAL_ERROR, dec_val, (byte*)to,
|
}
|
||||||
|
my_decimal2binary(E_DEC_FATAL_ERROR, dec_val, (char*)to,
|
||||||
item->max_length - (item->decimals ? 1:0),
|
item->max_length - (item->decimals ? 1:0),
|
||||||
item->decimals);
|
item->decimals);
|
||||||
break;
|
break;
|
||||||
@@ -719,14 +724,16 @@ static void make_sortkey(register SORTPARAM *param,
|
|||||||
case REAL_RESULT:
|
case REAL_RESULT:
|
||||||
{
|
{
|
||||||
double value= item->val_real();
|
double value= item->val_real();
|
||||||
if ((maybe_null=item->null_value))
|
if (maybe_null)
|
||||||
|
{
|
||||||
|
if (item->null_value)
|
||||||
{
|
{
|
||||||
bzero((char*) to,sort_field->length+1);
|
bzero((char*) to,sort_field->length+1);
|
||||||
to++;
|
to++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((maybe_null=item->maybe_null))
|
|
||||||
*to++=1;
|
*to++=1;
|
||||||
|
}
|
||||||
change_double_for_sort(value,(byte*) to);
|
change_double_for_sort(value,(byte*) to);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
41
sql/item.cc
41
sql/item.cc
@@ -48,10 +48,10 @@ void item_init(void)
|
|||||||
/*
|
/*
|
||||||
TODO: make this functions class dependent
|
TODO: make this functions class dependent
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool Item::val_bool()
|
bool Item::val_bool()
|
||||||
{
|
{
|
||||||
switch(result_type())
|
switch(result_type()) {
|
||||||
{
|
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
return val_int();
|
return val_int();
|
||||||
case DECIMAL_RESULT:
|
case DECIMAL_RESULT:
|
||||||
@@ -68,6 +68,7 @@ bool Item::val_bool()
|
|||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
default:
|
default:
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
|
return 0; // Wrong (but safe)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -991,8 +992,7 @@ bool Item_field::val_bool_result()
|
|||||||
{
|
{
|
||||||
if ((null_value= result_field->is_null()))
|
if ((null_value= result_field->is_null()))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
switch (result_field->result_type())
|
switch (result_field->result_type()) {
|
||||||
{
|
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
return result_field->val_int();
|
return result_field->val_int();
|
||||||
case DECIMAL_RESULT:
|
case DECIMAL_RESULT:
|
||||||
@@ -1060,8 +1060,9 @@ Item *Item_field::get_tmp_table_item(THD *thd)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Create an item from a string we KNOW points to a valid longlong/ulonglong
|
Create an item from a string we KNOW points to a valid longlong
|
||||||
end \0 terminated number string
|
end \0 terminated number string.
|
||||||
|
This is always 'signed'. Unsigned values are created with Item_uint()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Item_int::Item_int(const char *str_arg, uint length)
|
Item_int::Item_int(const char *str_arg, uint length)
|
||||||
@@ -1071,7 +1072,6 @@ Item_int::Item_int(const char *str_arg, uint length)
|
|||||||
value= my_strtoll10(str_arg, &end_ptr, &error);
|
value= my_strtoll10(str_arg, &end_ptr, &error);
|
||||||
max_length= (uint) (end_ptr - str_arg);
|
max_length= (uint) (end_ptr - str_arg);
|
||||||
name= (char*) str_arg;
|
name= (char*) str_arg;
|
||||||
unsigned_flag= value > 0;
|
|
||||||
fixed= 1;
|
fixed= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2436,8 +2436,8 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
|
|||||||
rf is Item_ref => never substitute other items (in this case)
|
rf is Item_ref => never substitute other items (in this case)
|
||||||
during fix_fields() => we can use rf after fix_fields()
|
during fix_fields() => we can use rf after fix_fields()
|
||||||
*/
|
*/
|
||||||
if (!rf->fixed &&
|
DBUG_ASSERT(!rf->fixed); // Assured by Item_ref()
|
||||||
rf->fix_fields(thd, tables, reference) || rf->check_cols(1))
|
if (rf->fix_fields(thd, tables, reference) || rf->check_cols(1))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
mark_as_dependent(thd, last, current_sel, rf);
|
mark_as_dependent(thd, last, current_sel, rf);
|
||||||
@@ -2458,8 +2458,8 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
|
|||||||
rf is Item_ref => never substitute other items (in this case)
|
rf is Item_ref => never substitute other items (in this case)
|
||||||
during fix_fields() => we can use rf after fix_fields()
|
during fix_fields() => we can use rf after fix_fields()
|
||||||
*/
|
*/
|
||||||
return (!rf->fixed &&
|
DBUG_ASSERT(!rf->fixed); // Assured by Item_ref()
|
||||||
rf->fix_fields(thd, tables, reference) || rf->check_cols(1));
|
return (rf->fix_fields(thd, tables, reference) || rf->check_cols(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2706,8 +2706,7 @@ void Item_empty_string::make_field(Send_field *tmp_field)
|
|||||||
|
|
||||||
enum_field_types Item::field_type() const
|
enum_field_types Item::field_type() const
|
||||||
{
|
{
|
||||||
switch (result_type())
|
switch (result_type()) {
|
||||||
{
|
|
||||||
case STRING_RESULT: return MYSQL_TYPE_VARCHAR;
|
case STRING_RESULT: return MYSQL_TYPE_VARCHAR;
|
||||||
case INT_RESULT: return FIELD_TYPE_LONGLONG;
|
case INT_RESULT: return FIELD_TYPE_LONGLONG;
|
||||||
case DECIMAL_RESULT: return FIELD_TYPE_NEWDECIMAL;
|
case DECIMAL_RESULT: return FIELD_TYPE_NEWDECIMAL;
|
||||||
@@ -2715,8 +2714,8 @@ enum_field_types Item::field_type() const
|
|||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
default:
|
default:
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
return FIELD_TYPE_VAR_STRING;
|
return MYSQL_TYPE_VARCHAR;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3662,8 +3661,7 @@ bool Item_ref::val_bool_result()
|
|||||||
{
|
{
|
||||||
if ((null_value= result_field->is_null()))
|
if ((null_value= result_field->is_null()))
|
||||||
return 0;
|
return 0;
|
||||||
switch (result_field->result_type())
|
switch (result_field->result_type()) {
|
||||||
{
|
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
return result_field->val_int();
|
return result_field->val_int();
|
||||||
case DECIMAL_RESULT:
|
case DECIMAL_RESULT:
|
||||||
@@ -4049,8 +4047,7 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
|
|||||||
item->result_type());
|
item->result_type());
|
||||||
char *name=item->name; // Alloced by sql_alloc
|
char *name=item->name; // Alloced by sql_alloc
|
||||||
|
|
||||||
switch (res_type)
|
switch (res_type) {
|
||||||
{
|
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
{
|
{
|
||||||
char buff[MAX_FIELD_WIDTH];
|
char buff[MAX_FIELD_WIDTH];
|
||||||
@@ -4146,8 +4143,7 @@ bool field_is_equal_to_item(Field *field,Item *item)
|
|||||||
|
|
||||||
Item_cache* Item_cache::get_cache(Item_result type)
|
Item_cache* Item_cache::get_cache(Item_result type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type) {
|
||||||
{
|
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
return new Item_cache_int();
|
return new Item_cache_int();
|
||||||
case REAL_RESULT:
|
case REAL_RESULT:
|
||||||
@@ -4617,8 +4613,7 @@ uint32 Item_type_holder::real_length(Item *item)
|
|||||||
if (item->type() == Item::FIELD_ITEM)
|
if (item->type() == Item::FIELD_ITEM)
|
||||||
return ((Item_field *)item)->max_disp_length();
|
return ((Item_field *)item)->max_disp_length();
|
||||||
|
|
||||||
switch (item->result_type())
|
switch (item->result_type()) {
|
||||||
{
|
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
case DECIMAL_RESULT:
|
case DECIMAL_RESULT:
|
||||||
return item->max_length;
|
return item->max_length;
|
||||||
|
@@ -123,8 +123,7 @@ public:
|
|||||||
static void *operator new(size_t size, MEM_ROOT *mem_root)
|
static void *operator new(size_t size, MEM_ROOT *mem_root)
|
||||||
{ return (void*) alloc_root(mem_root, (uint) size); }
|
{ return (void*) alloc_root(mem_root, (uint) size); }
|
||||||
static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); }
|
static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); }
|
||||||
static void operator delete(void *ptr,size_t size, MEM_ROOT *mem_root)
|
static void operator delete(void *ptr, MEM_ROOT *mem_root) {}
|
||||||
{ TRASH(ptr, size); }
|
|
||||||
|
|
||||||
enum Type {FIELD_ITEM= 0, FUNC_ITEM, SUM_FUNC_ITEM, STRING_ITEM,
|
enum Type {FIELD_ITEM= 0, FUNC_ITEM, SUM_FUNC_ITEM, STRING_ITEM,
|
||||||
INT_ITEM, REAL_ITEM, NULL_ITEM, VARBIN_ITEM,
|
INT_ITEM, REAL_ITEM, NULL_ITEM, VARBIN_ITEM,
|
||||||
|
@@ -28,8 +28,7 @@ Item_buff *new_Item_buff(Item *item)
|
|||||||
if (item->type() == Item::FIELD_ITEM &&
|
if (item->type() == Item::FIELD_ITEM &&
|
||||||
!(((Item_field *) item)->field->flags & BLOB_FLAG))
|
!(((Item_field *) item)->field->flags & BLOB_FLAG))
|
||||||
return new Item_field_buff((Item_field *) item);
|
return new Item_field_buff((Item_field *) item);
|
||||||
switch (item->result_type())
|
switch (item->result_type()) {
|
||||||
{
|
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
return new Item_str_buff((Item_field *) item);
|
return new Item_str_buff((Item_field *) item);
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
|
@@ -273,8 +273,7 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type)
|
|||||||
owner= item;
|
owner= item;
|
||||||
func= comparator_matrix[type]
|
func= comparator_matrix[type]
|
||||||
[test(owner->functype() == Item_func::EQUAL_FUNC)];
|
[test(owner->functype() == Item_func::EQUAL_FUNC)];
|
||||||
switch(type)
|
switch(type) {
|
||||||
{
|
|
||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
{
|
{
|
||||||
uint n= (*a)->cols();
|
uint n= (*a)->cols();
|
||||||
@@ -877,7 +876,17 @@ void Item_func_interval::fix_length_and_dec()
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
return -1 if null value,
|
Execute Item_func_interval()
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
Item_func_interval::val_int()
|
||||||
|
|
||||||
|
NOTES
|
||||||
|
If we are doing a decimal comparison, we are
|
||||||
|
evaluating the first item twice.
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
-1 if null value,
|
||||||
0 if lower than lowest
|
0 if lower than lowest
|
||||||
1 - arg_count-1 if between args[n] and args[n+1]
|
1 - arg_count-1 if between args[n] and args[n+1]
|
||||||
arg_count if higher than biggest argument
|
arg_count if higher than biggest argument
|
||||||
@@ -886,16 +895,24 @@ void Item_func_interval::fix_length_and_dec()
|
|||||||
longlong Item_func_interval::val_int()
|
longlong Item_func_interval::val_int()
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
double value= row->el(0)->val_real();
|
double value;
|
||||||
my_decimal dec_buf, *dec= NULL;
|
my_decimal dec_buf, *dec= NULL;
|
||||||
|
uint i;
|
||||||
|
|
||||||
if (use_decimal_comparison)
|
if (use_decimal_comparison)
|
||||||
{
|
{
|
||||||
dec= row->el(0)->val_decimal(&dec_buf);
|
dec= row->el(0)->val_decimal(&dec_buf);
|
||||||
}
|
|
||||||
uint i;
|
|
||||||
|
|
||||||
if (row->el(0)->null_value)
|
if (row->el(0)->null_value)
|
||||||
return -1; // -1 if null
|
return -1;
|
||||||
|
my_decimal2double(E_DEC_FATAL_ERROR, dec, &value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
value= row->el(0)->val_real();
|
||||||
|
if (row->el(0)->null_value)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (intervals)
|
if (intervals)
|
||||||
{ // Use binary search to find interval
|
{ // Use binary search to find interval
|
||||||
uint start,end;
|
uint start,end;
|
||||||
@@ -906,6 +923,11 @@ longlong Item_func_interval::val_int()
|
|||||||
uint mid= (start + end + 1) / 2;
|
uint mid= (start + end + 1) / 2;
|
||||||
interval_range *range= intervals + mid;
|
interval_range *range= intervals + mid;
|
||||||
my_bool cmp_result;
|
my_bool cmp_result;
|
||||||
|
/*
|
||||||
|
The values in the range intervall may have different types,
|
||||||
|
Only do a decimal comparision of the first argument is a decimal
|
||||||
|
and we are comparing against a decimal
|
||||||
|
*/
|
||||||
if (dec && range->type == DECIMAL_RESULT)
|
if (dec && range->type == DECIMAL_RESULT)
|
||||||
cmp_result= my_decimal_cmp(&range->dec, dec) <= 0;
|
cmp_result= my_decimal_cmp(&range->dec, dec) <= 0;
|
||||||
else
|
else
|
||||||
@@ -932,13 +954,13 @@ longlong Item_func_interval::val_int()
|
|||||||
if (my_decimal_cmp(e_dec, dec) > 0)
|
if (my_decimal_cmp(e_dec, dec) > 0)
|
||||||
return i-1;
|
return i-1;
|
||||||
}
|
}
|
||||||
else
|
else if (row->el(i)->val_real() > value)
|
||||||
if (row->el(i)->val_real() > value)
|
|
||||||
return i-1;
|
return i-1;
|
||||||
}
|
}
|
||||||
return i-1;
|
return i-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Item_func_between::fix_length_and_dec()
|
void Item_func_between::fix_length_and_dec()
|
||||||
{
|
{
|
||||||
max_length= 1;
|
max_length= 1;
|
||||||
@@ -1087,8 +1109,7 @@ Item_func_ifnull::fix_length_and_dec()
|
|||||||
args[1]->max_length - args[1]->decimals) +
|
args[1]->max_length - args[1]->decimals) +
|
||||||
decimals);
|
decimals);
|
||||||
agg_result_type(&cached_result_type, args, 2);
|
agg_result_type(&cached_result_type, args, 2);
|
||||||
switch (cached_result_type)
|
switch (cached_result_type) {
|
||||||
{
|
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV);
|
agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV);
|
||||||
break;
|
break;
|
||||||
@@ -1166,7 +1187,6 @@ my_decimal *Item_func_ifnull::val_decimal(my_decimal *decimal_value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String *
|
String *
|
||||||
Item_func_ifnull::val_str(String *str)
|
Item_func_ifnull::val_str(String *str)
|
||||||
{
|
{
|
||||||
@@ -1456,7 +1476,6 @@ Item *Item_func_case::find_item(String *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String *Item_func_case::val_str(String *str)
|
String *Item_func_case::val_str(String *str)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
@@ -2037,7 +2056,8 @@ int cmp_item_row::compare(cmp_item *c)
|
|||||||
void cmp_item_decimal::store_value(Item *item)
|
void cmp_item_decimal::store_value(Item *item)
|
||||||
{
|
{
|
||||||
my_decimal *val= item->val_decimal(&value);
|
my_decimal *val= item->val_decimal(&value);
|
||||||
if (val != &value)
|
/* val may be zero if item is nnull */
|
||||||
|
if (val && val != &value)
|
||||||
my_decimal2decimal(val, &value);
|
my_decimal2decimal(val, &value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2051,9 +2071,9 @@ int cmp_item_decimal::cmp(Item *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int cmp_item_decimal::compare(cmp_item *c)
|
int cmp_item_decimal::compare(cmp_item *arg)
|
||||||
{
|
{
|
||||||
cmp_item_decimal *cmp= (cmp_item_decimal *)c;
|
cmp_item_decimal *cmp= (cmp_item_decimal*) arg;
|
||||||
return my_decimal_cmp(&value, &cmp->value);
|
return my_decimal_cmp(&value, &cmp->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1665,7 +1665,8 @@ String *Item_func_format::val_str(String *str)
|
|||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
double nr= args[0]->val_real();
|
double nr= args[0]->val_real();
|
||||||
uint32 diff,length,str_length;
|
int diff;
|
||||||
|
uint32 length, str_length;
|
||||||
uint dec;
|
uint dec;
|
||||||
if ((null_value=args[0]->null_value))
|
if ((null_value=args[0]->null_value))
|
||||||
return 0; /* purecov: inspected */
|
return 0; /* purecov: inspected */
|
||||||
@@ -1690,9 +1691,12 @@ String *Item_func_format::val_str(String *str)
|
|||||||
pos[0]= pos[-(int) diff];
|
pos[0]= pos[-(int) diff];
|
||||||
while (diff)
|
while (diff)
|
||||||
{
|
{
|
||||||
pos[0]=pos[-(int) diff]; pos--;
|
*pos= *(pos - diff);
|
||||||
pos[0]=pos[-(int) diff]; pos--;
|
pos--;
|
||||||
pos[0]=pos[-(int) diff]; pos--;
|
*pos= *(pos - diff);
|
||||||
|
pos--;
|
||||||
|
*pos= *(pos - diff);
|
||||||
|
pos--;
|
||||||
pos[0]=',';
|
pos[0]=',';
|
||||||
pos--;
|
pos--;
|
||||||
diff--;
|
diff--;
|
||||||
|
@@ -23,16 +23,18 @@
|
|||||||
decimal_operation_results()
|
decimal_operation_results()
|
||||||
result decimal library return code (E_DEC_* see include/decimal.h)
|
result decimal library return code (E_DEC_* see include/decimal.h)
|
||||||
|
|
||||||
return
|
TODO
|
||||||
|
Fix error messages
|
||||||
|
|
||||||
|
RETURN
|
||||||
result
|
result
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int decimal_operation_results(int result)
|
int decimal_operation_results(int result)
|
||||||
{
|
{
|
||||||
switch (result)
|
switch (result) {
|
||||||
{
|
|
||||||
case E_DEC_OK:
|
case E_DEC_OK:
|
||||||
break;
|
break;
|
||||||
//TODO: fix error messages
|
|
||||||
case E_DEC_TRUNCATED:
|
case E_DEC_TRUNCATED:
|
||||||
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
WARN_DATA_TRUNCATED, ER(WARN_DATA_TRUNCATED),
|
WARN_DATA_TRUNCATED, ER(WARN_DATA_TRUNCATED),
|
||||||
@@ -85,13 +87,11 @@ int my_decimal2string(uint mask, const my_decimal *d,
|
|||||||
int result;
|
int result;
|
||||||
if (str->alloc(length))
|
if (str->alloc(length))
|
||||||
return check_result(mask, E_DEC_OOM);
|
return check_result(mask, E_DEC_OOM);
|
||||||
char *sptr= (char *)str->ptr();
|
result= decimal2string((decimal*) d, (char*) str->ptr(),
|
||||||
int res= decimal2string((decimal *)d, sptr,
|
|
||||||
&length, fixed_prec, fixed_dec,
|
&length, fixed_prec, fixed_dec,
|
||||||
filler);
|
filler);
|
||||||
result= check_result(mask, res);
|
|
||||||
str->length(length);
|
str->length(length);
|
||||||
return result;
|
return check_result(mask, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ int my_decimal2string(uint mask, const my_decimal *d,
|
|||||||
E_DEC_OVERFLOW
|
E_DEC_OVERFLOW
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int my_decimal2binary(uint mask, const my_decimal *d, byte *bin, int prec,
|
int my_decimal2binary(uint mask, const my_decimal *d, char *bin, int prec,
|
||||||
int scale)
|
int scale)
|
||||||
{
|
{
|
||||||
int err1= E_DEC_OK, err2;
|
int err1= E_DEC_OK, err2;
|
||||||
@@ -171,7 +171,7 @@ int str2my_decimal(uint mask, const char *from, uint length,
|
|||||||
}
|
}
|
||||||
my_decimal_set_zero(decimal_value);
|
my_decimal_set_zero(decimal_value);
|
||||||
err= string2decimal((char *)from, (decimal *)decimal_value, &end);
|
err= string2decimal((char *)from, (decimal *)decimal_value, &end);
|
||||||
if ((end-from) != length && !err)
|
if ((uint) (end-from) != length && !err)
|
||||||
err= E_DEC_TRUNCATED;
|
err= E_DEC_TRUNCATED;
|
||||||
check_result(mask, err);
|
check_result(mask, err);
|
||||||
return err;
|
return err;
|
||||||
|
@@ -150,12 +150,12 @@ void my_decimal2decimal(const my_decimal *from, my_decimal *to)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int my_decimal2binary(uint mask, const my_decimal *d, byte *bin, int prec,
|
int my_decimal2binary(uint mask, const my_decimal *d, char *bin, int prec,
|
||||||
int scale);
|
int scale);
|
||||||
|
|
||||||
|
|
||||||
inline
|
inline
|
||||||
int binary2my_decimal(uint mask, const byte *bin, my_decimal *d, int prec,
|
int binary2my_decimal(uint mask, const char *bin, my_decimal *d, int prec,
|
||||||
int scale)
|
int scale)
|
||||||
{
|
{
|
||||||
return check_result(mask, bin2decimal((char *)bin, (decimal *)d, prec,
|
return check_result(mask, bin2decimal((char *)bin, (decimal *)d, prec,
|
||||||
|
@@ -1438,7 +1438,7 @@ ulong Query_cache::init_cache()
|
|||||||
init();
|
init();
|
||||||
approx_additional_data_size = (sizeof(Query_cache) +
|
approx_additional_data_size = (sizeof(Query_cache) +
|
||||||
sizeof(gptr)*(def_query_hash_size+
|
sizeof(gptr)*(def_query_hash_size+
|
||||||
def_query_hash_size));
|
def_table_hash_size));
|
||||||
if (query_cache_size < approx_additional_data_size)
|
if (query_cache_size < approx_additional_data_size)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
@@ -767,6 +767,8 @@ struct Item_change_record: public ilink
|
|||||||
Item *old_value;
|
Item *old_value;
|
||||||
/* Placement new was hidden by `new' in ilink (TODO: check): */
|
/* Placement new was hidden by `new' in ilink (TODO: check): */
|
||||||
static void *operator new(size_t size, void *mem) { return mem; }
|
static void *operator new(size_t size, void *mem) { return mem; }
|
||||||
|
static void operator delete(void *ptr, size_t size) {}
|
||||||
|
static void operator delete(void *ptr, void *mem) { /* never called */ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1733,6 +1733,12 @@ bool st_lex::can_not_use_merged()
|
|||||||
{
|
{
|
||||||
case SQLCOM_CREATE_VIEW:
|
case SQLCOM_CREATE_VIEW:
|
||||||
case SQLCOM_SHOW_CREATE:
|
case SQLCOM_SHOW_CREATE:
|
||||||
|
/*
|
||||||
|
SQLCOM_SHOW_FIELDS is necessary to make
|
||||||
|
information schema tables working correctly with views.
|
||||||
|
see get_schema_tables_result function
|
||||||
|
*/
|
||||||
|
case SQLCOM_SHOW_FIELDS:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@@ -285,8 +285,7 @@ public:
|
|||||||
static void *operator new(size_t size, MEM_ROOT *mem_root)
|
static void *operator new(size_t size, MEM_ROOT *mem_root)
|
||||||
{ return (void*) alloc_root(mem_root, (uint) size); }
|
{ return (void*) alloc_root(mem_root, (uint) size); }
|
||||||
static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); }
|
static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); }
|
||||||
static void operator delete(void *ptr,size_t size, MEM_ROOT *mem_root)
|
static void operator delete(void *ptr, MEM_ROOT *mem_root) {}
|
||||||
{ TRASH(ptr, size); }
|
|
||||||
st_select_lex_node(): linkage(UNSPECIFIED_TYPE) {}
|
st_select_lex_node(): linkage(UNSPECIFIED_TYPE) {}
|
||||||
virtual ~st_select_lex_node() {}
|
virtual ~st_select_lex_node() {}
|
||||||
inline st_select_lex_node* get_master() { return master; }
|
inline st_select_lex_node* get_master() { return master; }
|
||||||
|
@@ -35,8 +35,8 @@ public:
|
|||||||
static void *operator new(size_t size, MEM_ROOT *mem_root)
|
static void *operator new(size_t size, MEM_ROOT *mem_root)
|
||||||
{ return (void*) alloc_root(mem_root, (uint) size); }
|
{ return (void*) alloc_root(mem_root, (uint) size); }
|
||||||
static void operator delete(void *ptr, size_t size) { TRASH(ptr, size); }
|
static void operator delete(void *ptr, size_t size) { TRASH(ptr, size); }
|
||||||
static void operator delete(void *ptr, size_t size, MEM_ROOT *mem_root)
|
static void operator delete(void *ptr, MEM_ROOT *mem_root)
|
||||||
{ TRASH(ptr, size); }
|
{ /* never called */ }
|
||||||
static void operator delete[](void *ptr, size_t size) { TRASH(ptr, size); }
|
static void operator delete[](void *ptr, size_t size) { TRASH(ptr, size); }
|
||||||
#ifdef HAVE_purify
|
#ifdef HAVE_purify
|
||||||
bool dummy;
|
bool dummy;
|
||||||
|
@@ -708,12 +708,12 @@ static int check_connection(THD *thd)
|
|||||||
{
|
{
|
||||||
uint connect_errors= 0;
|
uint connect_errors= 0;
|
||||||
NET *net= &thd->net;
|
NET *net= &thd->net;
|
||||||
|
ulong pkt_len= 0;
|
||||||
|
char *end;
|
||||||
|
|
||||||
DBUG_PRINT("info",
|
DBUG_PRINT("info",
|
||||||
("New connection received on %s", vio_description(net->vio)));
|
("New connection received on %s", vio_description(net->vio)));
|
||||||
|
|
||||||
vio_in_addr(net->vio,&thd->remote.sin_addr);
|
|
||||||
|
|
||||||
if (!thd->host) // If TCP/IP connection
|
if (!thd->host) // If TCP/IP connection
|
||||||
{
|
{
|
||||||
char ip[30];
|
char ip[30];
|
||||||
@@ -723,6 +723,7 @@ static int check_connection(THD *thd)
|
|||||||
if (!(thd->ip= my_strdup(ip,MYF(0))))
|
if (!(thd->ip= my_strdup(ip,MYF(0))))
|
||||||
return (ER_OUT_OF_RESOURCES);
|
return (ER_OUT_OF_RESOURCES);
|
||||||
thd->host_or_ip= thd->ip;
|
thd->host_or_ip= thd->ip;
|
||||||
|
vio_in_addr(net->vio,&thd->remote.sin_addr);
|
||||||
#if !defined(HAVE_SYS_UN_H) || defined(HAVE_mit_thread)
|
#if !defined(HAVE_SYS_UN_H) || defined(HAVE_mit_thread)
|
||||||
/* Fast local hostname resolve for Win32 */
|
/* Fast local hostname resolve for Win32 */
|
||||||
if (!strcmp(thd->ip,"127.0.0.1"))
|
if (!strcmp(thd->ip,"127.0.0.1"))
|
||||||
@@ -758,10 +759,10 @@ static int check_connection(THD *thd)
|
|||||||
DBUG_PRINT("info",("Host: %s",thd->host));
|
DBUG_PRINT("info",("Host: %s",thd->host));
|
||||||
thd->host_or_ip= thd->host;
|
thd->host_or_ip= thd->host;
|
||||||
thd->ip= 0;
|
thd->ip= 0;
|
||||||
|
/* Reset sin_addr */
|
||||||
|
bzero((char*) &thd->remote, sizeof(thd->remote));
|
||||||
}
|
}
|
||||||
vio_keepalive(net->vio, TRUE);
|
vio_keepalive(net->vio, TRUE);
|
||||||
ulong pkt_len= 0;
|
|
||||||
char *end;
|
|
||||||
{
|
{
|
||||||
/* buff[] needs to big enough to hold the server_version variable */
|
/* buff[] needs to big enough to hold the server_version variable */
|
||||||
char buff[SERVER_VERSION_LENGTH + SCRAMBLE_LENGTH + 64];
|
char buff[SERVER_VERSION_LENGTH + SCRAMBLE_LENGTH + 64];
|
||||||
|
@@ -73,8 +73,8 @@ public:
|
|||||||
{ return (void*) alloc_root(mem_root, (uint) size); }
|
{ return (void*) alloc_root(mem_root, (uint) size); }
|
||||||
static void operator delete(void *ptr_arg,size_t size)
|
static void operator delete(void *ptr_arg,size_t size)
|
||||||
{ TRASH(ptr_arg, size); }
|
{ TRASH(ptr_arg, size); }
|
||||||
static void operator delete(void *ptr_arg,size_t size, MEM_ROOT *mem_root)
|
static void operator delete(void *ptr_arg, MEM_ROOT *mem_root)
|
||||||
{ TRASH(ptr_arg, size); }
|
{ /* never called */ }
|
||||||
~String() { free(); }
|
~String() { free(); }
|
||||||
|
|
||||||
inline void set_charset(CHARSET_INFO *charset) { str_charset= charset; }
|
inline void set_charset(CHARSET_INFO *charset) { str_charset= charset; }
|
||||||
|
@@ -264,10 +264,8 @@ int mysql_update(THD *thd,
|
|||||||
else if ((used_index=table->file->key_used_on_scan) < MAX_KEY)
|
else if ((used_index=table->file->key_used_on_scan) < MAX_KEY)
|
||||||
used_key_is_modified=check_if_key_used(table, used_index, fields);
|
used_key_is_modified=check_if_key_used(table, used_index, fields);
|
||||||
else
|
else
|
||||||
{
|
|
||||||
used_key_is_modified=0;
|
used_key_is_modified=0;
|
||||||
used_index= MAX_KEY;
|
|
||||||
}
|
|
||||||
if (used_key_is_modified || order)
|
if (used_key_is_modified || order)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@@ -3811,7 +3811,10 @@ select:
|
|||||||
select_init:
|
select_init:
|
||||||
SELECT_SYM select_init2
|
SELECT_SYM select_init2
|
||||||
|
|
|
|
||||||
'(' SELECT_SYM select_part2 ')'
|
'(' select_paren ')' union_opt;
|
||||||
|
|
||||||
|
select_paren:
|
||||||
|
SELECT_SYM select_part2
|
||||||
{
|
{
|
||||||
LEX *lex= Lex;
|
LEX *lex= Lex;
|
||||||
SELECT_LEX * sel= lex->current_select;
|
SELECT_LEX * sel= lex->current_select;
|
||||||
@@ -3830,7 +3833,8 @@ select_init:
|
|||||||
if (sel->master_unit()->fake_select_lex)
|
if (sel->master_unit()->fake_select_lex)
|
||||||
sel->master_unit()->global_parameters=
|
sel->master_unit()->global_parameters=
|
||||||
sel->master_unit()->fake_select_lex;
|
sel->master_unit()->fake_select_lex;
|
||||||
} union_opt;
|
}
|
||||||
|
| '(' select_paren ')';
|
||||||
|
|
||||||
select_init2:
|
select_init2:
|
||||||
select_part2
|
select_part2
|
||||||
@@ -4990,7 +4994,7 @@ table_factor:
|
|||||||
}
|
}
|
||||||
| '{' ident table_ref LEFT OUTER JOIN_SYM table_ref ON expr '}'
|
| '{' ident table_ref LEFT OUTER JOIN_SYM table_ref ON expr '}'
|
||||||
{ add_join_on($7,$9); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; }
|
{ add_join_on($7,$9); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; }
|
||||||
| '(' SELECT_SYM select_derived ')' opt_table_alias
|
| '(' select_derived union_opt ')' opt_table_alias
|
||||||
{
|
{
|
||||||
LEX *lex=Lex;
|
LEX *lex=Lex;
|
||||||
SELECT_LEX_UNIT *unit= lex->current_select->master_unit();
|
SELECT_LEX_UNIT *unit= lex->current_select->master_unit();
|
||||||
@@ -5004,7 +5008,25 @@ table_factor:
|
|||||||
lex->current_select->add_joined_table($$);
|
lex->current_select->add_joined_table($$);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
select_derived:
|
select_derived:
|
||||||
|
SELECT_SYM select_derived2
|
||||||
|
| '(' select_derived ')'
|
||||||
|
{
|
||||||
|
SELECT_LEX *sel= Select;
|
||||||
|
if (sel->set_braces(1))
|
||||||
|
{
|
||||||
|
yyerror(ER(ER_SYNTAX_ERROR));
|
||||||
|
YYABORT;
|
||||||
|
}
|
||||||
|
/* select in braces, can't contain global parameters */
|
||||||
|
if (sel->master_unit()->fake_select_lex)
|
||||||
|
sel->master_unit()->global_parameters=
|
||||||
|
sel->master_unit()->fake_select_lex;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
select_derived2:
|
||||||
{
|
{
|
||||||
LEX *lex= Lex;
|
LEX *lex= Lex;
|
||||||
lex->derived_tables|= DERIVED_SUBQUERY;
|
lex->derived_tables|= DERIVED_SUBQUERY;
|
||||||
@@ -5026,7 +5048,7 @@ select_derived:
|
|||||||
{
|
{
|
||||||
Select->parsing_place= NO_MATTER;
|
Select->parsing_place= NO_MATTER;
|
||||||
}
|
}
|
||||||
opt_select_from union_opt
|
opt_select_from
|
||||||
;
|
;
|
||||||
|
|
||||||
opt_outer:
|
opt_outer:
|
||||||
|
@@ -661,7 +661,6 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
|
|||||||
if (!(field->flags & BINARY_FLAG))
|
if (!(field->flags & BINARY_FLAG))
|
||||||
keyinfo->flags|= HA_END_SPACE_KEY;
|
keyinfo->flags|= HA_END_SPACE_KEY;
|
||||||
}
|
}
|
||||||
set_if_bigger(share->max_key_length, keyinfo->key_length);
|
|
||||||
if (field->type() == MYSQL_TYPE_BIT)
|
if (field->type() == MYSQL_TYPE_BIT)
|
||||||
key_part->key_part_flag|= HA_BIT_PART;
|
key_part->key_part_flag|= HA_BIT_PART;
|
||||||
|
|
||||||
|
@@ -1493,6 +1493,29 @@ my_bool my_like_range_ucs2(CHARSET_INFO *cs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ulong my_scan_ucs2(CHARSET_INFO *cs __attribute__((unused)),
|
||||||
|
const char *str, const char *end, int sequence_type)
|
||||||
|
{
|
||||||
|
const char *str0= str;
|
||||||
|
end--; /* for easier loop condition, because of two bytes per character */
|
||||||
|
|
||||||
|
switch (sequence_type)
|
||||||
|
{
|
||||||
|
case MY_SEQ_SPACES:
|
||||||
|
for ( ; str < end; str+= 2)
|
||||||
|
{
|
||||||
|
if (str[0] != '\0' || str[1] != ' ')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return str - str0;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static MY_COLLATION_HANDLER my_collation_ucs2_general_ci_handler =
|
static MY_COLLATION_HANDLER my_collation_ucs2_general_ci_handler =
|
||||||
{
|
{
|
||||||
NULL, /* init */
|
NULL, /* init */
|
||||||
@@ -1549,7 +1572,7 @@ MY_CHARSET_HANDLER my_charset_ucs2_handler=
|
|||||||
my_strntoull_ucs2,
|
my_strntoull_ucs2,
|
||||||
my_strntod_ucs2,
|
my_strntod_ucs2,
|
||||||
my_strtoll10_ucs2,
|
my_strtoll10_ucs2,
|
||||||
my_scan_8bit
|
my_scan_ucs2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -272,6 +272,18 @@ my_bool vio_peer_addr(Vio * vio, char *buf, uint16 *port)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Get in_addr for a TCP/IP connection
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
vio_in_addr()
|
||||||
|
vio vio handle
|
||||||
|
in put in_addr here
|
||||||
|
|
||||||
|
NOTES
|
||||||
|
one must call vio_peer_addr() before calling this one
|
||||||
|
*/
|
||||||
|
|
||||||
void vio_in_addr(Vio *vio, struct in_addr *in)
|
void vio_in_addr(Vio *vio, struct in_addr *in)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("vio_in_addr");
|
DBUG_ENTER("vio_in_addr");
|
||||||
|
Reference in New Issue
Block a user