summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/event_db_repository.cc12
-rw-r--r--sql/field.cc10
-rw-r--r--sql/field.h21
-rw-r--r--sql/field_conv.cc4
-rw-r--r--sql/ha_partition.cc8
-rw-r--r--sql/handler.cc2
-rw-r--r--sql/handler.h2
-rw-r--r--sql/item.cc4
-rw-r--r--sql/item.h6
-rw-r--r--sql/item_cmpfunc.cc30
-rw-r--r--sql/item_cmpfunc.h6
-rw-r--r--sql/item_func.cc7
-rw-r--r--sql/item_geofunc.cc2
-rw-r--r--sql/item_strfunc.cc2
-rw-r--r--sql/item_subselect.cc12
-rw-r--r--sql/item_subselect.h6
-rw-r--r--sql/item_timefunc.cc2
-rw-r--r--sql/key.cc10
-rw-r--r--sql/log_event.cc4
-rw-r--r--sql/multi_range_read.cc34
-rw-r--r--sql/my_apc.h2
-rw-r--r--sql/mysqld.cc8
-rw-r--r--sql/net_serv.cc16
-rw-r--r--sql/opt_index_cond_pushdown.cc4
-rw-r--r--sql/opt_range.cc30
-rw-r--r--sql/opt_range.h2
-rw-r--r--sql/opt_subselect.cc22
-rw-r--r--sql/opt_subselect.h2
-rw-r--r--sql/opt_sum.cc14
-rw-r--r--sql/opt_table_elimination.cc6
-rw-r--r--sql/password.c2
-rw-r--r--sql/rpl_mi.cc2
-rw-r--r--sql/set_var.cc2
-rw-r--r--sql/slave.cc6
-rw-r--r--sql/sp_head.h7
-rw-r--r--sql/sp_rcontext.h2
-rw-r--r--sql/sql_acl.cc32
-rw-r--r--sql/sql_admin.cc2
-rw-r--r--sql/sql_base.cc7
-rw-r--r--sql/sql_bitmap.h4
-rw-r--r--sql/sql_cache.cc28
-rw-r--r--sql/sql_class.cc10
-rw-r--r--sql/sql_class.h2
-rw-r--r--sql/sql_delete.cc6
-rw-r--r--sql/sql_insert.cc8
-rw-r--r--sql/sql_join_cache.cc20
-rw-r--r--sql/sql_lex.cc29
-rw-r--r--sql/sql_lex.h2
-rw-r--r--sql/sql_load.cc8
-rw-r--r--sql/sql_parse.cc18
-rw-r--r--sql/sql_parse.h2
-rw-r--r--sql/sql_partition.cc12
-rw-r--r--sql/sql_prepare.cc4
-rw-r--r--sql/sql_prepare.h4
-rw-r--r--sql/sql_select.cc74
-rw-r--r--sql/sql_select.h8
-rw-r--r--sql/sql_show.cc16
-rw-r--r--sql/sql_statistics.h2
-rw-r--r--sql/sql_table.cc12
-rw-r--r--sql/sql_time.cc6
-rw-r--r--sql/sql_union.cc6
-rw-r--r--sql/sql_update.cc4
-rw-r--r--sql/sql_yacc.yy4
-rw-r--r--sql/sys_vars.cc4
-rw-r--r--sql/table.cc22
-rw-r--r--sql/table.h2
-rw-r--r--sql/transaction.cc24
-rw-r--r--sql/tztime.cc2
-rw-r--r--sql/uniques.cc2
-rw-r--r--sql/unireg.cc6
70 files changed, 355 insertions, 348 deletions
diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc
index 34658ab51ac..b20269b8304 100644
--- a/sql/event_db_repository.cc
+++ b/sql/event_db_repository.cc
@@ -474,7 +474,7 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table,
end:
event_table->file->ha_index_end();
- DBUG_RETURN(test(ret));
+ DBUG_RETURN(MY_TEST(ret));
}
@@ -746,7 +746,7 @@ end:
thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
thd->variables.sql_mode= saved_mode;
- DBUG_RETURN(test(ret));
+ DBUG_RETURN(MY_TEST(ret));
}
@@ -861,7 +861,7 @@ end:
thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
thd->variables.sql_mode= saved_mode;
- DBUG_RETURN(test(ret));
+ DBUG_RETURN(MY_TEST(ret));
}
@@ -921,7 +921,7 @@ end:
close_thread_tables(thd);
thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
- DBUG_RETURN(test(ret));
+ DBUG_RETURN(MY_TEST(ret));
}
@@ -1159,7 +1159,7 @@ end:
thd->restore_stmt_binlog_format(save_binlog_format);
- DBUG_RETURN(test(ret));
+ DBUG_RETURN(MY_TEST(ret));
}
@@ -1237,7 +1237,7 @@ Event_db_repository::check_system_tables(THD *thd)
close_mysql_tables(thd);
}
- DBUG_RETURN(test(ret));
+ DBUG_RETURN(MY_TEST(ret));
}
/**
diff --git a/sql/field.cc b/sql/field.cc
index 755d2f8b625..9ec0e4d3089 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1774,7 +1774,7 @@ int Field_num::store_decimal(const my_decimal *val)
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int err= 0;
longlong i= convert_decimal2longlong(val, unsigned_flag, &err);
- return test(err | store(i, unsigned_flag));
+ return MY_TEST(err | store(i, unsigned_flag));
}
@@ -1926,7 +1926,7 @@ int Field::store_time_dec(MYSQL_TIME *ltime, uint dec)
bool Field::optimize_range(uint idx, uint part)
{
- return test(table->file->index_flags(idx, part, 1) & HA_READ_RANGE);
+ return MY_TEST(table->file->index_flags(idx, part, 1) & HA_READ_RANGE);
}
@@ -8487,7 +8487,7 @@ int Field_bit::store_decimal(const my_decimal *val)
{
int err= 0;
longlong i= convert_decimal2longlong(val, 1, &err);
- return test(err | store(i, TRUE));
+ return MY_TEST(err | store(i, TRUE));
}
@@ -8776,7 +8776,7 @@ Field_bit::unpack(uchar *to, const uchar *from, const uchar *from_end,
if (param_data == 0 ||
((from_bit_len == bit_len) && (from_len == bytes_in_rec)))
{
- if (from + bytes_in_rec + test(bit_len) > from_end)
+ if (from + bytes_in_rec + MY_TEST(bit_len) > from_end)
return 0; // Error in data
if (bit_len > 0)
@@ -8931,7 +8931,7 @@ void Create_field::create_length_to_internal_length(void)
{
pack_length= length / 8;
/* We need one extra byte to store the bits we save among the null bits */
- key_length= pack_length + test(length & 7);
+ key_length= pack_length + MY_TEST(length & 7);
}
break;
case MYSQL_TYPE_NEWDECIMAL:
diff --git a/sql/field.h b/sql/field.h
index 72be8e3519a..5a1607c1cbf 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -67,7 +67,7 @@ enum Derivation
#define MY_REPERTOIRE_NUMERIC MY_REPERTOIRE_ASCII
/* The length of the header part for each virtual column in the .frm file */
-#define FRM_VCOL_HEADER_SIZE(b) (3 + test(b))
+#define FRM_VCOL_HEADER_SIZE(b) (3 + MY_TEST(b))
class Count_distinct_field;
@@ -616,7 +616,7 @@ public:
null_ptr[row_offset].
*/
return (table->null_row ? TRUE :
- null_ptr ? test(null_ptr[row_offset] & null_bit) : 0);
+ null_ptr ? MY_TEST(null_ptr[row_offset] & null_bit) : 0);
}
inline bool is_real_null(my_ptrdiff_t row_offset= 0) const
{ return null_ptr ? (null_ptr[row_offset] & null_bit ? 1 : 0) : 0; }
@@ -624,8 +624,7 @@ public:
{
if (!null_ptr)
return 0;
- return test(record[(uint) (null_ptr -table->record[0])] &
- null_bit);
+ return MY_TEST(record[(uint) (null_ptr - table->record[0])] & null_bit);
}
inline void set_null(my_ptrdiff_t row_offset= 0)
{ if (null_ptr) null_ptr[row_offset]|= null_bit; }
@@ -1054,7 +1053,7 @@ public:
my_decimal *val_decimal(my_decimal *);
virtual bool str_needs_quotes() { return TRUE; }
uint is_equal(Create_field *new_field);
- bool eq_cmp_as_binary() { return test(flags & BINARY_FLAG); }
+ bool eq_cmp_as_binary() { return MY_TEST(flags & BINARY_FLAG); }
virtual uint length_size() { return 0; }
double pos_in_interval(Field *min, Field *max)
{
@@ -1654,7 +1653,7 @@ public:
const char *field_name_arg,
TABLE_SHARE *share, uint dec_arg) :
Field_timestamp(ptr_arg,
- MAX_DATETIME_WIDTH + dec_arg + test(dec_arg), null_ptr_arg,
+ MAX_DATETIME_WIDTH + dec_arg + MY_TEST(dec_arg), null_ptr_arg,
null_bit_arg, unireg_check_arg, field_name_arg, share),
dec(dec_arg)
{
@@ -1865,8 +1864,8 @@ public:
Field_time_with_dec(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
uint dec_arg)
- :Field_time(ptr_arg, MIN_TIME_WIDTH + dec_arg + test(dec_arg), null_ptr_arg,
- null_bit_arg, unireg_check_arg, field_name_arg),
+ :Field_time(ptr_arg, MIN_TIME_WIDTH + dec_arg + MY_TEST(dec_arg),
+ null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg),
dec(dec_arg)
{
DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS);
@@ -2022,7 +2021,7 @@ public:
Field_datetime_with_dec(uchar *ptr_arg, uchar *null_ptr_arg,
uchar null_bit_arg, enum utype unireg_check_arg,
const char *field_name_arg, uint dec_arg)
- :Field_datetime(ptr_arg, MAX_DATETIME_WIDTH + dec_arg + test(dec_arg),
+ :Field_datetime(ptr_arg, MAX_DATETIME_WIDTH + dec_arg + MY_TEST(dec_arg),
null_ptr_arg, null_bit_arg, unireg_check_arg,
field_name_arg), dec(dec_arg)
{
@@ -2649,9 +2648,9 @@ public:
{
DBUG_ASSERT(ptr == a || ptr == b);
if (ptr == a)
- return Field_bit::key_cmp(b, bytes_in_rec+test(bit_len));
+ return Field_bit::key_cmp(b, bytes_in_rec + MY_TEST(bit_len));
else
- return Field_bit::key_cmp(a, bytes_in_rec+test(bit_len)) * -1;
+ return Field_bit::key_cmp(a, bytes_in_rec + MY_TEST(bit_len)) * -1;
}
int cmp_binary_offset(uint row_offset)
{ return cmp_offset(row_offset); }
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index 71ab4265ee3..97c82b9b7bf 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -399,7 +399,7 @@ static void do_field_int(Copy_field *copy)
{
longlong value= copy->from_field->val_int();
copy->to_field->store(value,
- test(copy->from_field->flags & UNSIGNED_FLAG));
+ MY_TEST(copy->from_field->flags & UNSIGNED_FLAG));
}
static void do_field_real(Copy_field *copy)
@@ -911,5 +911,5 @@ int field_conv(Field *to,Field *from)
*/
return to->store(result.c_ptr_quick(),result.length(),from->charset());
}
- return to->store(from->val_int(), test(from->flags & UNSIGNED_FLAG));
+ return to->store(from->val_int(), MY_TEST(from->flags & UNSIGNED_FLAG));
}
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 6fe3c826913..5b484076bca 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -3421,7 +3421,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
m_mode= mode;
m_open_test_lock= test_if_locked;
m_part_field_array= m_part_info->full_part_field_array;
- if (get_from_handler_file(name, &table->mem_root, test(m_is_clone_of)))
+ if (get_from_handler_file(name, &table->mem_root, MY_TEST(m_is_clone_of)))
DBUG_RETURN(error);
name_buffer_ptr= m_name_buffer_ptr;
if (populate_partition_name_hash())
@@ -5694,7 +5694,7 @@ int ha_partition::read_range_first(const key_range *start_key,
m_start_key.key= NULL;
m_index_scan_type= partition_read_range;
- error= common_index_read(m_rec0, test(start_key));
+ error= common_index_read(m_rec0, MY_TEST(start_key));
DBUG_RETURN(error);
}
@@ -7689,8 +7689,8 @@ uint32 ha_partition::calculate_key_hash_value(Field **field_array)
ulong nr1= 1;
ulong nr2= 4;
bool use_51_hash;
- use_51_hash= test((*field_array)->table->part_info->key_algorithm ==
- partition_info::KEY_ALGORITHM_51);
+ use_51_hash= MY_TEST((*field_array)->table->part_info->key_algorithm ==
+ partition_info::KEY_ALGORITHM_51);
do
{
diff --git a/sql/handler.cc b/sql/handler.cc
index 5b1e0ed58d1..e1a8b97874b 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -2469,7 +2469,7 @@ int handler::ha_open(TABLE *table_arg, const char *name, int mode,
cached_table_flags= table_flags();
}
reset_statistics();
- internal_tmp_table= test(test_if_locked & HA_OPEN_INTERNAL_TABLE);
+ internal_tmp_table= MY_TEST(test_if_locked & HA_OPEN_INTERNAL_TABLE);
DBUG_RETURN(error);
}
diff --git a/sql/handler.h b/sql/handler.h
index ffb12d11648..d255c0543a9 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -3940,7 +3940,7 @@ static inline const char *ha_resolve_storage_engine_name(const handlerton *db_ty
static inline bool ha_check_storage_engine_flag(const handlerton *db_type, uint32 flag)
{
- return db_type == NULL ? FALSE : test(db_type->flags & flag);
+ return db_type == NULL ? FALSE : MY_TEST(db_type->flags & flag);
}
static inline bool ha_storage_engine_is_enabled(const handlerton *db_type)
diff --git a/sql/item.cc b/sql/item.cc
index 1295902c1cd..191857413c2 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -852,7 +852,7 @@ void Item_ident::cleanup()
table_name= orig_table_name;
field_name= orig_field_name;
/* Store if this Item was depended */
- can_be_depended= test(depended_from);
+ can_be_depended= MY_TEST(depended_from);
DBUG_VOID_RETURN;
}
@@ -2428,7 +2428,7 @@ void Item_field::set_field(Field *field_par)
field_name= field_par->field_name;
db_name= field_par->table->s->db.str;
alias_name_used= field_par->table->alias_name_used;
- unsigned_flag=test(field_par->flags & UNSIGNED_FLAG);
+ unsigned_flag= MY_TEST(field_par->flags & UNSIGNED_FLAG);
collation.set(field_par->charset(), field_par->derivation(),
field_par->repertoire());
fix_char_length(field_par->char_length());
diff --git a/sql/item.h b/sql/item.h
index f0986e3728d..de005c459ce 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1462,7 +1462,7 @@ public:
{
if (is_expensive_cache < 0)
is_expensive_cache= walk(&Item::is_expensive_processor, 0, (uchar*)0);
- return test(is_expensive_cache);
+ return MY_TEST(is_expensive_cache);
}
virtual Field::geometry_type get_geometry_type() const
{ return Field::GEOM_GEOMETRY; };
@@ -2400,7 +2400,7 @@ public:
virtual void print(String *str, enum_query_type query_type);
Item_num *neg() { value= -value; return this; }
uint decimal_precision() const
- { return (uint)(max_length - test(value < 0)); }
+ { return (uint) (max_length - MY_TEST(value < 0)); }
bool eq(const Item *, bool binary_cmp) const;
bool check_partition_func_processor(uchar *bool_arg) { return FALSE;}
bool check_vcol_func_processor(uchar *arg) { return FALSE;}
@@ -4225,7 +4225,7 @@ public:
virtual void store(Item *item);
virtual bool cache_value()= 0;
bool basic_const_item() const
- { return test(example && example->basic_const_item());}
+ { return MY_TEST(example && example->basic_const_item()); }
virtual void clear() { null_value= TRUE; value_cached= FALSE; }
bool is_null() { return null_value; }
virtual bool is_expensive()
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 5852108dc43..4b9eb37488e 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -503,7 +503,7 @@ static bool convert_const_to_int(THD *thd, Item_field *field_item,
if (0 == field_cmp)
{
Item *tmp= new Item_int_with_ref(field->val_int(), *item,
- test(field->flags & UNSIGNED_FLAG));
+ MY_TEST(field->flags & UNSIGNED_FLAG));
if (tmp)
thd->change_item_tree(item, tmp);
result= 1; // Item was replaced
@@ -1044,8 +1044,8 @@ int Arg_comparator::compare_e_string()
res1= (*a)->val_str(&value1);
res2= (*b)->val_str(&value2);
if (!res1 || !res2)
- return test(res1 == res2);
- return test(sortcmp(res1, res2, cmp_collation.collation) == 0);
+ return MY_TEST(res1 == res2);
+ return MY_TEST(sortcmp(res1, res2, cmp_collation.collation) == 0);
}
@@ -1055,8 +1055,8 @@ int Arg_comparator::compare_e_binary_string()
res1= (*a)->val_str(&value1);
res2= (*b)->val_str(&value2);
if (!res1 || !res2)
- return test(res1 == res2);
- return test(stringcmp(res1, res2) == 0);
+ return MY_TEST(res1 == res2);
+ return MY_TEST(stringcmp(res1, res2) == 0);
}
@@ -1111,8 +1111,8 @@ int Arg_comparator::compare_e_real()
double val1= (*a)->val_real();
double val2= (*b)->val_real();
if ((*a)->null_value || (*b)->null_value)
- return test((*a)->null_value && (*b)->null_value);
- return test(val1 == val2);
+ return MY_TEST((*a)->null_value && (*b)->null_value);
+ return MY_TEST(val1 == val2);
}
int Arg_comparator::compare_e_decimal()
@@ -1121,8 +1121,8 @@ int Arg_comparator::compare_e_decimal()
my_decimal *val1= (*a)->val_decimal(&decimal1);
my_decimal *val2= (*b)->val_decimal(&decimal2);
if ((*a)->null_value || (*b)->null_value)
- return test((*a)->null_value && (*b)->null_value);
- return test(my_decimal_cmp(val1, val2) == 0);
+ return MY_TEST((*a)->null_value && (*b)->null_value);
+ return MY_TEST(my_decimal_cmp(val1, val2) == 0);
}
@@ -1160,8 +1160,8 @@ int Arg_comparator::compare_e_real_fixed()
double val1= (*a)->val_real();
double val2= (*b)->val_real();
if ((*a)->null_value || (*b)->null_value)
- return test((*a)->null_value && (*b)->null_value);
- return test(val1 == val2 || fabs(val1 - val2) < precision);
+ return MY_TEST((*a)->null_value && (*b)->null_value);
+ return MY_TEST(val1 == val2 || fabs(val1 - val2) < precision);
}
@@ -1272,8 +1272,8 @@ int Arg_comparator::compare_e_int()
longlong val1= (*a)->val_int();
longlong val2= (*b)->val_int();
if ((*a)->null_value || (*b)->null_value)
- return test((*a)->null_value && (*b)->null_value);
- return test(val1 == val2);
+ return MY_TEST((*a)->null_value && (*b)->null_value);
+ return MY_TEST(val1 == val2);
}
/**
@@ -1284,8 +1284,8 @@ int Arg_comparator::compare_e_int_diff_signedness()
longlong val1= (*a)->val_int();
longlong val2= (*b)->val_int();
if ((*a)->null_value || (*b)->null_value)
- return test((*a)->null_value && (*b)->null_value);
- return (val1 >= 0) && test(val1 == val2);
+ return MY_TEST((*a)->null_value && (*b)->null_value);
+ return (val1 >= 0) && MY_TEST(val1 == val2);
}
int Arg_comparator::compare_row()
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index a0d9b7c20fa..6159014a10c 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -388,7 +388,7 @@ public:
Item_func::print_op(str, query_type);
}
- bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); }
+ bool is_null() { return MY_TEST(args[0]->is_null() || args[1]->is_null()); }
bool is_bool_func() { return 1; }
CHARSET_INFO *compare_collation() { return cmp.cmp_collation.collation; }
uint decimal_precision() const { return 1; }
@@ -874,7 +874,7 @@ public:
/* Compare values number pos1 and pos2 for equality */
bool compare_elems(uint pos1, uint pos2)
{
- return test(compare(collation, base + pos1*size, base + pos2*size));
+ return MY_TEST(compare(collation, base + pos1 * size, base + pos2 * size));
}
virtual Item_result result_type()= 0;
};
@@ -1838,7 +1838,7 @@ public:
bool contains(Field *field);
Item* get_first(struct st_join_table *context, Item *field);
/** Get number of field items / references to field items in this object */
- uint n_field_items() { return equal_items.elements-test(with_const); }
+ uint n_field_items() { return equal_items.elements - MY_TEST(with_const); }
void merge(Item_equal *item);
bool merge_with_check(Item_equal *equal_item, bool save_merged);
void merge_into_list(List<Item_equal> *list, bool save_merged,
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 9918b7c40f6..2fe47406b9e 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2615,7 +2615,8 @@ void Item_func_round::fix_length_and_dec()
case INT_RESULT:
if ((!decimals_to_set && truncate) || (args[0]->decimal_precision() < DECIMAL_LONGLONG_DIGITS))
{
- int length_can_increase= test(!truncate && (val1 < 0) && !val1_unsigned);
+ int length_can_increase= MY_TEST(!truncate && (val1 < 0) &&
+ !val1_unsigned);
max_length= args[0]->max_length + length_can_increase;
/* Here we can keep INT_RESULT */
cached_result_type= INT_RESULT;
@@ -4617,7 +4618,7 @@ longlong Item_func_sleep::val_int()
mysql_cond_destroy(&cond);
- return test(!error); // Return 1 killed
+ return MY_TEST(!error); // Return 1 killed
}
@@ -6684,7 +6685,7 @@ void Item_func_sp::fix_length_and_dec()
max_length= sp_result_field->field_length;
collation.set(sp_result_field->charset());
maybe_null= 1;
- unsigned_flag= test(sp_result_field->flags & UNSIGNED_FLAG);
+ unsigned_flag= MY_TEST(sp_result_field->flags & UNSIGNED_FLAG);
DBUG_VOID_RETURN;
}
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index 665c941414c..aeef3e42817 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -244,7 +244,7 @@ String *Item_func_centroid::val_str(String *str)
srid= uint4korr(swkb->ptr());
str->q_append(srid);
- return (null_value= test(geom->centroid(str))) ? 0 : str;
+ return (null_value= MY_TEST(geom->centroid(str))) ? 0 : str;
}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 1947dae0c50..e426489d0e9 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -4784,7 +4784,7 @@ String *Item_dyncol_get::val_str(String *str_result)
goto null;
case DYN_COL_INT:
case DYN_COL_UINT:
- str_result->set_int(val.x.long_value, test(val.type == DYN_COL_UINT),
+ str_result->set_int(val.x.long_value, MY_TEST(val.type == DYN_COL_UINT),
&my_charset_latin1);
break;
case DYN_COL_DOUBLE:
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 88cae108039..35d137c4357 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -3399,7 +3399,7 @@ bool subselect_union_engine::is_executed() const
bool subselect_union_engine::no_rows()
{
/* Check if we got any rows when reading UNION result from temp. table: */
- return test(!unit->fake_select_lex->join->send_records);
+ return MY_TEST(!unit->fake_select_lex->join->send_records);
}
@@ -5241,8 +5241,8 @@ int subselect_hash_sj_engine::exec()
/* The subquery should be optimized, and materialized only once. */
DBUG_ASSERT(materialize_join->optimized && !is_materialized);
materialize_join->exec();
- if ((res= test(materialize_join->error || thd->is_fatal_error ||
- thd->is_error())))
+ if ((res= MY_TEST(materialize_join->error || thd->is_fatal_error ||
+ thd->is_error())))
goto err;
/*
@@ -5325,7 +5325,7 @@ int subselect_hash_sj_engine::exec()
count_pm_keys= count_partial_match_columns - count_null_only_columns +
(nn_key_parts ? 1 : 0);
- choose_partial_match_strategy(test(nn_key_parts),
+ choose_partial_match_strategy(MY_TEST(nn_key_parts),
has_covering_null_row,
&partial_match_key_parts);
DBUG_ASSERT(strategy == PARTIAL_MATCH_MERGE ||
@@ -6300,7 +6300,7 @@ bool subselect_rowid_merge_engine::partial_match()
Do not add the non_null_key, since it was already processed above.
*/
bitmap_clear_all(&matching_outer_cols);
- for (uint i= test(non_null_key); i < merge_keys_count; i++)
+ for (uint i= MY_TEST(non_null_key); i < merge_keys_count; i++)
{
DBUG_ASSERT(merge_keys[i]->get_column_count() == 1);
if (merge_keys[i]->get_search_key(0)->null_value)
@@ -6317,7 +6317,7 @@ bool subselect_rowid_merge_engine::partial_match()
nullable columns (above we guarantee there is a match for the non-null
coumns), the result is UNKNOWN.
*/
- if (count_nulls_in_search_key == merge_keys_count - test(non_null_key))
+ if (count_nulls_in_search_key == merge_keys_count - MY_TEST(non_null_key))
{
res= TRUE;
goto end;
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index e806f45041a..b8e929f3fc5 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -566,7 +566,7 @@ public:
if ( pushed_cond_guards)
pushed_cond_guards[i]= v;
}
- bool have_guarded_conds() { return test(pushed_cond_guards); }
+ bool have_guarded_conds() { return MY_TEST(pushed_cond_guards); }
Item_func_not_all *upper_item; // point on NOT/NOP before ALL/SOME subquery
@@ -621,7 +621,7 @@ public:
int get_identifier();
bool test_strategy(uchar strategy)
- { return test(in_strategy & strategy); }
+ { return MY_TEST(in_strategy & strategy); }
/**
Test that the IN strategy was chosen for execution. This is so
@@ -641,7 +641,7 @@ public:
}
bool is_set_strategy()
- { return test(in_strategy & SUBS_STRATEGY_CHOSEN); }
+ { return MY_TEST(in_strategy & SUBS_STRATEGY_CHOSEN); }
bool has_strategy()
{ return in_strategy != SUBS_NOT_TRANSFORMED; }
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 40929c12e3c..b76474e6346 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1077,7 +1077,7 @@ longlong Item_func_weekday::val_int()
return (longlong) calc_weekday(calc_daynr(ltime.year, ltime.month,
ltime.day),
- odbc_type) + test(odbc_type);
+ odbc_type) + MY_TEST(odbc_type);
}
void Item_func_dayname::fix_length_and_dec()
diff --git a/sql/key.cc b/sql/key.cc
index 8ba3d48e8dc..2df9c7e0cb5 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -126,8 +126,8 @@ void key_copy(uchar *to_key, uchar *from_record, KEY *key_info,
{
if (key_part->null_bit)
{
- *to_key++= test(from_record[key_part->null_offset] &
- key_part->null_bit);
+ *to_key++= MY_TEST(from_record[key_part->null_offset] &
+ key_part->null_bit);
key_length--;
if (to_key[-1])
{
@@ -300,8 +300,8 @@ bool key_cmp_if_same(TABLE *table,const uchar *key,uint idx,uint key_length)
if (key_part->null_bit)
{
- if (*key != test(table->record[0][key_part->null_offset] &
- key_part->null_bit))
+ if (*key != MY_TEST(table->record[0][key_part->null_offset] &
+ key_part->null_bit))
return 1;
if (*key)
continue;
@@ -438,7 +438,7 @@ void key_unpack(String *to, TABLE *table, KEY *key)
}
}
field_unpack(to, key_part->field, table->record[0], key_part->length,
- test(key_part->key_part_flag & HA_PART_KEY_SEG));
+ MY_TEST(key_part->key_part_flag & HA_PART_KEY_SEG));
}
dbug_tmp_restore_column_map(table->read_set, old_map);
DBUG_VOID_RETURN;
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 29732b28841..ad9336712cf 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -749,7 +749,7 @@ static void print_set_option(IO_CACHE* file, uint32 bits_changed,
{
if (*need_comma)
my_b_write(file, ", ", 2);
- my_b_printf(file,"%s=%d", name, test(flags & option));
+ my_b_printf(file, "%s=%d", name, MY_TEST(flags & option));
*need_comma= 1;
}
}
@@ -1089,7 +1089,7 @@ my_bool Log_event::need_checksum()
(checksum_alg != BINLOG_CHECKSUM_ALG_OFF) :
((binlog_checksum_options != BINLOG_CHECKSUM_ALG_OFF) &&
(cache_type == Log_event::EVENT_NO_CACHE)) ?
- test(binlog_checksum_options) : FALSE);
+ MY_TEST(binlog_checksum_options) : FALSE);
/*
FD calls the methods before data_written has been calculated.
diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc
index 03023927a1d..0c35ac5b029 100644
--- a/sql/multi_range_read.cc
+++ b/sql/multi_range_read.cc
@@ -225,7 +225,7 @@ handler::multi_range_read_init(RANGE_SEQ_IF *seq_funcs, void *seq_init_param,
DBUG_ENTER("handler::multi_range_read_init");
mrr_iter= seq_funcs->init(seq_init_param, n_ranges, mode);
mrr_funcs= *seq_funcs;
- mrr_is_output_sorted= test(mode & HA_MRR_SORTED);
+ mrr_is_output_sorted= MY_TEST(mode & HA_MRR_SORTED);
mrr_have_range= FALSE;
DBUG_RETURN(0);
}
@@ -292,7 +292,7 @@ scan_it_again:
&mrr_cur_range.start_key : 0,
mrr_cur_range.end_key.keypart_map ?
&mrr_cur_range.end_key : 0,
- test(mrr_cur_range.range_flag & EQ_RANGE),
+ MY_TEST(mrr_cur_range.range_flag & EQ_RANGE),
mrr_is_output_sorted);
if (result != HA_ERR_END_OF_FILE)
break;
@@ -549,12 +549,12 @@ int Mrr_ordered_index_reader::init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
keypar= *key_par_arg;
KEY *key_info= &file->get_table()->key_info[file->active_index];
- keypar.index_ranges_unique= test(key_info->flags & HA_NOSAME &&
- key_info->user_defined_key_parts ==
- my_count_bits(keypar.key_tuple_map));
+ keypar.index_ranges_unique= MY_TEST(key_info->flags & HA_NOSAME &&
+ key_info->user_defined_key_parts ==
+ my_count_bits(keypar.key_tuple_map));
mrr_iter= seq_funcs->init(seq_init_param, n_ranges, mode);
- is_mrr_assoc= !test(mode & HA_MRR_NO_ASSOCIATION);
+ is_mrr_assoc= !MY_TEST(mode & HA_MRR_NO_ASSOCIATION);
mrr_funcs= *seq_funcs;
source_exhausted= FALSE;
if (support_scan_interruptions)
@@ -578,7 +578,7 @@ int Mrr_ordered_rndpos_reader::init(handler *h_arg,
file= h_arg;
index_reader= index_reader_arg;
rowid_buffer= buf;
- is_mrr_assoc= !test(mode & HA_MRR_NO_ASSOCIATION);
+ is_mrr_assoc= !MY_TEST(mode & HA_MRR_NO_ASSOCIATION);
index_reader_exhausted= FALSE;
index_reader_needs_refill= TRUE;
return 0;
@@ -817,7 +817,7 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
has not been called, so set the owner handler here as well.
*/
primary_file= h_arg;
- is_mrr_assoc= !test(mode & HA_MRR_NO_ASSOCIATION);
+ is_mrr_assoc= !MY_TEST(mode & HA_MRR_NO_ASSOCIATION);
strategy_exhausted= FALSE;
@@ -867,7 +867,7 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
if (do_sort_keys)
{
/* Pre-calculate some parameters of key sorting */
- keypar.use_key_pointers= test(mode & HA_MRR_MATERIALIZED_KEYS);
+ keypar.use_key_pointers= MY_TEST(mode & HA_MRR_MATERIALIZED_KEYS);
seq_funcs->get_key_info(seq_init_param, &keypar.key_tuple_length,
&keypar.key_tuple_map);
keypar.key_size_in_keybuf= keypar.use_key_pointers?
@@ -996,7 +996,7 @@ use_default_impl:
so small that it can accomodate one rowid and one index tuple)
*/
if ((res= primary_file->ha_rnd_end()) ||
- (res= primary_file->ha_index_init(keyno, test(mode & HA_MRR_SORTED))))
+ (res= primary_file->ha_index_init(keyno, MY_TEST(mode & HA_MRR_SORTED))))
{
DBUG_RETURN(res);
}
@@ -1521,10 +1521,10 @@ bool key_uses_partial_cols(TABLE_SHARE *share, uint keyno)
bool DsMrr_impl::check_cpk_scan(THD *thd, TABLE_SHARE *share, uint keyno,
uint mrr_flags)
{
- return test((mrr_flags & HA_MRR_SINGLE_POINT) &&
- keyno == share->primary_key &&
- primary_file->primary_key_is_clustered() &&
- optimizer_flag(thd, OPTIMIZER_SWITCH_MRR_SORT_KEYS));
+ return MY_TEST((mrr_flags & HA_MRR_SINGLE_POINT) &&
+ keyno == share->primary_key &&
+ primary_file->primary_key_is_clustered() &&
+ optimizer_flag(thd, OPTIMIZER_SWITCH_MRR_SORT_KEYS));
}
@@ -1561,8 +1561,8 @@ bool DsMrr_impl::choose_mrr_impl(uint keyno, ha_rows rows, uint *flags,
TABLE_SHARE *share= primary_file->get_table_share();
bool doing_cpk_scan= check_cpk_scan(thd, share, keyno, *flags);
- bool using_cpk= test(keyno == share->primary_key &&
- primary_file->primary_key_is_clustered());
+ bool using_cpk= MY_TEST(keyno == share->primary_key &&
+ primary_file->primary_key_is_clustered());
*flags &= ~HA_MRR_IMPLEMENTATION_FLAGS;
if (!optimizer_flag(thd, OPTIMIZER_SWITCH_MRR) ||
*flags & HA_MRR_INDEX_ONLY ||
@@ -1685,7 +1685,7 @@ bool DsMrr_impl::get_disk_sweep_mrr_cost(uint keynr, ha_rows rows, uint flags,
double index_read_cost;
elem_size= primary_file->ref_length +
- sizeof(void*) * (!test(flags & HA_MRR_NO_ASSOCIATION));
+ sizeof(void*) * (!MY_TEST(flags & HA_MRR_NO_ASSOCIATION));
max_buff_entries = *buffer_size / elem_size;
if (!max_buff_entries)
diff --git a/sql/my_apc.h b/sql/my_apc.h
index 4643e641ff1..dfeef5eb8ac 100644
--- a/sql/my_apc.h
+++ b/sql/my_apc.h
@@ -62,7 +62,7 @@ public:
*/
inline bool have_apc_requests()
{
- return test(apc_calls);
+ return MY_TEST(apc_calls);
}
inline bool is_enabled() { return enabled; }
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 75495491980..13b1532f438 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -8359,7 +8359,7 @@ mysqld_get_one_option(int optid,
opt_myisam_log=1;
break;
case (int) OPT_BIN_LOG:
- opt_bin_log= test(argument != disabled_my_option);
+ opt_bin_log= MY_TEST(argument != disabled_my_option);
opt_bin_log_used= 1;
break;
case (int) OPT_LOG_BASENAME:
@@ -8865,7 +8865,7 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
Set some global variables from the global_system_variables
In most cases the global variables will not be used
*/
- my_disable_locking= myisam_single_user= test(opt_external_locking == 0);
+ my_disable_locking= myisam_single_user= MY_TEST(opt_external_locking == 0);
my_default_record_cache_size=global_system_variables.read_buff_size;
/*
@@ -8922,8 +8922,8 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
#endif
global_system_variables.engine_condition_pushdown=
- test(global_system_variables.optimizer_switch &
- OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN);
+ MY_TEST(global_system_variables.optimizer_switch &
+ OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN);
opt_readonly= read_only;
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index b7ee46361ae..546542fa207 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -144,7 +144,7 @@ my_bool my_net_init(NET *net, Vio* vio, uint my_flags)
net->net_skip_rest_factor= 0;
net->last_errno=0;
net->unused= 0;
- net->thread_specific_malloc= test(my_flags & MY_THREAD_SPECIFIC);
+ net->thread_specific_malloc= MY_TEST(my_flags & MY_THREAD_SPECIFIC);
#ifdef MYSQL_SERVER
net->extension= NULL;
#endif
@@ -267,7 +267,7 @@ static int net_data_is_ready(my_socket sd)
if ((res= select((int) (sd + 1), &sfds, NULL, NULL, &tv)) < 0)
return 0;
else
- return test(res ? FD_ISSET(sd, &sfds) : 0);
+ return MY_TEST(res ? FD_ISSET(sd, &sfds) : 0);
#endif /* HAVE_POLL */
}
@@ -360,8 +360,8 @@ my_bool net_flush(NET *net)
DBUG_ENTER("net_flush");
if (net->buff != net->write_pos)
{
- error=test(net_real_write(net, net->buff,
- (size_t) (net->write_pos - net->buff)));
+ error= MY_TEST(net_real_write(net, net->buff,
+ (size_t) (net->write_pos - net->buff)));
net->write_pos= net->buff;
}
/* Sync packet number if using compression */
@@ -424,7 +424,7 @@ my_bool my_net_write(NET *net, const uchar *packet, size_t len)
#ifndef DEBUG_DATA_PACKETS
DBUG_DUMP("packet_header", buff, NET_HEADER_SIZE);
#endif
- rc= test(net_write_buff(net,packet,len));
+ rc= MY_TEST(net_write_buff(net, packet, len));
MYSQL_NET_WRITE_DONE(rc);
return rc;
}
@@ -498,9 +498,9 @@ net_write_command(NET *net,uchar command,
}
int3store(buff,length);
buff[3]= (uchar) net->pkt_nr++;
- rc= test(net_write_buff(net, buff, header_size) ||
- (head_len && net_write_buff(net, header, head_len)) ||
- net_write_buff(net, packet, len) || net_flush(net));
+ rc= MY_TEST(net_write_buff(net, buff, header_size) ||
+ (head_len && net_write_buff(net, header, head_len)) ||
+ net_write_buff(net, packet, len) || net_flush(net));
MYSQL_NET_WRITE_DONE(rc);
DBUG_RETURN(rc);
}
diff --git a/sql/opt_index_cond_pushdown.cc b/sql/opt_index_cond_pushdown.cc
index fb55aea1968..be33e46bf94 100644
--- a/sql/opt_index_cond_pushdown.cc
+++ b/sql/opt_index_cond_pushdown.cc
@@ -205,7 +205,7 @@ Item *make_cond_for_index(Item *cond, TABLE *table, uint keyno,
new_cond->argument_list()->push_back(fix);
used_tables|= fix->used_tables();
}
- if (test(item->marker == ICP_COND_USES_INDEX_ONLY))
+ if (MY_TEST(item->marker == ICP_COND_USES_INDEX_ONLY))
{
n_marked++;
item->marker= 0;
@@ -238,7 +238,7 @@ Item *make_cond_for_index(Item *cond, TABLE *table, uint keyno,
if (!fix)
return (COND*) 0;
new_cond->argument_list()->push_back(fix);
- if (test(item->marker == ICP_COND_USES_INDEX_ONLY))
+ if (MY_TEST(item->marker == ICP_COND_USES_INDEX_ONLY))
{
n_marked++;
item->marker= 0;
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 1ced92952c2..d41d6f7568a 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -408,7 +408,7 @@ public:
new_max=arg->max_value; flag_max=arg->max_flag;
}
return new SEL_ARG(field, part, new_min, new_max, flag_min, flag_max,
- test(maybe_flag && arg->maybe_flag));
+ MY_TEST(maybe_flag && arg->maybe_flag));
}
SEL_ARG *clone_first(SEL_ARG *arg)
{ // min <= X < arg->min
@@ -3223,7 +3223,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
Assume that if the user is using 'limit' we will only need to scan
limit rows if we are using a key
*/
- DBUG_RETURN(records ? test(quick) : -1);
+ DBUG_RETURN(records ? MY_TEST(quick) : -1);
}
/****************************************************************************
@@ -3782,8 +3782,8 @@ typedef struct st_part_prune_param
int last_subpart_partno; /* Same as above for supartitioning */
/*
- is_part_keypart[i] == test(keypart #i in partitioning index is a member
- used in partitioning)
+ is_part_keypart[i] == MY_TEST(keypart #i in partitioning index is a member
+ used in partitioning)
Used to maintain current values of cur_part_fields and cur_subpart_fields
*/
my_bool *is_part_keypart;
@@ -3974,7 +3974,7 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond)
res == 1 => some used partitions => retval=FALSE
res == -1 - we jump over this line to all_used:
*/
- retval= test(!res);
+ retval= MY_TEST(!res);
goto end;
all_used:
@@ -4607,7 +4607,7 @@ process_next_key_part:
ppar->mark_full_partition_used(ppar->part_info, part_id);
found= TRUE;
}
- res= test(found);
+ res= MY_TEST(found);
}
/*
Restore the "used partitions iterator" to the default setting that
@@ -5649,7 +5649,7 @@ bool prepare_search_best_index_intersect(PARAM *param,
}
}
- i= n_index_scans - test(cpk_scan != NULL) + 1;
+ i= n_index_scans - MY_TEST(cpk_scan != NULL) + 1;
if (!(common->search_scans =
(INDEX_SCAN_INFO **) alloc_root (param->mem_root,
@@ -5719,7 +5719,7 @@ bool prepare_search_best_index_intersect(PARAM *param,
if (!(common->best_intersect=
(INDEX_SCAN_INFO **) alloc_root (param->mem_root,
sizeof(INDEX_SCAN_INFO *) *
- (i + test(cpk_scan != NULL)))))
+ (i + MY_TEST(cpk_scan != NULL)))))
return TRUE;
size_t calc_cost_buff_size=
@@ -6571,8 +6571,8 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info,
SEL_ARG *sel_arg, *tuple_arg= NULL;
key_part_map keypart_map= 0;
bool cur_covered;
- bool prev_covered= test(bitmap_is_set(&info->covered_fields,
- key_part->fieldnr-1));
+ bool prev_covered= MY_TEST(bitmap_is_set(&info->covered_fields,
+ key_part->fieldnr - 1));
key_range min_range;
key_range max_range;
min_range.key= key_val;
@@ -6586,8 +6586,8 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info,
sel_arg= sel_arg->next_key_part)
{
DBUG_PRINT("info",("sel_arg step"));
- cur_covered= test(bitmap_is_set(&info->covered_fields,
- key_part[sel_arg->part].fieldnr-1));
+ cur_covered= MY_TEST(bitmap_is_set(&info->covered_fields,
+ key_part[sel_arg->part].fieldnr - 1));
if (cur_covered != prev_covered)
{
/* create (part1val, ..., part{n-1}val) tuple. */
@@ -10681,12 +10681,12 @@ get_quick_select(PARAM *param,uint idx,SEL_ARG *key_tree, uint mrr_flags,
if (param->table->key_info[param->real_keynr[idx]].flags & HA_SPATIAL)
quick=new QUICK_RANGE_SELECT_GEOM(param->thd, param->table,
param->real_keynr[idx],
- test(parent_alloc),
+ MY_TEST(parent_alloc),
parent_alloc, &create_err);
else
quick=new QUICK_RANGE_SELECT(param->thd, param->table,
param->real_keynr[idx],
- test(parent_alloc), NULL, &create_err);
+ MY_TEST(parent_alloc), NULL, &create_err);
if (quick)
{
@@ -11681,7 +11681,7 @@ int QUICK_RANGE_SELECT::get_next_prefix(uint prefix_length,
result= file->read_range_first(last_range->min_keypart_map ? &start_key : 0,
last_range->max_keypart_map ? &end_key : 0,
- test(last_range->flag & EQ_RANGE),
+ MY_TEST(last_range->flag & EQ_RANGE),
TRUE);
if (last_range->flag == (UNIQUE_RANGE | EQ_RANGE))
last_range= 0; // Stop searching
diff --git a/sql/opt_range.h b/sql/opt_range.h
index 4f2ab6df60d..1ca245ea420 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -1004,7 +1004,7 @@ class SQL_SELECT :public Sql_alloc {
*/
inline int skip_record(THD *thd)
{
- int rc= test(!cond || cond->val_int());
+ int rc= MY_TEST(!cond || cond->val_int());
if (thd->is_error())
rc= -1;
return rc;
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 8c38a2d4eb9..4079298f6c0 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -1082,7 +1082,7 @@ bool convert_join_subqueries_to_semijoins(JOIN *join)
if (convert_join_subqueries_to_semijoins(child_join))
DBUG_RETURN(TRUE);
in_subq->sj_convert_priority=
- test(in_subq->emb_on_expr_nest != NO_JOIN_NEST) * MAX_TABLES * 2 +
+ MY_TEST(in_subq->emb_on_expr_nest != NO_JOIN_NEST) * MAX_TABLES * 2 +
in_subq->is_correlated * MAX_TABLES + child_join->outer_tables;
}
@@ -2384,7 +2384,7 @@ bool find_eq_ref_candidate(TABLE *table, table_map sj_inner_tables)
if (!is_excluded_key)
{
keyinfo= table->key_info + key;
- is_excluded_key= !test(keyinfo->flags & HA_NOSAME);
+ is_excluded_key= !MY_TEST(keyinfo->flags & HA_NOSAME);
}
if (!is_excluded_key)
{
@@ -2471,8 +2471,8 @@ bool is_multiple_semi_joins(JOIN *join, POSITION *prefix, uint idx, table_map in
if ((emb_sj_nest= prefix[i].table->emb_sj_nest))
{
if (inner_tables & emb_sj_nest->sj_inner_tables)
- return !test(inner_tables == (emb_sj_nest->sj_inner_tables &
- ~join->const_table_map));
+ return !MY_TEST(inner_tables == (emb_sj_nest->sj_inner_tables &
+ ~join->const_table_map));
}
}
return FALSE;
@@ -3206,9 +3206,9 @@ at_sjmat_pos(const JOIN *join, table_map remaining_tables, const JOIN_TAB *tab,
if (join->positions[idx - i].table->emb_sj_nest != tab->emb_sj_nest)
return NULL;
}
- *loose_scan= test(remaining_tables & ~tab->table->map &
- (emb_sj_nest->sj_inner_tables |
- emb_sj_nest->nested_join->sj_depends_on));
+ *loose_scan= MY_TEST(remaining_tables & ~tab->table->map &
+ (emb_sj_nest->sj_inner_tables |
+ emb_sj_nest->nested_join->sj_depends_on));
if (*loose_scan && !emb_sj_nest->sj_subq_pred->sjm_scan_allowed)
return NULL;
else
@@ -3594,12 +3594,12 @@ bool setup_sj_materialization_part2(JOIN_TAB *sjm_tab)
for (i= 0; i < tmp_key_parts; i++, cur_key_part++, ref_key++)
{
tab_ref->items[i]= emb_sj_nest->sj_subq_pred->left_expr->element_index(i);
- int null_count= test(cur_key_part->field->real_maybe_null());
+ int null_count= MY_TEST(cur_key_part->field->real_maybe_null());
*ref_key= new store_key_item(thd, cur_key_part->field,
/* TODO:
the NULL byte is taken into account in
cur_key_part->store_length, so instead of
- cur_ref_buff + test(maybe_null), we could
+ cur_ref_buff + MY_TEST(maybe_null), we could
use that information instead.
*/
cur_ref_buff + null_count,
@@ -3828,7 +3828,7 @@ static bool is_cond_sj_in_equality(Item *item)
((Item_func*)item)->functype()== Item_func::EQ_FUNC)
{
Item_func_eq *item_eq= (Item_func_eq*)item;
- return test(item_eq->in_equality_no != UINT_MAX);
+ return MY_TEST(item_eq->in_equality_no != UINT_MAX);
}
return FALSE;
}
@@ -4100,7 +4100,7 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
{
DBUG_PRINT("info",("Creating group key in temporary table"));
share->keys=1;
- share->uniques= test(using_unique_constraint);
+ share->uniques= MY_TEST(using_unique_constraint);
table->key_info=keyinfo;
keyinfo->key_part=key_part_info;
keyinfo->flags=HA_NOSAME;
diff --git a/sql/opt_subselect.h b/sql/opt_subselect.h
index 6ed077dcfcb..dabf2f95bcc 100644
--- a/sql/opt_subselect.h
+++ b/sql/opt_subselect.h
@@ -168,7 +168,7 @@ public:
}
}
- bool have_a_case() { return test(handled_sj_equalities); }
+ bool have_a_case() { return MY_TEST(handled_sj_equalities); }
void check_ref_access_part1(JOIN_TAB *s, uint key, KEYUSE *start_key,
table_map found_part)
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index d4fc458c948..4e8fcefa6d2 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -295,9 +295,9 @@ int opt_sum_query(THD *thd,
if (!(tl->table->file->ha_table_flags() & HA_STATS_RECORDS_IS_EXACT) ||
tl->schema_table)
{
- maybe_exact_count&= test(!tl->schema_table &&
- (tl->table->file->ha_table_flags() &
- HA_HAS_RECORDS));
+ maybe_exact_count&= MY_TEST(!tl->schema_table &&
+ (tl->table->file->ha_table_flags() &
+ HA_HAS_RECORDS));
is_exact_count= FALSE;
count= 1; // ensure count != 0
}
@@ -361,7 +361,7 @@ int opt_sum_query(THD *thd,
case Item_sum::MIN_FUNC:
case Item_sum::MAX_FUNC:
{
- int is_max= test(item_sum->sum_func() == Item_sum::MAX_FUNC);
+ int is_max= MY_TEST(item_sum->sum_func() == Item_sum::MAX_FUNC);
/*
If MIN/MAX(expr) is the first part of a key or if all previous
parts of the key is found in the COND, then we can use
@@ -658,7 +658,7 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
DBUG_RETURN(FALSE);
}
if (!(cond->used_tables() & field->table->map) &&
- test(cond->used_tables() & ~PSEUDO_TABLE_BITS))
+ MY_TEST(cond->used_tables() & ~PSEUDO_TABLE_BITS))
{
/* Condition doesn't restrict the used table */
DBUG_RETURN(!cond->const_item());
@@ -811,7 +811,7 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
Item *value= args[between && max_fl ? 2 : 1];
value->save_in_field_no_warnings(part->field, 1);
if (part->null_bit)
- *key_ptr++= (uchar) test(part->field->is_null());
+ *key_ptr++= (uchar) MY_TEST(part->field->is_null());
part->field->get_key_image(key_ptr, part->length, Field::itRAW);
}
if (is_field_part)
@@ -831,7 +831,7 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
else if (eq_type)
{
if ((!is_null && !cond->val_int()) ||
- (is_null && !test(part->field->is_null())))
+ (is_null && !MY_TEST(part->field->is_null())))
DBUG_RETURN(FALSE); // Impossible test
}
else if (is_field_part)
diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc
index 9b58f5f3126..2ef565517b5 100644
--- a/sql/opt_table_elimination.cc
+++ b/sql/opt_table_elimination.cc
@@ -356,7 +356,7 @@ public:
bound.
*/
void touch() { unbound_args--; }
- bool is_applicable() { return !test(unbound_args); }
+ bool is_applicable() { return !MY_TEST(unbound_args); }
/* Iteration over values that */
typedef char *Iterator;
@@ -1072,7 +1072,7 @@ bool Dep_analysis_context::setup_equality_modules_deps(List<Dep_module>
else
{
/* It's a multi-equality */
- eq_mod->unbound_args= !test(eq_mod->expr);
+ eq_mod->unbound_args= !MY_TEST(eq_mod->expr);
List_iterator<Dep_value_field> it(*eq_mod->mult_equal_fields);
Dep_value_field* field_val;
while ((field_val= it++))
@@ -1398,7 +1398,7 @@ Dep_module_expr *merge_eq_mods(Dep_module_expr *start,
}
}
- if (fv->elements + test(old->expr) > 1)
+ if (fv->elements + MY_TEST(old->expr) > 1)
{
old->mult_equal_fields= fv;
old->level= and_level;
diff --git a/sql/password.c b/sql/password.c
index 22e0060abd2..7a3d8aafde3 100644
--- a/sql/password.c
+++ b/sql/password.c
@@ -510,7 +510,7 @@ check_scramble(const uchar *scramble_arg, const char *message,
/* now buf supposedly contains hash_stage1: so we can get hash_stage2 */
compute_sha1_hash(hash_stage2_reassured, (const char *) buf, SHA1_HASH_SIZE);
- return test(memcmp(hash_stage2, hash_stage2_reassured, SHA1_HASH_SIZE));
+ return MY_TEST(memcmp(hash_stage2, hash_stage2_reassured, SHA1_HASH_SIZE));
}
/*
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc
index fced238e334..7764400becb 100644
--- a/sql/rpl_mi.cc
+++ b/sql/rpl_mi.cc
@@ -547,7 +547,7 @@ file '%s')", fname);
mi->rli.is_relay_log_recovery= FALSE;
// now change cache READ -> WRITE - must do this before flush_master_info
reinit_io_cache(&mi->file, WRITE_CACHE, 0L, 0, 1);
- if ((error=test(flush_master_info(mi, TRUE, TRUE))))
+ if ((error= MY_TEST(flush_master_info(mi, TRUE, TRUE))))
sql_print_error("Failed to flush master info file");
mysql_mutex_unlock(&mi->data_lock);
DBUG_RETURN(error);
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 617ce2298b1..1c8a2a4d97c 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -668,7 +668,7 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list)
if ((error= var->check(thd)))
goto err;
}
- if (!(error= test(thd->is_error())))
+ if (!(error= MY_TEST(thd->is_error())))
{
it.rewind();
while ((var= it++))
diff --git a/sql/slave.cc b/sql/slave.cc
index f281bdf06a2..0e20609814a 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1049,8 +1049,8 @@ static bool sql_slave_killed(rpl_group_info *rgi)
DBUG_PRINT("info", ("modified_non_trans_table: %d OPTION_BEGIN: %d "
"OPTION_KEEP_LOG: %d is_in_group: %d",
thd->transaction.all.modified_non_trans_table,
- test(thd->variables.option_bits & OPTION_BEGIN),
- test(thd->variables.option_bits & OPTION_KEEP_LOG),
+ MY_TEST(thd->variables.option_bits & OPTION_BEGIN),
+ MY_TEST(thd->variables.option_bits & OPTION_KEEP_LOG),
rli->is_in_group()));
if (rli->abort_slave)
@@ -3223,7 +3223,7 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd,
"skipped because event skip counter was non-zero"
};
DBUG_PRINT("info", ("OPTION_BEGIN: %d IN_STMT: %d IN_TRANSACTION: %d",
- test(thd->variables.option_bits & OPTION_BEGIN),
+ MY_TEST(thd->variables.option_bits & OPTION_BEGIN),
rli->get_flag(Relay_log_info::IN_STMT),
rli->get_flag(Relay_log_info::IN_TRANSACTION)));
DBUG_PRINT("skip_event", ("%s event was %s",
diff --git a/sql/sp_head.h b/sql/sp_head.h
index 77adbf091b8..c1fb455e103 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -462,9 +462,10 @@ public:
else if (m_flags & HAS_SQLCOM_FLUSH)
my_error(ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0), "FLUSH");
- return test(m_flags &
- (CONTAINS_DYNAMIC_SQL|MULTI_RESULTS|HAS_SET_AUTOCOMMIT_STMT|
- HAS_COMMIT_OR_ROLLBACK|HAS_SQLCOM_RESET|HAS_SQLCOM_FLUSH));
+ return MY_TEST(m_flags &
+ (CONTAINS_DYNAMIC_SQL | MULTI_RESULTS |
+ HAS_SET_AUTOCOMMIT_STMT | HAS_COMMIT_OR_ROLLBACK |
+ HAS_SQLCOM_RESET | HAS_SQLCOM_FLUSH));
}
#ifndef DBUG_OFF
diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h
index ce692024d0d..c48025da93d 100644
--- a/sql/sp_rcontext.h
+++ b/sql/sp_rcontext.h
@@ -450,7 +450,7 @@ public:
int close(THD *thd);
my_bool is_open()
- { return test(server_side_cursor); }
+ { return MY_TEST(server_side_cursor); }
int fetch(THD *, List<sp_variable> *vars);
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index c35794f476c..f4ddc98521e 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2969,9 +2969,9 @@ static bool update_user_table(THD *thd, TABLE *table,
static bool test_if_create_new_users(THD *thd)
{
Security_context *sctx= thd->security_ctx;
- bool create_new_users= test(sctx->master_access & INSERT_ACL) ||
+ bool create_new_users= MY_TEST(sctx->master_access & INSERT_ACL) ||
(!opt_safe_user_create &&
- test(sctx->master_access & CREATE_USER_ACL));
+ MY_TEST(sctx->master_access & CREATE_USER_ACL));
if (!create_new_users)
{
TABLE_LIST tl;
@@ -5084,7 +5084,8 @@ static int update_role_table_columns(GRANT_TABLE *merged,
now those roles were dropped or had their privileges revoked).
we need to remove this GRANT_TABLE
*/
- DBUG_EXECUTE_IF("role_merge_stats", role_column_merges+= test(merged->cols););
+ DBUG_EXECUTE_IF("role_merge_stats",
+ role_column_merges+= MY_TEST(merged->cols););
my_hash_delete(&column_priv_hash,(uchar*) merged);
return 4;
}
@@ -5109,7 +5110,7 @@ static bool merge_role_table_and_column_privileges(ACL_ROLE *grantee,
const char *db, const char *tname, role_hash_t *rhash)
{
Dynamic_array<GRANT_TABLE *> grants;
- DBUG_ASSERT(test(db) == test(tname)); // both must be set, or neither
+ DBUG_ASSERT(MY_TEST(db) == MY_TEST(tname)); // both must be set, or neither
/*
first, collect table/column privileges granted to
@@ -5232,7 +5233,7 @@ static bool merge_role_routine_grant_privileges(ACL_ROLE *grantee,
{
ulong update_flags= 0;
- DBUG_ASSERT(test(db) == test(tname)); // both must be set, or neither
+ DBUG_ASSERT(MY_TEST(db) == MY_TEST(tname)); // both must be set, or neither
DBUG_EXECUTE_IF("role_merge_stats", role_routine_merges++;);
@@ -5530,8 +5531,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
else
error=replace_user_table(thd, tables[0].table, *Str,
0, revoke_grant, create_new_users,
- test(thd->variables.sql_mode &
- MODE_NO_AUTO_CREATE_USER));
+ MY_TEST(thd->variables.sql_mode &
+ MODE_NO_AUTO_CREATE_USER));
if (error)
{
result= TRUE; // Remember error
@@ -5738,8 +5739,8 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
/* Create user if needed */
error=replace_user_table(thd, tables[0].table, *Str,
0, revoke_grant, create_new_users,
- test(thd->variables.sql_mode &
- MODE_NO_AUTO_CREATE_USER));
+ MY_TEST(thd->variables.sql_mode &
+ MODE_NO_AUTO_CREATE_USER));
if (error)
{
result= TRUE; // Remember error
@@ -5885,7 +5886,8 @@ bool mysql_grant_role(THD *thd, List <LEX_USER> &list, bool revoke)
rolename= granted_role->user;
create_new_user= test_if_create_new_users(thd);
- no_auto_create_user= test(thd->variables.sql_mode & MODE_NO_AUTO_CREATE_USER);
+ no_auto_create_user= MY_TEST(thd->variables.sql_mode &
+ MODE_NO_AUTO_CREATE_USER);
TABLE_LIST tables[2];
tables[0].init_one_table(C_STRING_WITH_LEN("mysql"),
@@ -6203,8 +6205,8 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
else
if (replace_user_table(thd, tables[0].table, *Str,
(!db ? rights : 0), revoke_grant, create_new_users,
- test(thd->variables.sql_mode &
- MODE_NO_AUTO_CREATE_USER)))
+ MY_TEST(thd->variables.sql_mode &
+ MODE_NO_AUTO_CREATE_USER)))
result= -1;
else if (db)
{
@@ -6633,7 +6635,7 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
for (tl= tables; number-- ; tl= tl->next_global)
{
- sctx = test(tl->security_ctx) ? tl->security_ctx : thd->security_ctx;
+ sctx= MY_TEST(tl->security_ctx) ? tl->security_ctx : thd->security_ctx;
const ACL_internal_table_access *access=
get_cached_table_access(&tl->grant.m_internal,
@@ -6888,7 +6890,7 @@ bool check_column_grant_in_table_ref(THD *thd, TABLE_LIST * table_ref,
GRANT_INFO *grant;
const char *db_name;
const char *table_name;
- Security_context *sctx= test(table_ref->security_ctx) ?
+ Security_context *sctx= MY_TEST(table_ref->security_ctx) ?
table_ref->security_ctx : thd->security_ctx;
if (table_ref->view || table_ref->field_translation)
@@ -11474,7 +11476,7 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio,
db + passwd_len + 1 : 0;
if (passwd == NULL ||
- passwd + passwd_len + test(db) > (char *)net->read_pos + pkt_len)
+ passwd + passwd_len + MY_TEST(db) > (char*) net->read_pos + pkt_len)
return packet_error;
/* strlen() can't be easily deleted without changing protocol */
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index d9155b38066..fc506091dea 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -1218,7 +1218,7 @@ bool Sql_cmd_repair_table::execute(THD *thd)
thd->enable_slow_log= opt_log_slow_admin_statements;
res= mysql_admin_table(thd, first_table, &m_lex->check_opt, "repair",
TL_WRITE, 1,
- test(m_lex->check_opt.sql_flags & TT_USEFRM),
+ MY_TEST(m_lex->check_opt.sql_flags & TT_USEFRM),
HA_OPEN_FOR_REPAIR, &prepare_for_repair,
&handler::ha_repair, 0);
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index b0e121018fc..e70b02bec94 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1142,7 +1142,8 @@ bool close_temporary_tables(THD *thd)
/* We always quote db,table names though it is slight overkill */
if (found_user_tables &&
- !(was_quote_show= test(thd->variables.option_bits & OPTION_QUOTE_SHOW_CREATE)))
+ !(was_quote_show= MY_TEST(thd->variables.option_bits &
+ OPTION_QUOTE_SHOW_CREATE)))
{
thd->variables.option_bits |= OPTION_QUOTE_SHOW_CREATE;
}
@@ -7747,7 +7748,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
thd->lex->allow_sum_func= save_allow_sum_func;
thd->mark_used_columns= save_mark_used_columns;
DBUG_PRINT("info", ("thd->mark_used_columns: %d", thd->mark_used_columns));
- DBUG_RETURN(test(thd->is_error()));
+ DBUG_RETURN(MY_TEST(thd->is_error()));
}
@@ -8448,7 +8449,7 @@ int setup_conds(THD *thd, TABLE_LIST *tables, List<TABLE_LIST> &leaves,
select_lex->where= *conds;
}
thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup;
- DBUG_RETURN(test(thd->is_error()));
+ DBUG_RETURN(MY_TEST(thd->is_error()));
err_no_arena:
select_lex->is_item_list_lookup= save_is_item_list_lookup;
diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h
index 2e07695f605..0178844fec4 100644
--- a/sql/sql_bitmap.h
+++ b/sql/sql_bitmap.h
@@ -61,7 +61,7 @@ public:
intersect(map2buff);
if (map.n_bits > sizeof(ulonglong) * 8)
bitmap_set_above(&map, sizeof(ulonglong),
- test(map2buff & (1LL << (sizeof(ulonglong) * 8 - 1))));
+ MY_TEST(map2buff & (1LL << (sizeof(ulonglong) * 8 - 1))));
}
void subtract(Bitmap& map2) { bitmap_subtract(&map, &map2.map); }
void merge(Bitmap& map2) { bitmap_union(&map, &map2.map); }
@@ -156,7 +156,7 @@ public:
void intersect_extended(ulonglong map2) { map&= map2; }
void subtract(Bitmap<64>& map2) { map&= ~map2.map; }
void merge(Bitmap<64>& map2) { map|= map2.map; }
- bool is_set(uint n) const { return test(map & (((ulonglong)1) << n)); }
+ bool is_set(uint n) const { return MY_TEST(map & (((ulonglong) 1) << n)); }
bool is_prefix(uint n) const { return map == (((ulonglong)1) << n)-1; }
bool is_clear_all() const { return map == (ulonglong)0; }
bool is_set_all() const { return map == ~(ulonglong)0; }
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 5307f4f01f8..b0327153aa2 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -1404,9 +1404,9 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
Query_cache_query_flags flags;
// fill all gaps between fields with 0 to get repeatable key
bzero(&flags, QUERY_CACHE_FLAGS_SIZE);
- flags.client_long_flag= test(thd->client_capabilities & CLIENT_LONG_FLAG);
- flags.client_protocol_41= test(thd->client_capabilities &
- CLIENT_PROTOCOL_41);
+ flags.client_long_flag= MY_TEST(thd->client_capabilities & CLIENT_LONG_FLAG);
+ flags.client_protocol_41= MY_TEST(thd->client_capabilities &
+ CLIENT_PROTOCOL_41);
/*
Protocol influences result format, so statement results in the binary
protocol (COM_EXECUTE) cannot be served to statements asking for results
@@ -1415,10 +1415,10 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
flags.protocol_type= (unsigned int) thd->protocol->type();
/* PROTOCOL_LOCAL results are not cached. */
DBUG_ASSERT(flags.protocol_type != (unsigned int) Protocol::PROTOCOL_LOCAL);
- flags.more_results_exists= test(thd->server_status &
- SERVER_MORE_RESULTS_EXISTS);
+ flags.more_results_exists= MY_TEST(thd->server_status &
+ SERVER_MORE_RESULTS_EXISTS);
flags.in_trans= thd->in_active_multi_stmt_transaction();
- flags.autocommit= test(thd->server_status & SERVER_STATUS_AUTOCOMMIT);
+ flags.autocommit= MY_TEST(thd->server_status & SERVER_STATUS_AUTOCOMMIT);
flags.pkt_nr= net->pkt_nr;
flags.character_set_client_num=
thd->variables.character_set_client->number;
@@ -1899,14 +1899,14 @@ Query_cache::send_result_to_client(THD *thd, char *org_sql, uint query_length)
// fill all gaps between fields with 0 to get repeatable key
bzero(&flags, QUERY_CACHE_FLAGS_SIZE);
- flags.client_long_flag= test(thd->client_capabilities & CLIENT_LONG_FLAG);
- flags.client_protocol_41= test(thd->client_capabilities &
- CLIENT_PROTOCOL_41);
+ flags.client_long_flag= MY_TEST(thd->client_capabilities & CLIENT_LONG_FLAG);
+ flags.client_protocol_41= MY_TEST(thd->client_capabilities &
+ CLIENT_PROTOCOL_41);
flags.protocol_type= (unsigned int) thd->protocol->type();
- flags.more_results_exists= test(thd->server_status &
- SERVER_MORE_RESULTS_EXISTS);
+ flags.more_results_exists= MY_TEST(thd->server_status &
+ SERVER_MORE_RESULTS_EXISTS);
flags.in_trans= thd->in_active_multi_stmt_transaction();
- flags.autocommit= test(thd->server_status & SERVER_STATUS_AUTOCOMMIT);
+ flags.autocommit= MY_TEST(thd->server_status & SERVER_STATUS_AUTOCOMMIT);
flags.pkt_nr= thd->net.pkt_nr;
flags.character_set_client_num= thd->variables.character_set_client->number;
flags.character_set_results_num=
@@ -3409,7 +3409,7 @@ my_bool Query_cache::register_all_tables(THD *thd,
if (block_table->parent)
unlink_table(block_table);
}
- return test(n);
+ return MY_TEST(n);
}
@@ -4109,7 +4109,7 @@ Query_cache::is_cacheable(THD *thd, LEX *lex,
(long) OPTION_TO_QUERY_CACHE,
(long) lex->select_lex.options,
(int) thd->variables.query_cache_type,
- (uint) test(qc_is_able_to_intercept_result(thd))));
+ (uint) MY_TEST(qc_is_able_to_intercept_result(thd))));
DBUG_RETURN(0);
}
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index af908c0e71f..2be1b895f39 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -515,14 +515,14 @@ extern "C" int mysql_tmpfile(const char *prefix)
extern "C"
int thd_in_lock_tables(const THD *thd)
{
- return test(thd->in_lock_tables);
+ return MY_TEST(thd->in_lock_tables);
}
extern "C"
int thd_tablespace_op(const THD *thd)
{
- return test(thd->tablespace_op);
+ return MY_TEST(thd->tablespace_op);
}
extern "C"
@@ -2605,7 +2605,7 @@ void select_to_file::send_error(uint errcode,const char *err)
bool select_to_file::send_eof()
{
- int error= test(end_io_cache(&cache));
+ int error= MY_TEST(end_io_cache(&cache));
if (mysql_file_close(file, MYF(MY_WME)) || thd->is_error())
error= true;
@@ -2786,8 +2786,8 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
escape_char= (int) (uchar) (*exchange->escaped)[0];
else
escape_char= -1;
- is_ambiguous_field_sep= test(strchr(ESCAPE_CHARS, field_sep_char));
- is_unsafe_field_sep= test(strchr(NUMERIC_CHARS, field_sep_char));
+ is_ambiguous_field_sep= MY_TEST(strchr(ESCAPE_CHARS, field_sep_char));
+ is_unsafe_field_sep= MY_TEST(strchr(NUMERIC_CHARS, field_sep_char));
line_sep_char= (exchange->line_term->length() ?
(int) (uchar) (*exchange->line_term)[0] : INT_MAX);
if (!field_term_length)
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 81040624353..defc31547d0 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -4448,7 +4448,7 @@ public:
table.str= internal_table_name;
table.length=1;
}
- bool is_derived_table() const { return test(sel); }
+ bool is_derived_table() const { return MY_TEST(sel); }
inline void change_db(char *db_name)
{
db.str= db_name; db.length= (uint) strlen(db_name);
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 1500f1615fb..b92a4cd23f6 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -140,7 +140,7 @@ void Update_plan::save_explain_data_intern(Explain_query *query,
explain->jtype= JT_NEXT;
}
- explain->using_where= test(select && select->cond);
+ explain->using_where= MY_TEST(select && select->cond);
explain->using_filesort= using_filesort;
explain->using_io_buffer= using_io_buffer;
@@ -252,7 +252,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
table->map=1;
query_plan.select_lex= &thd->lex->select_lex;
query_plan.table= table;
- query_plan.updating_a_view= test(table_list->view);
+ query_plan.updating_a_view= MY_TEST(table_list->view);
if (mysql_prepare_delete(thd, table_list, select_lex->with_wild,
select_lex->item_list, &conds))
@@ -291,7 +291,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
DBUG_RETURN(TRUE);
const_cond= (!conds || conds->const_item());
- safe_update=test(thd->variables.option_bits & OPTION_SAFE_UPDATES);
+ safe_update= MY_TEST(thd->variables.option_bits & OPTION_SAFE_UPDATES);
if (safe_update && const_cond)
{
my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index dee631edb4b..3e7091e8925 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -660,7 +660,7 @@ static void save_insert_query_plan(THD* thd, TABLE_LIST *table_list)
thd->lex->explain->add_insert_plan(explain);
/* See Update_plan::updating_a_view for details */
- bool skip= test(table_list->view);
+ bool skip= MY_TEST(table_list->view);
/* Save subquery children */
for (SELECT_LEX_UNIT *unit= thd->lex->select_lex.first_inner_unit();
@@ -1933,7 +1933,7 @@ int check_that_all_fields_are_given_values(THD *thd, TABLE *entry,
if (table_list)
{
table_list= table_list->top_table();
- view= test(table_list->view);
+ view= MY_TEST(table_list->view);
}
if (view)
{
@@ -4211,8 +4211,8 @@ select_create::binlog_show_create_table(TABLE **tables, uint count)
result= store_create_info(thd, &tmp_table_list, &query, create_info,
/* show_database */ TRUE,
- test(create_info->options &
- HA_LEX_CREATE_REPLACE));
+ MY_TEST(create_info->options &
+ HA_LEX_CREATE_REPLACE));
DBUG_ASSERT(result == 0); /* store_create_info() always return 0 */
if (mysql_bin_log.is_open())
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc
index 3b39ebf145f..abd23c344c2 100644
--- a/sql/sql_join_cache.cc
+++ b/sql/sql_join_cache.cc
@@ -222,8 +222,8 @@ void JOIN_CACHE::calc_record_fields()
for (; tab != join_tab ; tab= next_linear_tab(join, tab, WITHOUT_BUSH_ROOTS))
{
tab->calc_used_field_length(FALSE);
- flag_fields+= test(tab->used_null_fields || tab->used_uneven_bit_fields);
- flag_fields+= test(tab->table->maybe_null);
+ flag_fields+= MY_TEST(tab->used_null_fields || tab->used_uneven_bit_fields);
+ flag_fields+= MY_TEST(tab->table->maybe_null);
fields+= tab->used_fields;
blobs+= tab->used_blobs;
}
@@ -736,7 +736,7 @@ void JOIN_CACHE::set_constants()
uint JOIN_CACHE::get_record_max_affix_length()
{
uint len= get_prefix_length() +
- test(with_match_flag) +
+ MY_TEST(with_match_flag) +
size_of_fld_ofs * data_field_count;
return len;
}
@@ -1012,7 +1012,7 @@ int JOIN_CACHE::realloc_buffer()
{
int rc;
free();
- rc= test(!(buff= (uchar*) my_malloc(buff_size, MYF(MY_THREAD_SPECIFIC))));
+ rc= MY_TEST(!(buff= (uchar*) my_malloc(buff_size, MYF(MY_THREAD_SPECIFIC))));
reset(TRUE);
return rc;
}
@@ -1766,7 +1766,7 @@ uint JOIN_CACHE::read_flag_fields()
CACHE_FIELD *copy_end= copy+flag_fields;
if (with_match_flag)
{
- copy->str[0]= test((Match_flag) pos[0] == MATCH_FOUND);
+ copy->str[0]= MY_TEST((Match_flag) pos[0] == MATCH_FOUND);
pos+= copy->length;
copy++;
}
@@ -2520,7 +2520,7 @@ enum_nested_loop_state JOIN_CACHE::join_null_complements(bool skip_last)
if (!records)
DBUG_RETURN(NESTED_LOOP_OK);
- cnt= records - (is_key_access() ? 0 : test(skip_last));
+ cnt= records - (is_key_access() ? 0 : MY_TEST(skip_last));
/* This function may be called only for inner tables of outer joins */
DBUG_ASSERT(join_tab->first_inner);
@@ -2570,7 +2570,7 @@ finish:
void JOIN_CACHE::save_explain_data(struct st_explain_bka_type *explain)
{
- explain->incremental= test(prev_cache);
+ explain->incremental= MY_TEST(prev_cache);
switch (get_join_alg()) {
case BNL_JOIN_ALG:
@@ -2792,7 +2792,7 @@ int JOIN_CACHE_HASHED::realloc_buffer()
{
int rc;
free();
- rc= test(!(buff= (uchar*) my_malloc(buff_size, MYF(MY_THREAD_SPECIFIC))));
+ rc= MY_TEST(!(buff= (uchar*) my_malloc(buff_size, MYF(MY_THREAD_SPECIFIC))));
init_hash_table();
reset(TRUE);
return rc;
@@ -3472,7 +3472,7 @@ bool JOIN_CACHE_BNL::prepare_look_for_matches(bool skip_last)
if (!records)
return TRUE;
reset(FALSE);
- rem_records= records-test(skip_last);
+ rem_records= records - MY_TEST(skip_last);
return rem_records == 0;
}
@@ -4588,7 +4588,7 @@ int JOIN_CACHE_BKAH::init()
{
bool check_only_first_match= join_tab->check_only_first_match();
- no_association= test(mrr_mode & HA_MRR_NO_ASSOCIATION);
+ no_association= MY_TEST(mrr_mode & HA_MRR_NO_ASSOCIATION);
RANGE_SEQ_IF rs_funcs= { bka_range_seq_key_info,
bkah_range_seq_init,
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 7096c886281..c549a7be2cc 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -299,7 +299,7 @@ Lex_input_stream::reset(char *buffer, unsigned int length)
m_cpp_utf8_processed_ptr= NULL;
next_state= MY_LEX_START;
found_semicolon= NULL;
- ignore_space= test(m_thd->variables.sql_mode & MODE_IGNORE_SPACE);
+ ignore_space= MY_TEST(m_thd->variables.sql_mode & MODE_IGNORE_SPACE);
stmt_prepare_mode= FALSE;
multi_statements= TRUE;
in_comment=NO_COMMENT;
@@ -3073,7 +3073,7 @@ TABLE_LIST *LEX::unlink_first_table(bool *link_to_local)
/*
and from local list if it is not empty
*/
- if ((*link_to_local= test(select_lex.table_list.first)))
+ if ((*link_to_local= MY_TEST(select_lex.table_list.first)))
{
select_lex.context.table_list=
select_lex.context.first_name_resolution_table= first->next_local;
@@ -3824,7 +3824,7 @@ void SELECT_LEX::update_used_tables()
do
{
bool maybe_null;
- if ((maybe_null= test(embedding->outer_join)))
+ if ((maybe_null= MY_TEST(embedding->outer_join)))
{
tl->table->maybe_null= maybe_null;
break;
@@ -3901,37 +3901,40 @@ void st_select_lex::update_correlated_cache()
while ((tl= ti++))
{
if (tl->on_expr)
- is_correlated|= test(tl->on_expr->used_tables() & OUTER_REF_TABLE_BIT);
+ is_correlated|= MY_TEST(tl->on_expr->used_tables() & OUTER_REF_TABLE_BIT);
for (TABLE_LIST *embedding= tl->embedding ; embedding ;
embedding= embedding->embedding)
{
if (embedding->on_expr)
- is_correlated|= test(embedding->on_expr->used_tables() &
- OUTER_REF_TABLE_BIT);
+ is_correlated|= MY_TEST(embedding->on_expr->used_tables() &
+ OUTER_REF_TABLE_BIT);
}
}
if (join->conds)
- is_correlated|= test(join->conds->used_tables() & OUTER_REF_TABLE_BIT);
+ is_correlated|= MY_TEST(join->conds->used_tables() & OUTER_REF_TABLE_BIT);
if (join->having)
- is_correlated|= test(join->having->used_tables() & OUTER_REF_TABLE_BIT);
+ is_correlated|= MY_TEST(join->having->used_tables() & OUTER_REF_TABLE_BIT);
if (join->tmp_having)
- is_correlated|= test(join->tmp_having->used_tables() & OUTER_REF_TABLE_BIT);
+ is_correlated|= MY_TEST(join->tmp_having->used_tables() &
+ OUTER_REF_TABLE_BIT);
Item *item;
List_iterator_fast<Item> it(join->fields_list);
while ((item= it++))
- is_correlated|= test(item->used_tables() & OUTER_REF_TABLE_BIT);
+ is_correlated|= MY_TEST(item->used_tables() & OUTER_REF_TABLE_BIT);
for (ORDER *order= group_list.first; order; order= order->next)
- is_correlated|= test((*order->item)->used_tables() & OUTER_REF_TABLE_BIT);
+ is_correlated|= MY_TEST((*order->item)->used_tables() &
+ OUTER_REF_TABLE_BIT);
if (!master_unit()->is_union())
{
for (ORDER *order= order_list.first; order; order= order->next)
- is_correlated|= test((*order->item)->used_tables() & OUTER_REF_TABLE_BIT);
+ is_correlated|= MY_TEST((*order->item)->used_tables() &
+ OUTER_REF_TABLE_BIT);
}
if (!is_correlated)
@@ -4220,7 +4223,7 @@ int st_select_lex_unit::save_union_explain(Explain_query *output)
eu->add_select(sl->select_number);
eu->fake_select_type= "UNION RESULT";
- eu->using_filesort= test(global_parameters->order_list.first);
+ eu->using_filesort= MY_TEST(global_parameters->order_list.first);
// Save the UNION node
output->add_node(eu);
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index b84aea6c140..13cbcdd9f08 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -1152,7 +1152,7 @@ public:
}
bool requires_prelocking()
{
- return test(query_tables_own_last);
+ return MY_TEST(query_tables_own_last);
}
void mark_as_requiring_prelocking(TABLE_LIST **tables_own_last)
{
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index a0959bdd278..d112b3e689a 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -462,7 +462,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
}
thd_proc_info(thd, "reading file");
- if (!(error=test(read_info.error)))
+ if (!(error= MY_TEST(read_info.error)))
{
table->next_number_field=table->found_next_number_field;
if (ignore ||
@@ -905,7 +905,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
thd->get_stmt_da()->inc_current_row_for_warning();
continue_loop:;
}
- DBUG_RETURN(test(read_info.error));
+ DBUG_RETURN(MY_TEST(read_info.error));
}
@@ -1130,7 +1130,7 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
thd->get_stmt_da()->inc_current_row_for_warning();
continue_loop:;
}
- DBUG_RETURN(test(read_info.error));
+ DBUG_RETURN(MY_TEST(read_info.error));
}
@@ -1298,7 +1298,7 @@ read_xml_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
thd->get_stmt_da()->inc_current_row_for_warning();
continue_loop:;
}
- DBUG_RETURN(test(read_info.error) || thd->is_error());
+ DBUG_RETURN(MY_TEST(read_info.error) || thd->is_error());
} /* load xml end */
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 0de3609e932..30448266f4e 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2416,8 +2416,8 @@ mysql_execute_command(THD *thd)
#endif
status_var_increment(thd->status_var.com_stat[lex->sql_command]);
- thd->progress.report_to_client= test(sql_command_flags[lex->sql_command] &
- CF_REPORT_PROGRESS);
+ thd->progress.report_to_client= MY_TEST(sql_command_flags[lex->sql_command] &
+ CF_REPORT_PROGRESS);
DBUG_ASSERT(thd->transaction.stmt.modified_non_trans_table == FALSE);
@@ -3500,7 +3500,7 @@ end_with_restore_list:
case SQLCOM_INSERT_SELECT:
{
select_result *sel_result;
- bool explain= test(lex->describe);
+ bool explain= MY_TEST(lex->describe);
DBUG_ASSERT(first_table == all_tables && first_table != 0);
if ((res= insert_precheck(thd, all_tables)))
break;
@@ -3614,7 +3614,7 @@ end_with_restore_list:
{
DBUG_ASSERT(first_table == all_tables && first_table != 0);
TABLE_LIST *aux_tables= thd->lex->auxiliary_table_list.first;
- bool explain= test(lex->describe);
+ bool explain= MY_TEST(lex->describe);
multi_delete *result;
if ((res= multi_delete_precheck(thd, all_tables)))
@@ -6708,7 +6708,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
if (!table)
DBUG_RETURN(0); // End of memory
alias_str= alias ? alias->str : table->table.str;
- if (!test(table_options & TL_OPTION_ALIAS) &&
+ if (!MY_TEST(table_options & TL_OPTION_ALIAS) &&
check_table_name(table->table.str, table->table.length, FALSE))
{
my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str);
@@ -6753,10 +6753,10 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
ptr->table_name=table->table.str;
ptr->table_name_length=table->table.length;
ptr->lock_type= lock_type;
- ptr->updating= test(table_options & TL_OPTION_UPDATING);
+ ptr->updating= MY_TEST(table_options & TL_OPTION_UPDATING);
/* TODO: remove TL_OPTION_FORCE_INDEX as it looks like it's not used */
- ptr->force_index= test(table_options & TL_OPTION_FORCE_INDEX);
- ptr->ignore_leaves= test(table_options & TL_OPTION_IGNORE_LEAVES);
+ ptr->force_index= MY_TEST(table_options & TL_OPTION_FORCE_INDEX);
+ ptr->ignore_leaves= MY_TEST(table_options & TL_OPTION_IGNORE_LEAVES);
ptr->derived= table->sel;
if (!ptr->derived && is_infoschema_db(ptr->db, ptr->db_length))
{
@@ -6851,7 +6851,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
lex->add_to_query_tables(ptr);
// Pure table aliases do not need to be locked:
- if (!test(table_options & TL_OPTION_ALIAS))
+ if (!MY_TEST(table_options & TL_OPTION_ALIAS))
{
ptr->mdl_request.init(MDL_key::TABLE, ptr->db, ptr->table_name, mdl_type,
MDL_TRANSACTION);
diff --git a/sql/sql_parse.h b/sql/sql_parse.h
index 1545edeaa8a..926a4d800ad 100644
--- a/sql/sql_parse.h
+++ b/sql/sql_parse.h
@@ -200,7 +200,7 @@ bool check_global_access(THD *thd, ulong want_access, bool no_errors= false);
inline bool is_supported_parser_charset(CHARSET_INFO *cs)
{
- return test(cs->mbminlen == 1);
+ return MY_TEST(cs->mbminlen == 1);
}
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 782a49af813..a9846df3b02 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -3308,7 +3308,7 @@ uint32 get_list_array_idx_for_endpoint(partition_info *part_info,
}
else
{
- DBUG_RETURN(list_index + test(left_endpoint ^ include_endpoint));
+ DBUG_RETURN(list_index + MY_TEST(left_endpoint ^ include_endpoint));
}
} while (max_list_index >= min_list_index);
notfound:
@@ -5783,7 +5783,7 @@ static bool mysql_change_partitions(ALTER_PARTITION_PARAM_TYPE *lpt)
if (mysql_trans_commit_alter_copy_data(thd))
error= 1; /* The error has been reported */
- DBUG_RETURN(test(error));
+ DBUG_RETURN(MY_TEST(error));
}
@@ -7892,7 +7892,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
index-in-ordered-array-of-list-constants (for LIST) space.
*/
store_key_image_to_rec(field, min_value, field_len);
- bool include_endp= !test(flags & NEAR_MIN);
+ bool include_endp= !MY_TEST(flags & NEAR_MIN);
part_iter->part_nums.start= get_endpoint(part_info, 1, include_endp);
if (!can_match_multiple_values && part_info->part_expr->null_value)
{
@@ -7927,7 +7927,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
else
{
store_key_image_to_rec(field, max_value, field_len);
- bool include_endp= !test(flags & NEAR_MAX);
+ bool include_endp= !MY_TEST(flags & NEAR_MAX);
part_iter->part_nums.end= get_endpoint(part_info, 0, include_endp);
if (check_zero_dates &&
!zero_in_start_date &&
@@ -8094,8 +8094,8 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info,
if ((ulonglong)b - (ulonglong)a == ~0ULL)
DBUG_RETURN(-1);
- a += test(flags & NEAR_MIN);
- b += test(!(flags & NEAR_MAX));
+ a+= MY_TEST(flags & NEAR_MIN);
+ b+= MY_TEST(!(flags & NEAR_MAX));
ulonglong n_values= b - a;
/*
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 1450d5c03ea..6ca4015adb4 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -978,7 +978,7 @@ static bool setup_conversion_functions(Prepared_statement *stmt,
typecode= sint2korr(read_pos);
read_pos+= 2;
- (**it).unsigned_flag= test(typecode & signed_bit);
+ (**it).unsigned_flag= MY_TEST(typecode & signed_bit);
setup_one_conversion_function(thd, *it, (uchar) (typecode & ~signed_bit));
}
}
@@ -2716,7 +2716,7 @@ void mysqld_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
DBUG_PRINT("exec_query", ("%s", stmt->query()));
DBUG_PRINT("info",("stmt: 0x%lx", (long) stmt));
- open_cursor= test(flags & (ulong) CURSOR_TYPE_READ_ONLY);
+ open_cursor= MY_TEST(flags & (ulong) CURSOR_TYPE_READ_ONLY);
thd->protocol= &thd->protocol_binary;
stmt->execute_loop(&expanded_query, open_cursor, packet, packet_end);
diff --git a/sql/sql_prepare.h b/sql/sql_prepare.h
index ea5ebddb561..b468ac1bf9b 100644
--- a/sql/sql_prepare.h
+++ b/sql/sql_prepare.h
@@ -290,7 +290,7 @@ public:
one.
Never fails.
*/
- bool has_next_result() const { return test(m_current_rset->m_next_rset); }
+ bool has_next_result() const { return MY_TEST(m_current_rset->m_next_rset); }
/**
Only valid to call if has_next_result() returned true.
Otherwise the result is undefined.
@@ -298,7 +298,7 @@ public:
bool move_to_next_result()
{
m_current_rset= m_current_rset->m_next_rset;
- return test(m_current_rset);
+ return MY_TEST(m_current_rset);
}
~Ed_connection() { free_old_result(); }
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 332230e67dc..6ed3791b205 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1766,7 +1766,7 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
/* Perform FULLTEXT search before all regular searches */
if (!(select_options & SELECT_DESCRIBE))
- init_ftfuncs(thd, select_lex, test(order));
+ init_ftfuncs(thd, select_lex, MY_TEST(order));
if (optimize_unflattened_subqueries())
DBUG_RETURN(1);
@@ -2279,7 +2279,7 @@ JOIN::reinit()
}
if (!(select_options & SELECT_DESCRIBE))
- init_ftfuncs(thd, select_lex, test(order));
+ init_ftfuncs(thd, select_lex, MY_TEST(order));
DBUG_RETURN(0);
}
@@ -2602,7 +2602,7 @@ void JOIN::exec_inner()
curr_join->const_tables != curr_join->table_count)
{
JOIN_TAB *first_tab= curr_join->join_tab + curr_join->const_tables;
- first_tab->sorted= test(first_tab->loosescan_match_tab);
+ first_tab->sorted= MY_TEST(first_tab->loosescan_match_tab);
}
Procedure *save_proc= curr_join->procedure;
@@ -2782,7 +2782,7 @@ void JOIN::exec_inner()
curr_join->const_tables != curr_join->table_count)
{
JOIN_TAB *first_tab= curr_join->join_tab + curr_join->const_tables;
- first_tab->sorted= test(first_tab->loosescan_match_tab);
+ first_tab->sorted= MY_TEST(first_tab->loosescan_match_tab);
}
tmp_error= -1;
if (setup_sum_funcs(curr_join->thd, curr_join->sum_funcs) ||
@@ -4982,8 +4982,8 @@ sort_keyuse(KEYUSE *a,KEYUSE *b)
if (a->keypart != b->keypart)
return (int) (a->keypart - b->keypart);
// Place const values before other ones
- if ((res= test((a->used_tables & ~OUTER_REF_TABLE_BIT)) -
- test((b->used_tables & ~OUTER_REF_TABLE_BIT))))
+ if ((res= MY_TEST((a->used_tables & ~OUTER_REF_TABLE_BIT)) -
+ MY_TEST((b->used_tables & ~OUTER_REF_TABLE_BIT))))
return res;
/* Place rows that are not 'OPTIMIZE_REF_OR_NULL' first */
return (int) ((a->optimize & KEY_OPTIMIZE_REF_OR_NULL) -
@@ -5766,7 +5766,7 @@ best_access_path(JOIN *join,
}
else
{
- found_constraint= test(found_part);
+ found_constraint= MY_TEST(found_part);
loose_scan_opt.check_ref_access_part1(s, key, start_key, found_part);
/* Check if we found full key */
@@ -5775,7 +5775,7 @@ best_access_path(JOIN *join,
{ /* use eq key */
max_key_part= (uint) ~0;
if ((key_flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME ||
- test(key_flags & HA_EXT_NOSAME))
+ MY_TEST(key_flags & HA_EXT_NOSAME))
{
tmp = prev_record_reads(join->positions, idx, found_ref);
records=1.0;
@@ -5906,7 +5906,7 @@ best_access_path(JOIN *join,
*/
if (table->quick_keys.is_set(key) && !found_ref && //(C1)
table->quick_key_parts[key] == max_key_part && //(C2)
- table->quick_n_ranges[key] == 1+test(ref_or_null_part)) //(C3)
+ table->quick_n_ranges[key] == 1 + MY_TEST(ref_or_null_part)) //(C3)
{
tmp= records= (double) table->quick_rows[key];
}
@@ -6000,8 +6000,8 @@ best_access_path(JOIN *join,
table->quick_key_parts[key] <= max_key_part &&
const_part &
((key_part_map)1 << table->quick_key_parts[key]) &&
- table->quick_n_ranges[key] == 1 + test(ref_or_null_part &
- const_part) &&
+ table->quick_n_ranges[key] == 1 + MY_TEST(ref_or_null_part &
+ const_part) &&
records > (double) table->quick_rows[key])
{
tmp= records= (double) table->quick_rows[key];
@@ -6192,8 +6192,8 @@ best_access_path(JOIN *join,
best_key= 0;
/* range/index_merge/ALL/index access method are "independent", so: */
best_ref_depends_map= 0;
- best_uses_jbuf= test(!disable_jbuf && !((s->table->map &
- join->outer_join)));
+ best_uses_jbuf= MY_TEST(!disable_jbuf && !((s->table->map &
+ join->outer_join)));
}
}
@@ -6358,7 +6358,7 @@ choose_plan(JOIN *join, table_map join_tables)
uint prune_level= join->thd->variables.optimizer_prune_level;
uint use_cond_selectivity=
join->thd->variables.optimizer_use_condition_selectivity;
- bool straight_join= test(join->select_options & SELECT_STRAIGHT_JOIN);
+ bool straight_join= MY_TEST(join->select_options & SELECT_STRAIGHT_JOIN);
DBUG_ENTER("choose_plan");
join->cur_embedding_map= 0;
@@ -8482,7 +8482,7 @@ static bool are_tables_local(JOIN_TAB *jtab, table_map used_tables)
table_map local_tables= jtab->emb_sj_nest->nested_join->used_tables |
jtab->join->const_table_map |
OUTER_REF_TABLE_BIT;
- return !test(used_tables & ~local_tables);
+ return !MY_TEST(used_tables & ~local_tables);
}
/*
@@ -8619,7 +8619,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
!are_tables_local(j, keyuse->val->used_tables()))
keyuse++; /* Skip other parts */
- uint maybe_null= test(keyinfo->key_part[i].null_bit);
+ uint maybe_null= MY_TEST(keyinfo->key_part[i].null_bit);
j->ref.items[i]=keyuse->val; // Save for cond removal
j->ref.cond_guards[i]= keyuse->cond_guard;
if (keyuse->null_rejecting)
@@ -8673,7 +8673,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
else if (!((keyparts == keyinfo->user_defined_key_parts &&
((key_flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME)) ||
(keyparts > keyinfo->user_defined_key_parts && // true only for extended keys
- test(key_flags & HA_EXT_NOSAME) &&
+ MY_TEST(key_flags & HA_EXT_NOSAME) &&
keyparts == keyinfo->ext_key_parts)) ||
null_ref_key)
{
@@ -8796,7 +8796,7 @@ JOIN::make_simple_join(JOIN *parent, TABLE *temp_table)
functions are handled.
*/
// the temporary table was explicitly requested
- DBUG_ASSERT(test(select_options & OPTION_BUFFER_RESULT));
+ DBUG_ASSERT(MY_TEST(select_options & OPTION_BUFFER_RESULT));
// the temporary table does not have a grouping expression
DBUG_ASSERT(!temp_table->group);
}
@@ -10403,7 +10403,7 @@ uint check_join_cache_usage(JOIN_TAB *tab,
((options & SELECT_DESCRIBE) || !tab->cache->init()))
{
tab->icp_other_tables_ok= FALSE;
- return (2-test(!prev_cache));
+ return (2 - MY_TEST(!prev_cache));
}
goto no_join_cache;
case JT_SYSTEM:
@@ -10438,7 +10438,7 @@ uint check_join_cache_usage(JOIN_TAB *tab,
((options & SELECT_DESCRIBE) || !tab->cache->init()))
{
tab->icp_other_tables_ok= FALSE;
- return (4-test(!prev_cache));
+ return (4 - MY_TEST(!prev_cache));
}
goto no_join_cache;
}
@@ -10457,7 +10457,7 @@ uint check_join_cache_usage(JOIN_TAB *tab,
prev_cache= 0;
if ((tab->cache= new JOIN_CACHE_BKA(join, tab, flags, prev_cache)) &&
((options & SELECT_DESCRIBE) || !tab->cache->init()))
- return (6-test(!prev_cache));
+ return (6 - MY_TEST(!prev_cache));
goto no_join_cache;
}
else
@@ -10468,7 +10468,7 @@ uint check_join_cache_usage(JOIN_TAB *tab,
((options & SELECT_DESCRIBE) || !tab->cache->init()))
{
tab->idx_cond_fact_out= FALSE;
- return (8-test(!prev_cache));
+ return (8 - MY_TEST(!prev_cache));
}
goto no_join_cache;
}
@@ -10563,7 +10563,7 @@ restart:
no_jbuf_after,
idx,
prev_tab);
- tab->use_join_cache= test(tab->used_join_cache_level);
+ tab->use_join_cache= MY_TEST(tab->used_join_cache_level);
/*
psergey-merge: todo: raise the question that this is really stupid that
we can first allocate a join buffer, then decide not to use it and free
@@ -10693,7 +10693,7 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after)
uint i;
DBUG_ENTER("make_join_readinfo");
- bool statistics= test(!(join->select_options & SELECT_DESCRIBE));
+ bool statistics= MY_TEST(!(join->select_options & SELECT_DESCRIBE));
bool sorted= 1;
join->complex_firstmatch_tables= table_map(0);
@@ -11191,7 +11191,7 @@ bool JOIN_TAB::preread_init()
/* init ftfuns for just initialized derived table */
if (table->fulltext_searched)
- init_ftfuncs(join->thd, join->select_lex, test(join->order));
+ init_ftfuncs(join->thd, join->select_lex, MY_TEST(join->order));
return FALSE;
}
@@ -11247,12 +11247,12 @@ bool TABLE_REF::tmp_table_index_lookup_init(THD *thd,
Item *item= it.next();
DBUG_ASSERT(item);
items[i]= item;
- int null_count= test(cur_key_part->field->real_maybe_null());
+ int null_count= MY_TEST(cur_key_part->field->real_maybe_null());
*ref_key= new store_key_item(thd, cur_key_part->field,
/* TIMOUR:
the NULL byte is taken into account in
cur_key_part->store_length, so instead of
- cur_ref_buff + test(maybe_null), we could
+ cur_ref_buff + MY_TEST(maybe_null), we could
use that information instead.
*/
cur_ref_buff + null_count,
@@ -12983,7 +12983,7 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
item= NULL; /* Don't produce equality */
}
- bool produce_equality= test(item == field_item);
+ bool produce_equality= MY_TEST(item == field_item);
if (!item_const && field_sjm && field_sjm != current_sjm)
{
/* Entering an SJM nest */
@@ -13601,7 +13601,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top,
NESTED_JOIN *nested_join;
TABLE_LIST *prev_table= 0;
List_iterator<TABLE_LIST> li(*join_list);
- bool straight_join= test(join->select_options & SELECT_STRAIGHT_JOIN);
+ bool straight_join= MY_TEST(join->select_options & SELECT_STRAIGHT_JOIN);
DBUG_ENTER("simplify_joins");
/*
@@ -14224,7 +14224,7 @@ optimize_cond(JOIN *join, COND *conds,
DBUG_EXECUTE("where", print_where(conds, "original", QT_ORDINARY););
conds= build_equal_items(join, conds, NULL, join_list,
ignore_on_conds, cond_equal,
- test(flags & OPT_LINK_EQUAL_FIELDS));
+ MY_TEST(flags & OPT_LINK_EQUAL_FIELDS));
DBUG_EXECUTE("where",print_where(conds,"after equal_items", QT_ORDINARY););
/* change field = field to field = const for each found field = const */
@@ -15446,7 +15446,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
("table_alias: '%s' distinct: %d save_sum_fields: %d "
"rows_limit: %lu group: %d", table_alias,
(int) distinct, (int) save_sum_fields,
- (ulong) rows_limit,test(group)));
+ (ulong) rows_limit, MY_TEST(group)));
thd->inc_status_created_tmp_tables();
thd->query_plan_flags|= QPLAN_TMP_TABLE;
@@ -15992,7 +15992,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
table->group=group; /* Table is grouped by key */
param->group_buff=group_buff;
share->keys=1;
- share->uniques= test(using_unique_constraint);
+ share->uniques= MY_TEST(using_unique_constraint);
table->key_info= table->s->key_info= keyinfo;
table->keys_in_use_for_query.set_bit(0);
share->keys_in_use.set_bit(0);
@@ -16046,7 +16046,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
if (!(cur_group->field= field->new_key_field(thd->mem_root,table,
group_buff +
- test(maybe_null),
+ MY_TEST(maybe_null),
field->null_ptr,
field->null_bit)))
goto err; /* purecov: inspected */
@@ -16102,7 +16102,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
null_pack_length-=hidden_null_pack_length;
keyinfo->user_defined_key_parts=
((field_count-param->hidden_field_count)+
- (share->uniques ? test(null_pack_length) : 0));
+ (share->uniques ? MY_TEST(null_pack_length) : 0));
keyinfo->ext_key_parts= keyinfo->user_defined_key_parts;
table->distinct= 1;
share->keys= 1;
@@ -17514,7 +17514,7 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
if (select_cond)
{
- select_cond_result= test(select_cond->val_int());
+ select_cond_result= MY_TEST(select_cond->val_int());
/* check for errors evaluating the condition */
if (join->thd->is_error())
@@ -17899,7 +17899,7 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos)
(*tab->on_expr_ref)->update_used_tables();
DBUG_ASSERT((*tab->on_expr_ref)->const_item());
#endif
- if ((table->null_row= test((*tab->on_expr_ref)->val_int() == 0)))
+ if ((table->null_row= MY_TEST((*tab->on_expr_ref)->val_int() == 0)))
mark_as_null_row(table);
}
if (!table->null_row)
@@ -21353,7 +21353,7 @@ test_if_subpart(ORDER *a,ORDER *b)
else
return 0;
}
- return test(!b);
+ return MY_TEST(!b);
}
/**
diff --git a/sql/sql_select.h b/sql/sql_select.h
index bd0433eb5ee..0262493365b 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -524,7 +524,7 @@ typedef struct st_join_table {
ha_rows get_examined_rows();
bool preread_init();
- bool is_sjm_nest() { return test(bush_children); }
+ bool is_sjm_nest() { return MY_TEST(bush_children); }
bool access_from_tables_is_allowed(table_map used_tables,
table_map sjm_lookup_tables)
@@ -1299,7 +1299,7 @@ public:
lock= thd_arg->lock;
select_lex= 0; //for safety
tmp_join= 0;
- select_distinct= test(select_options & SELECT_DISTINCT);
+ select_distinct= MY_TEST(select_options & SELECT_DISTINCT);
no_order= 0;
simple_order= 0;
simple_group= 0;
@@ -1443,7 +1443,7 @@ public:
void set_allowed_join_cache_types();
bool is_allowed_hash_join_access()
{
- return test(allowed_join_cache_types & JOIN_CACHE_HASHED_BIT) &&
+ return MY_TEST(allowed_join_cache_types & JOIN_CACHE_HASHED_BIT) &&
max_allowed_join_cache_level > JOIN_CACHE_HASHED_BIT;
}
/*
@@ -1462,7 +1462,7 @@ public:
return ((const_tables != table_count &&
((select_distinct || !simple_order || !simple_group) ||
(group_list && order) ||
- test(select_options & OPTION_BUFFER_RESULT))) ||
+ MY_TEST(select_options & OPTION_BUFFER_RESULT))) ||
(rollup.state != ROLLUP::STATE_NONE && select_distinct));
}
bool choose_subquery_plan(table_map join_tables);
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 738384d599f..848df7d11f9 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -885,7 +885,7 @@ public:
m_view_access_denied_message_ptr(NULL)
{
- m_sctx = test(m_top_view->security_ctx) ?
+ m_sctx= MY_TEST(m_top_view->security_ctx) ?
m_top_view->security_ctx : thd->security_ctx;
}
@@ -2011,7 +2011,7 @@ static void store_key_options(THD *thd, String *packet, TABLE *table,
end= longlong10_to_str(key_info->block_size, buff, 10);
packet->append(buff, (uint) (end - buff));
}
- DBUG_ASSERT(test(key_info->flags & HA_USES_COMMENT) ==
+ DBUG_ASSERT(MY_TEST(key_info->flags & HA_USES_COMMENT) ==
(key_info->comment.length > 0));
if (key_info->flags & HA_USES_COMMENT)
{
@@ -2398,7 +2398,7 @@ int select_result_explain_buffer::send_data(List<Item> &items)
fill_record(thd, dst_table, dst_table->field, items, TRUE, FALSE);
res= dst_table->file->ha_write_tmp_row(dst_table->record[0]);
set_current_thd(cur_thd);
- DBUG_RETURN(test(res));
+ DBUG_RETURN(MY_TEST(res));
}
bool select_result_text_buffer::send_result_set_metadata(List<Item> &fields, uint flag)
@@ -5433,7 +5433,7 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
#ifndef NO_EMBEDDED_ACCESS_CHECKS
uint col_access;
check_access(thd,SELECT_ACL, db_name->str,
- &tables->grant.privilege, 0, 0, test(tables->schema_table));
+ &tables->grant.privilege, 0, 0, MY_TEST(tables->schema_table));
col_access= get_column_grant(thd, &tables->grant,
db_name->str, table_name->str,
field->field_name) & COL_ACLS;
@@ -5572,13 +5572,13 @@ static my_bool iter_schema_engines(THD *thd, plugin_ref plugin,
table->field[1]->store(option_name, strlen(option_name), scs);
table->field[2]->store(plugin_decl(plugin)->descr,
strlen(plugin_decl(plugin)->descr), scs);
- tmp= &yesno[test(hton->commit)];
+ tmp= &yesno[MY_TEST(hton->commit)];
table->field[3]->store(tmp->str, tmp->length, scs);
table->field[3]->set_notnull();
- tmp= &yesno[test(hton->prepare)];
+ tmp= &yesno[MY_TEST(hton->prepare)];
table->field[4]->store(tmp->str, tmp->length, scs);
table->field[4]->set_notnull();
- tmp= &yesno[test(hton->savepoint_set)];
+ tmp= &yesno[MY_TEST(hton->savepoint_set)];
table->field[5]->store(tmp->str, tmp->length, scs);
table->field[5]->set_notnull();
@@ -6145,7 +6145,7 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables,
else
table->field[14]->store("", 0, cs);
table->field[14]->set_notnull();
- DBUG_ASSERT(test(key_info->flags & HA_USES_COMMENT) ==
+ DBUG_ASSERT(MY_TEST(key_info->flags & HA_USES_COMMENT) ==
(key_info->comment.length > 0));
if (key_info->flags & HA_USES_COMMENT)
table->field[15]->store(key_info->comment.str,
diff --git a/sql/sql_statistics.h b/sql/sql_statistics.h
index c1c80921861..68aacd69d98 100644
--- a/sql/sql_statistics.h
+++ b/sql/sql_statistics.h
@@ -354,7 +354,7 @@ public:
bool is_null(uint stat_field_no)
{
- return test(column_stat_nulls & (1 << stat_field_no));
+ return MY_TEST(column_stat_nulls & (1 << stat_field_no));
}
double get_nulls_ratio()
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index c94343cadfd..3b6e432e8a2 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -3802,7 +3802,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
with length (unlike blobs, where ft code takes data length from a
data prefix, ignoring column->length).
*/
- column->length=test(f_is_blob(sql_field->pack_flag));
+ column->length= MY_TEST(f_is_blob(sql_field->pack_flag));
}
else
{
@@ -5290,8 +5290,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
int result __attribute__((unused))=
store_create_info(thd, table, &query,
create_info, FALSE /* show_database */,
- test(create_info->options &
- HA_LEX_CREATE_REPLACE));
+ MY_TEST(create_info->options &
+ HA_LEX_CREATE_REPLACE));
DBUG_ASSERT(result == 0); // store_create_info() always return 0
do_logging= FALSE;
@@ -7385,7 +7385,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
key= new Key(key_type, key_name, strlen(key_name),
&key_create_info,
- test(key_info->flags & HA_GENERATED_KEY),
+ MY_TEST(key_info->flags & HA_GENERATED_KEY),
key_parts, key_info->option_list, FALSE);
new_key_list.push_back(key);
}
@@ -8987,7 +8987,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
DBUG_ENTER("copy_data_between_tables");
/* Two or 3 stages; Sorting, copying data and update indexes */
- thd_progress_init(thd, 2 + test(order));
+ thd_progress_init(thd, 2 + MY_TEST(order));
if (mysql_trans_prepare_alter_copy_data(thd))
DBUG_RETURN(-1);
@@ -9488,7 +9488,7 @@ static bool check_engine(THD *thd, const char *db_name,
handlerton **new_engine= &create_info->db_type;
handlerton *req_engine= *new_engine;
bool no_substitution=
- test(thd->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION);
+ MY_TEST(thd->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION);
if (!(*new_engine= ha_checktype(thd, ha_legacy_type(req_engine),
no_substitution, 1)))
DBUG_RETURN(true);
diff --git a/sql/sql_time.cc b/sql/sql_time.cc
index 5ef7b2c7c34..c906f9e76d7 100644
--- a/sql/sql_time.cc
+++ b/sql/sql_time.cc
@@ -106,9 +106,9 @@ uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year)
uint days;
ulong daynr=calc_daynr(l_time->year,l_time->month,l_time->day);
ulong first_daynr=calc_daynr(l_time->year,1,1);
- bool monday_first= test(week_behaviour & WEEK_MONDAY_FIRST);
- bool week_year= test(week_behaviour & WEEK_YEAR);
- bool first_weekday= test(week_behaviour & WEEK_FIRST_WEEKDAY);
+ bool monday_first= MY_TEST(week_behaviour & WEEK_MONDAY_FIRST);
+ bool week_year= MY_TEST(week_behaviour & WEEK_YEAR);
+ bool first_weekday= MY_TEST(week_behaviour & WEEK_FIRST_WEEKDAY);
uint weekday=calc_weekday(first_daynr, !monday_first);
*year=l_time->year;
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index ff2da863db8..e49a8abc95a 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -243,7 +243,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
bool is_union_select;
DBUG_ENTER("st_select_lex_unit::prepare");
- describe= test(additional_options & SELECT_DESCRIBE);
+ describe= MY_TEST(additional_options & SELECT_DESCRIBE);
/*
result object should be reassigned even if preparing already done for
@@ -450,7 +450,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
if (global_parameters->ftfunc_list->elements)
create_options= create_options | TMP_TABLE_FORCE_MYISAM;
- if (union_result->create_result_table(thd, &types, test(union_distinct),
+ if (union_result->create_result_table(thd, &types, MY_TEST(union_distinct),
create_options, "", FALSE, TRUE))
goto err;
if (fake_select_lex && !fake_select_lex->first_cond_optimization)
@@ -988,7 +988,7 @@ bool st_select_lex_unit::change_result(select_result_interceptor *new_result,
List<Item> *st_select_lex_unit::get_unit_column_types()
{
SELECT_LEX *sl= first_select();
- bool is_procedure= test(sl->join->procedure);
+ bool is_procedure= MY_TEST(sl->join->procedure);
if (is_procedure)
{
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index ccdc91e10df..32190a3a8d4 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -255,7 +255,7 @@ int mysql_update(THD *thd,
ha_rows *found_return, ha_rows *updated_return)
{
bool using_limit= limit != HA_POS_ERROR;
- bool safe_update= test(thd->variables.option_bits & OPTION_SAFE_UPDATES);
+ bool safe_update= MY_TEST(thd->variables.option_bits & OPTION_SAFE_UPDATES);
bool used_key_is_modified= FALSE, transactional_table, will_batch;
bool can_compare_record;
int res;
@@ -314,7 +314,7 @@ int mysql_update(THD *thd,
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "UPDATE");
DBUG_RETURN(1);
}
- query_plan.updating_a_view= test(table_list->view);
+ query_plan.updating_a_view= MY_TEST(table_list->view);
/* Calculate "table->covering_keys" based on the WHERE */
table->covering_keys= table->s->keys_in_use;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index b206874c68d..bcc94e80bcf 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -344,7 +344,7 @@ int case_stmt_action_when(LEX *lex, Item *when, bool simple)
(jump_if_not from instruction 2 to 5, 5 to 8 ... in the example)
*/
- return !test(i) ||
+ return !MY_TEST(i) ||
sp->push_backpatch(i, ctx->push_label(current_thd, empty_lex_str, 0)) ||
sp->add_cont_backpatch(i) ||
sp->add_instr(i);
@@ -362,7 +362,7 @@ int case_stmt_action_then(LEX *lex)
sp_pcontext *ctx= lex->spcont;
uint ip= sp->instructions();
sp_instr_jump *i = new sp_instr_jump(ip, ctx);
- if (!test(i) || sp->add_instr(i))
+ if (!MY_TEST(i) || sp->add_instr(i))
return 1;
/*
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 37f2b2519c7..a871d398c68 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -2102,7 +2102,7 @@ static bool fix_optimizer_switch(sys_var *self, THD *thd,
{
SV *sv= (type == OPT_GLOBAL) ? &global_system_variables : &thd->variables;
sv->engine_condition_pushdown=
- test(sv->optimizer_switch & OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN);
+ MY_TEST(sv->optimizer_switch & OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN);
return false;
}
static Sys_var_flagset Sys_optimizer_switch(
@@ -4578,7 +4578,7 @@ static Sys_var_mybool Sys_query_cache_strip_comments(
static ulonglong in_transaction(THD *thd)
{
- return test(thd->in_active_multi_stmt_transaction());
+ return MY_TEST(thd->in_active_multi_stmt_transaction());
}
static Sys_var_session_special Sys_in_transaction(
"in_transaction", "Whether there is an active transaction",
diff --git a/sql/table.cc b/sql/table.cc
index 78d7e7935fc..f3f18586fef 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -819,8 +819,8 @@ static bool create_key_infos(const uchar *strpos, const uchar *frm_image_end,
keyinfo->comment.length);
strpos+= keyinfo->comment.length;
}
- DBUG_ASSERT(test(keyinfo->flags & HA_USES_COMMENT) ==
- (keyinfo->comment.length > 0));
+ DBUG_ASSERT(MY_TEST(keyinfo->flags & HA_USES_COMMENT) ==
+ (keyinfo->comment.length > 0));
}
share->keys= keys; // do it *after* all key_info's are initialized
@@ -2889,9 +2889,9 @@ partititon_err:
else if (outparam->file)
{
handler::Table_flags flags= outparam->file->ha_table_flags();
- outparam->no_replicate= ! test(flags & (HA_BINLOG_STMT_CAPABLE
- | HA_BINLOG_ROW_CAPABLE))
- || test(flags & HA_HAS_OWN_BINLOGGING);
+ outparam->no_replicate= ! MY_TEST(flags & (HA_BINLOG_STMT_CAPABLE
+ | HA_BINLOG_ROW_CAPABLE))
+ || MY_TEST(flags & HA_HAS_OWN_BINLOGGING);
}
else
{
@@ -3253,7 +3253,7 @@ void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo,
/* header */
fileinfo[0]=(uchar) 254;
fileinfo[1]= 1;
- fileinfo[2]= FRM_VER+3+ test(create_info->varchar);
+ fileinfo[2]= FRM_VER + 3 + MY_TEST(create_info->varchar);
fileinfo[3]= (uchar) ha_legacy_type(
ha_checktype(thd,ha_legacy_type(create_info->db_type),0,0));
@@ -3272,8 +3272,8 @@ void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo,
*/
for (i= 0; i < keys; i++)
{
- DBUG_ASSERT(test(key_info[i].flags & HA_USES_COMMENT) ==
- (key_info[i].comment.length > 0));
+ DBUG_ASSERT(MY_TEST(key_info[i].flags & HA_USES_COMMENT) ==
+ (key_info[i].comment.length > 0));
if (key_info[i].flags & HA_USES_COMMENT)
key_comment_total_bytes += 2 + key_info[i].comment.length;
}
@@ -6183,9 +6183,9 @@ bool TABLE::is_filled_at_execution()
do not have a corresponding table reference. Such tables are filled
during execution.
*/
- return test(!pos_in_table_list ||
- pos_in_table_list->jtbm_subselect ||
- pos_in_table_list->is_active_sjm());
+ return MY_TEST(!pos_in_table_list ||
+ pos_in_table_list->jtbm_subselect ||
+ pos_in_table_list->is_active_sjm());
}
diff --git a/sql/table.h b/sql/table.h
index b175dfe07a0..71aaf97f596 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -2194,7 +2194,7 @@ struct TABLE_LIST
*/
char *get_table_name() const { return view != NULL ? view_name.str : table_name; }
bool is_active_sjm();
- bool is_jtbm() { return test(jtbm_subselect!=NULL); }
+ bool is_jtbm() { return MY_TEST(jtbm_subselect != NULL); }
st_select_lex_unit *get_unit();
st_select_lex *get_single_select();
void wrap_into_nested_join(List<TABLE_LIST> &join_list);
diff --git a/sql/transaction.cc b/sql/transaction.cc
index 213b6c1a4d8..3575ff52e66 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -138,7 +138,7 @@ bool trans_begin(THD *thd, uint flags)
thd->server_status&=
~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));
- res= test(ha_commit_trans(thd, TRUE));
+ res= MY_TEST(ha_commit_trans(thd, TRUE));
}
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
@@ -172,7 +172,7 @@ bool trans_begin(THD *thd, uint flags)
compatibility.
*/
const bool user_is_super=
- test(thd->security_ctx->master_access & SUPER_ACL);
+ MY_TEST(thd->security_ctx->master_access & SUPER_ACL);
if (opt_readonly && !user_is_super)
{
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--read-only");
@@ -191,7 +191,7 @@ bool trans_begin(THD *thd, uint flags)
if (flags & MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT)
res= ha_start_consistent_snapshot(thd);
- DBUG_RETURN(test(res));
+ DBUG_RETURN(MY_TEST(res));
}
@@ -228,7 +228,7 @@ bool trans_commit(THD *thd)
thd->transaction.all.modified_non_trans_table= FALSE;
thd->lex->start_transaction_opt= 0;
- DBUG_RETURN(test(res));
+ DBUG_RETURN(MY_TEST(res));
}
@@ -264,7 +264,7 @@ bool trans_commit_implicit(THD *thd)
thd->server_status&=
~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));
- res= test(ha_commit_trans(thd, TRUE));
+ res= MY_TEST(ha_commit_trans(thd, TRUE));
}
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
@@ -311,7 +311,7 @@ bool trans_rollback(THD *thd)
thd->transaction.all.modified_non_trans_table= FALSE;
thd->lex->start_transaction_opt= 0;
- DBUG_RETURN(test(res));
+ DBUG_RETURN(MY_TEST(res));
}
@@ -357,7 +357,7 @@ bool trans_rollback_implicit(THD *thd)
/* Rollback should clear transaction_rollback_request flag. */
DBUG_ASSERT(! thd->transaction_rollback_request);
- DBUG_RETURN(test(res));
+ DBUG_RETURN(MY_TEST(res));
}
@@ -409,7 +409,7 @@ bool trans_commit_stmt(THD *thd)
thd->transaction.stmt.reset();
- DBUG_RETURN(test(res));
+ DBUG_RETURN(MY_TEST(res));
}
@@ -595,7 +595,7 @@ bool trans_rollback_to_savepoint(THD *thd, LEX_STRING name)
if (!res && !binlog_on)
thd->mdl_context.rollback_to_savepoint(sv->mdl_savepoint);
- DBUG_RETURN(test(res));
+ DBUG_RETURN(MY_TEST(res));
}
@@ -630,7 +630,7 @@ bool trans_release_savepoint(THD *thd, LEX_STRING name)
thd->transaction.savepoints= sv->prev;
- DBUG_RETURN(test(res));
+ DBUG_RETURN(MY_TEST(res));
}
@@ -794,7 +794,7 @@ bool trans_xa_commit(THD *thd)
else if (xa_state == XA_IDLE && thd->lex->xa_opt == XA_ONE_PHASE)
{
int r= ha_commit_trans(thd, TRUE);
- if ((res= test(r)))
+ if ((res= MY_TEST(r)))
my_error(r == 1 ? ER_XA_RBROLLBACK : ER_XAER_RMERR, MYF(0));
}
else if (xa_state == XA_PREPARED && thd->lex->xa_opt == XA_NONE)
@@ -821,7 +821,7 @@ bool trans_xa_commit(THD *thd)
{
DEBUG_SYNC(thd, "trans_xa_commit_after_acquire_commit_lock");
- res= test(ha_commit_one_phase(thd, 1));
+ res= MY_TEST(ha_commit_one_phase(thd, 1));
if (res)
my_error(ER_XAER_RMERR, MYF(0));
}
diff --git a/sql/tztime.cc b/sql/tztime.cc
index 94fcfc7bfcf..b0c5a0830fc 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -2822,7 +2822,7 @@ main(int argc, char **argv)
if (TYPE_SIGNED(time_t))
{
t= -100;
- localtime_negative= test(localtime_r(&t, &tmp) != 0);
+ localtime_negative= MY_TEST(localtime_r(&t, &tmp) != 0);
printf("localtime_r %s negative params \
(time_t=%d is %d-%d-%d %d:%d:%d)\n",
(localtime_negative ? "supports" : "doesn't support"), (int)t,
diff --git a/sql/uniques.cc b/sql/uniques.cc
index 0c1c34d495b..0990182dbdb 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -86,7 +86,7 @@ Unique::Unique(qsort_cmp2 comp_func, void * comp_func_fixed_arg,
full_size= size;
if (min_dupl_count_arg)
full_size+= sizeof(element_count);
- with_counters= test(min_dupl_count_arg);
+ with_counters= MY_TEST(min_dupl_count_arg);
my_b_clear(&file);
init_tree(&tree, (ulong) (max_in_memory_size / 16), 0, size, comp_func,
NULL, comp_func_fixed_arg, MYF(MY_THREAD_SPECIFIC));
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 7bb943dc9b0..ad2d711be99 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -280,8 +280,8 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
int2store(forminfo+2, frm.length - filepos);
int4store(fileinfo+10, frm.length);
- fileinfo[26]= (uchar) test((create_info->max_rows == 1) &&
- (create_info->min_rows == 1) && (keys == 0));
+ fileinfo[26]= (uchar) MY_TEST((create_info->max_rows == 1) &&
+ (create_info->min_rows == 1) && (keys == 0));
int2store(fileinfo+28,key_info_length);
if (part_info)
@@ -898,7 +898,7 @@ static bool pack_fields(uchar *buff, List<Create_field> &create_fields,
*/
if (field->vcol_info && field->vcol_info->expr_str.length)
{
- *buff++= (uchar)(1 + test(field->interval));
+ *buff++= (uchar) (1 + MY_TEST(field->interval));
*buff++= (uchar) field->sql_type;
*buff++= (uchar) field->stored_in_db;
if (field->interval)