Commit e0b982fd authored by malff/marcsql@weblab.(none)'s avatar malff/marcsql@weblab.(none)

Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-runtime

into  weblab.(none):/home/marcsql/TREE/mysql-5.1-rt50-merge
parents 400aec95 c70ffc31
...@@ -207,3 +207,28 @@ then ...@@ -207,3 +207,28 @@ then
echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC" echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC"
echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX" echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX"
fi fi
# gcov
# The -fprofile-arcs and -ftest-coverage options cause GCC to instrument the
# code with profiling information used by gcov.
# The -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl.
# The -DHAVE_gcov enables code to write out coverage info even when crashing.
gcov_compile_flags="-fprofile-arcs -ftest-coverage"
gcov_compile_flags="$gcov_compile_flags -DDISABLE_TAO_ASM"
gcov_compile_flags="$gcov_compile_flags -DMYSQL_SERVER_SUFFIX=-gcov -DHAVE_gcov"
# GCC4 needs -fprofile-arcs -ftest-coverage on the linker command line (as well
# as on the compiler command line), and this requires setting LDFLAGS for BDB.
gcov_link_flags="-fprofile-arcs -ftest-coverage"
gcov_configs="--disable-shared $static_link"
# gprof
gprof_compile_flags="-O2 -pg -g"
gprof_link_flags="--disable-shared $static_link"
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
# Need to disable ccache, or we loose the gcov-needed compiler output files.
CCACHE_DISABLE=1
export CCACHE_DISABLE
export LDFLAGS="$gcov_link_flags"
extra_flags="$amd64_cflags $debug_cflags $max_cflags $gcov_compile_flags"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$amd64_configs $debug_configs $gcov_configs $max_configs"
. "$path/FINISH.sh"
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$amd64_cflags $gprof_compile_flags"
extra_configs="$amd64_configs $debug_configs $gprof_link_flags"
. "$path/FINISH.sh"
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" . "$path/SETUP.sh"
extra_flags="$pentium_cflags -O2 -pg -g" extra_flags="$pentium_cflags $gprof_compile_flags"
extra_configs="$pentium_configs $debug_configs --disable-shared $static_link" extra_configs="$pentium_configs $debug_configs $gprof_link_flags"
. "$path/FINISH.sh" . "$path/FINISH.sh"
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
# Need to disable ccache, or we loose the gcov-needed compiler output files.
CCACHE_DISABLE=1
export CCACHE_DISABLE
export LDFLAGS="$gcov_link_flags"
extra_flags="$pentium64_cflags $debug_cflags $max_cflags $gcov_compile_flags"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium64_configs $debug_configs $gcov_configs $max_configs"
. "$path/FINISH.sh"
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $gprof_compile_flags"
extra_configs="$pentium64_configs $debug_configs $gprof_link_flags"
. "$path/FINISH.sh"
drop table if exists t1_30237_bool;
create table t1_30237_bool(A boolean, B boolean, C boolean);
insert into t1_30237_bool values
(FALSE, FALSE, FALSE),
(FALSE, FALSE, NULL),
(FALSE, FALSE, TRUE),
(FALSE, NULL, FALSE),
(FALSE, NULL, NULL),
(FALSE, NULL, TRUE),
(FALSE, TRUE, FALSE),
(FALSE, TRUE, NULL),
(FALSE, TRUE, TRUE),
(NULL, FALSE, FALSE),
(NULL, FALSE, NULL),
(NULL, FALSE, TRUE),
(NULL, NULL, FALSE),
(NULL, NULL, NULL),
(NULL, NULL, TRUE),
(NULL, TRUE, FALSE),
(NULL, TRUE, NULL),
(NULL, TRUE, TRUE),
(TRUE, FALSE, FALSE),
(TRUE, FALSE, NULL),
(TRUE, FALSE, TRUE),
(TRUE, NULL, FALSE),
(TRUE, NULL, NULL),
(TRUE, NULL, TRUE),
(TRUE, TRUE, FALSE),
(TRUE, TRUE, NULL),
(TRUE, TRUE, TRUE) ;
Testing OR, XOR, AND
select A, B, A OR B, A XOR B, A AND B
from t1_30237_bool where C is null order by A, B;
A B A OR B A XOR B A AND B
NULL NULL NULL NULL NULL
NULL 0 NULL NULL 0
NULL 1 1 NULL NULL
0 NULL NULL NULL 0
0 0 0 0 0
0 1 1 1 0
1 NULL 1 NULL NULL
1 0 1 1 0
1 1 1 0 1
Testing that OR is associative
select A, B, C, (A OR B) OR C, A OR (B OR C), A OR B OR C
from t1_30237_bool order by A, B, C;
A B C (A OR B) OR C A OR (B OR C) A OR B OR C
NULL NULL NULL NULL NULL NULL
NULL NULL 0 NULL NULL NULL
NULL NULL 1 1 1 1
NULL 0 NULL NULL NULL NULL
NULL 0 0 NULL NULL NULL
NULL 0 1 1 1 1
NULL 1 NULL 1 1 1
NULL 1 0 1 1 1
NULL 1 1 1 1 1
0 NULL NULL NULL NULL NULL
0 NULL 0 NULL NULL NULL
0 NULL 1 1 1 1
0 0 NULL NULL NULL NULL
0 0 0 0 0 0
0 0 1 1 1 1
0 1 NULL 1 1 1
0 1 0 1 1 1
0 1 1 1 1 1
1 NULL NULL 1 1 1
1 NULL 0 1 1 1
1 NULL 1 1 1 1
1 0 NULL 1 1 1
1 0 0 1 1 1
1 0 1 1 1 1
1 1 NULL 1 1 1
1 1 0 1 1 1
1 1 1 1 1 1
select count(*) from t1_30237_bool
where ((A OR B) OR C) != (A OR (B OR C));
count(*)
0
Testing that XOR is associative
select A, B, C, (A XOR B) XOR C, A XOR (B XOR C), A XOR B XOR C
from t1_30237_bool order by A, B, C;
A B C (A XOR B) XOR C A XOR (B XOR C) A XOR B XOR C
NULL NULL NULL NULL NULL NULL
NULL NULL 0 NULL NULL NULL
NULL NULL 1 NULL NULL NULL
NULL 0 NULL NULL NULL NULL
NULL 0 0 NULL NULL NULL
NULL 0 1 NULL NULL NULL
NULL 1 NULL NULL NULL NULL
NULL 1 0 NULL NULL NULL
NULL 1 1 NULL NULL NULL
0 NULL NULL NULL NULL NULL
0 NULL 0 NULL NULL NULL
0 NULL 1 NULL NULL NULL
0 0 NULL NULL NULL NULL
0 0 0 0 0 0
0 0 1 1 1 1
0 1 NULL NULL NULL NULL
0 1 0 1 1 1
0 1 1 0 0 0
1 NULL NULL NULL NULL NULL
1 NULL 0 NULL NULL NULL
1 NULL 1 NULL NULL NULL
1 0 NULL NULL NULL NULL
1 0 0 1 1 1
1 0 1 0 0 0
1 1 NULL NULL NULL NULL
1 1 0 0 0 0
1 1 1 1 1 1
select count(*) from t1_30237_bool
where ((A XOR B) XOR C) != (A XOR (B XOR C));
count(*)
0
Testing that AND is associative
select A, B, C, (A AND B) AND C, A AND (B AND C), A AND B AND C
from t1_30237_bool order by A, B, C;
A B C (A AND B) AND C A AND (B AND C) A AND B AND C
NULL NULL NULL NULL NULL NULL
NULL NULL 0 0 0 0
NULL NULL 1 NULL NULL NULL
NULL 0 NULL 0 0 0
NULL 0 0 0 0 0
NULL 0 1 0 0 0
NULL 1 NULL NULL NULL NULL
NULL 1 0 0 0 0
NULL 1 1 NULL NULL NULL
0 NULL NULL 0 0 0
0 NULL 0 0 0 0
0 NULL 1 0 0 0
0 0 NULL 0 0 0
0 0 0 0 0 0
0 0 1 0 0 0
0 1 NULL 0 0 0
0 1 0 0 0 0
0 1 1 0 0 0
1 NULL NULL NULL NULL NULL
1 NULL 0 0 0 0
1 NULL 1 NULL NULL NULL
1 0 NULL 0 0 0
1 0 0 0 0 0
1 0 1 0 0 0
1 1 NULL NULL NULL NULL
1 1 0 0 0 0
1 1 1 1 1 1
select count(*) from t1_30237_bool
where ((A AND B) AND C) != (A AND (B AND C));
count(*)
0
Testing that AND has precedence over OR
select A, B, C, (A OR B) AND C, A OR (B AND C), A OR B AND C
from t1_30237_bool order by A, B, C;
A B C (A OR B) AND C A OR (B AND C) A OR B AND C
NULL NULL NULL NULL NULL NULL
NULL NULL 0 0 NULL NULL
NULL NULL 1 NULL NULL NULL
NULL 0 NULL NULL NULL NULL
NULL 0 0 0 NULL NULL
NULL 0 1 NULL NULL NULL
NULL 1 NULL NULL NULL NULL
NULL 1 0 0 NULL NULL
NULL 1 1 1 1 1
0 NULL NULL NULL NULL NULL
0 NULL 0 0 0 0
0 NULL 1 NULL NULL NULL
0 0 NULL 0 0 0
0 0 0 0 0 0
0 0 1 0 0 0
0 1 NULL NULL NULL NULL
0 1 0 0 0 0
0 1 1 1 1 1
1 NULL NULL NULL 1 1
1 NULL 0 0 1 1
1 NULL 1 1 1 1
1 0 NULL NULL 1 1
1 0 0 0 1 1
1 0 1 1 1 1
1 1 NULL NULL 1 1
1 1 0 0 1 1
1 1 1 1 1 1
select count(*) from t1_30237_bool
where (A OR (B AND C)) != (A OR B AND C);
count(*)
0
select A, B, C, (A AND B) OR C, A AND (B OR C), A AND B OR C
from t1_30237_bool order by A, B, C;
A B C (A AND B) OR C A AND (B OR C) A AND B OR C
NULL NULL NULL NULL NULL NULL
NULL NULL 0 NULL NULL NULL
NULL NULL 1 1 NULL 1
NULL 0 NULL NULL NULL NULL
NULL 0 0 0 0 0
NULL 0 1 1 NULL 1
NULL 1 NULL NULL NULL NULL
NULL 1 0 NULL NULL NULL
NULL 1 1 1 NULL 1
0 NULL NULL NULL 0 NULL
0 NULL 0 0 0 0
0 NULL 1 1 0 1
0 0 NULL NULL 0 NULL
0 0 0 0 0 0
0 0 1 1 0 1
0 1 NULL NULL 0 NULL
0 1 0 0 0 0
0 1 1 1 0 1
1 NULL NULL NULL NULL NULL
1 NULL 0 NULL NULL NULL
1 NULL 1 1 1 1
1 0 NULL NULL NULL NULL
1 0 0 0 0 0
1 0 1 1 1 1
1 1 NULL 1 1 1
1 1 0 1 1 1
1 1 1 1 1 1
select count(*) from t1_30237_bool
where ((A AND B) OR C) != (A AND B OR C);
count(*)
0
Testing that AND has precedence over XOR
select A, B, C, (A XOR B) AND C, A XOR (B AND C), A XOR B AND C
from t1_30237_bool order by A, B, C;
A B C (A XOR B) AND C A XOR (B AND C) A XOR B AND C
NULL NULL NULL NULL NULL NULL
NULL NULL 0 0 NULL NULL
NULL NULL 1 NULL NULL NULL
NULL 0 NULL NULL NULL NULL
NULL 0 0 0 NULL NULL
NULL 0 1 NULL NULL NULL
NULL 1 NULL NULL NULL NULL
NULL 1 0 0 NULL NULL
NULL 1 1 NULL NULL NULL
0 NULL NULL NULL NULL NULL
0 NULL 0 0 0 0
0 NULL 1 NULL NULL NULL
0 0 NULL 0 0 0
0 0 0 0 0 0
0 0 1 0 0 0
0 1 NULL NULL NULL NULL
0 1 0 0 0 0
0 1 1 1 1 1
1 NULL NULL NULL NULL NULL
1 NULL 0 0 1 1
1 NULL 1 NULL NULL NULL
1 0 NULL NULL 1 1
1 0 0 0 1 1
1 0 1 1 1 1
1 1 NULL 0 NULL NULL
1 1 0 0 1 1
1 1 1 0 0 0
select count(*) from t1_30237_bool
where (A XOR (B AND C)) != (A XOR B AND C);
count(*)
0
select A, B, C, (A AND B) XOR C, A AND (B XOR C), A AND B XOR C
from t1_30237_bool order by A, B, C;
A B C (A AND B) XOR C A AND (B XOR C) A AND B XOR C
NULL NULL NULL NULL NULL NULL
NULL NULL 0 NULL NULL NULL
NULL NULL 1 NULL NULL NULL
NULL 0 NULL NULL NULL NULL
NULL 0 0 0 0 0
NULL 0 1 1 NULL 1
NULL 1 NULL NULL NULL NULL
NULL 1 0 NULL NULL NULL
NULL 1 1 NULL 0 NULL
0 NULL NULL NULL 0 NULL
0 NULL 0 0 0 0
0 NULL 1 1 0 1
0 0 NULL NULL 0 NULL
0 0 0 0 0 0
0 0 1 1 0 1
0 1 NULL NULL 0 NULL
0 1 0 0 0 0
0 1 1 1 0 1
1 NULL NULL NULL NULL NULL
1 NULL 0 NULL NULL NULL
1 NULL 1 NULL NULL NULL
1 0 NULL NULL NULL NULL
1 0 0 0 0 0
1 0 1 1 1 1
1 1 NULL NULL NULL NULL
1 1 0 1 1 1
1 1 1 0 0 0
select count(*) from t1_30237_bool
where ((A AND B) XOR C) != (A AND B XOR C);
count(*)
0
Testing that XOR has precedence over OR
select A, B, C, (A XOR B) OR C, A XOR (B OR C), A XOR B OR C
from t1_30237_bool order by A, B, C;
A B C (A XOR B) OR C A XOR (B OR C) A XOR B OR C
NULL NULL NULL NULL NULL NULL
NULL NULL 0 NULL NULL NULL
NULL NULL 1 1 NULL 1
NULL 0 NULL NULL NULL NULL
NULL 0 0 NULL NULL NULL
NULL 0 1 1 NULL 1
NULL 1 NULL NULL NULL NULL
NULL 1 0 NULL NULL NULL
NULL 1 1 1 NULL 1
0 NULL NULL NULL NULL NULL
0 NULL 0 NULL NULL NULL
0 NULL 1 1 1 1
0 0 NULL NULL NULL NULL
0 0 0 0 0 0
0 0 1 1 1 1
0 1 NULL 1 1 1
0 1 0 1 1 1
0 1 1 1 1 1
1 NULL NULL NULL NULL NULL
1 NULL 0 NULL NULL NULL
1 NULL 1 1 0 1
1 0 NULL 1 NULL 1
1 0 0 1 1 1
1 0 1 1 0 1
1 1 NULL NULL 0 NULL
1 1 0 0 0 0
1 1 1 1 0 1
select count(*) from t1_30237_bool
where ((A XOR B) OR C) != (A XOR B OR C);
count(*)
0
select A, B, C, (A OR B) XOR C, A OR (B XOR C), A OR B XOR C
from t1_30237_bool order by A, B, C;
A B C (A OR B) XOR C A OR (B XOR C) A OR B XOR C
NULL NULL NULL NULL NULL NULL
NULL NULL 0 NULL NULL NULL
NULL NULL 1 NULL NULL NULL
NULL 0 NULL NULL NULL NULL
NULL 0 0 NULL NULL NULL
NULL 0 1 NULL 1 1
NULL 1 NULL NULL NULL NULL
NULL 1 0 1 1 1
NULL 1 1 0 NULL NULL
0 NULL NULL NULL NULL NULL
0 NULL 0 NULL NULL NULL
0 NULL 1 NULL NULL NULL
0 0 NULL NULL NULL NULL
0 0 0 0 0 0
0 0 1 1 1 1
0 1 NULL NULL NULL NULL
0 1 0 1 1 1
0 1 1 0 0 0
1 NULL NULL NULL 1 1
1 NULL 0 1 1 1
1 NULL 1 0 1 1
1 0 NULL NULL 1 1
1 0 0 1 1 1
1 0 1 0 1 1
1 1 NULL NULL 1 1
1 1 0 1 1 1
1 1 1 0 1 1
select count(*) from t1_30237_bool
where (A OR (B XOR C)) != (A OR B XOR C);
count(*)
0
drop table t1_30237_bool;
--disable_warnings
drop table if exists t1_30237_bool;
--enable_warnings
create table t1_30237_bool(A boolean, B boolean, C boolean);
insert into t1_30237_bool values
(FALSE, FALSE, FALSE),
(FALSE, FALSE, NULL),
(FALSE, FALSE, TRUE),
(FALSE, NULL, FALSE),
(FALSE, NULL, NULL),
(FALSE, NULL, TRUE),
(FALSE, TRUE, FALSE),
(FALSE, TRUE, NULL),
(FALSE, TRUE, TRUE),
(NULL, FALSE, FALSE),
(NULL, FALSE, NULL),
(NULL, FALSE, TRUE),
(NULL, NULL, FALSE),
(NULL, NULL, NULL),
(NULL, NULL, TRUE),
(NULL, TRUE, FALSE),
(NULL, TRUE, NULL),
(NULL, TRUE, TRUE),
(TRUE, FALSE, FALSE),
(TRUE, FALSE, NULL),
(TRUE, FALSE, TRUE),
(TRUE, NULL, FALSE),
(TRUE, NULL, NULL),
(TRUE, NULL, TRUE),
(TRUE, TRUE, FALSE),
(TRUE, TRUE, NULL),
(TRUE, TRUE, TRUE) ;
--echo Testing OR, XOR, AND
select A, B, A OR B, A XOR B, A AND B
from t1_30237_bool where C is null order by A, B;
--echo Testing that OR is associative
select A, B, C, (A OR B) OR C, A OR (B OR C), A OR B OR C
from t1_30237_bool order by A, B, C;
select count(*) from t1_30237_bool
where ((A OR B) OR C) != (A OR (B OR C));
--echo Testing that XOR is associative
select A, B, C, (A XOR B) XOR C, A XOR (B XOR C), A XOR B XOR C
from t1_30237_bool order by A, B, C;
select count(*) from t1_30237_bool
where ((A XOR B) XOR C) != (A XOR (B XOR C));
--echo Testing that AND is associative
select A, B, C, (A AND B) AND C, A AND (B AND C), A AND B AND C
from t1_30237_bool order by A, B, C;
select count(*) from t1_30237_bool
where ((A AND B) AND C) != (A AND (B AND C));
--echo Testing that AND has precedence over OR
select A, B, C, (A OR B) AND C, A OR (B AND C), A OR B AND C
from t1_30237_bool order by A, B, C;
select count(*) from t1_30237_bool
where (A OR (B AND C)) != (A OR B AND C);
select A, B, C, (A AND B) OR C, A AND (B OR C), A AND B OR C
from t1_30237_bool order by A, B, C;
select count(*) from t1_30237_bool
where ((A AND B) OR C) != (A AND B OR C);
--echo Testing that AND has precedence over XOR
select A, B, C, (A XOR B) AND C, A XOR (B AND C), A XOR B AND C
from t1_30237_bool order by A, B, C;
select count(*) from t1_30237_bool
where (A XOR (B AND C)) != (A XOR B AND C);
select A, B, C, (A AND B) XOR C, A AND (B XOR C), A AND B XOR C
from t1_30237_bool order by A, B, C;
select count(*) from t1_30237_bool
where ((A AND B) XOR C) != (A AND B XOR C);
--echo Testing that XOR has precedence over OR
select A, B, C, (A XOR B) OR C, A XOR (B OR C), A XOR B OR C
from t1_30237_bool order by A, B, C;
select count(*) from t1_30237_bool
where ((A XOR B) OR C) != (A XOR B OR C);
select A, B, C, (A OR B) XOR C, A OR (B XOR C), A OR B XOR C
from t1_30237_bool order by A, B, C;
select count(*) from t1_30237_bool
where (A OR (B XOR C)) != (A OR B XOR C);
drop table t1_30237_bool;
...@@ -1425,6 +1425,7 @@ class Item_cond :public Item_bool_func ...@@ -1425,6 +1425,7 @@ class Item_cond :public Item_bool_func
Item_cond(List<Item> &nlist) Item_cond(List<Item> &nlist)
:Item_bool_func(), list(nlist), abort_on_null(0) {} :Item_bool_func(), list(nlist), abort_on_null(0) {}
bool add(Item *item) { return list.push_back(item); } bool add(Item *item) { return list.push_back(item); }
bool add_at_head(Item *item) { return list.push_front(item); }
void add_at_head(List<Item> *nlist) { list.prepand(nlist); } void add_at_head(List<Item> *nlist) { list.prepand(nlist); }
bool fix_fields(THD *, Item **ref); bool fix_fields(THD *, Item **ref);
...@@ -1618,6 +1619,15 @@ class Item_cond_and :public Item_cond ...@@ -1618,6 +1619,15 @@ class Item_cond_and :public Item_cond
Item *neg_transformer(THD *thd); Item *neg_transformer(THD *thd);
}; };
inline bool is_cond_and(Item *item)
{
if (item->type() != Item::COND_ITEM)
return FALSE;
Item_cond *cond_item= (Item_cond*) item;
return (cond_item->functype() == Item_func::COND_AND_FUNC);
}
class Item_cond_or :public Item_cond class Item_cond_or :public Item_cond
{ {
public: public:
...@@ -1639,6 +1649,14 @@ class Item_cond_or :public Item_cond ...@@ -1639,6 +1649,14 @@ class Item_cond_or :public Item_cond
Item *neg_transformer(THD *thd); Item *neg_transformer(THD *thd);
}; };
inline bool is_cond_or(Item *item)
{
if (item->type() != Item::COND_ITEM)
return FALSE;
Item_cond *cond_item= (Item_cond*) item;
return (cond_item->functype() == Item_func::COND_OR_FUNC);
}
/* /*
XOR is Item_cond, not an Item_int_func because we could like to XOR is Item_cond, not an Item_int_func because we could like to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment