Change some my_bool in C++ classes and a few functions to bool to detect wrong usage of bool/my_bool.

Fix some bugs where we stored values other than 0 or 1 in my_bool
Fixed some compiler warnings


client/mysql.cc:
  Changed interrupted_query from my_bool to int, as we stored 2 in it.
client/mysqladmin.cc:
  Changed return variable type to same type as function value type
client/mysqltest.cc:
  Changed 'found' to int as we store other values than 0 or 1 into it
  Changed type for parameter of set_reconnect() to match usage.
extra/libevent/evbuffer.c:
  Added __attribute__((unused))
extra/libevent/event.c:
  Added __attribute__((unused))
extra/libevent/signal.c:
  Added __attribute__((unused))
sql/event_data_objects.h:
  my_bool -> bool
sql/event_db_repository.cc:
  my_bool -> bool
sql/event_db_repository.h:
  my_bool -> bool
sql/event_parse_data.h:
  my_bool -> bool
sql/events.cc:
  my_bool -> bool
sql/events.h:
  my_bool -> bool
sql/field.cc:
  my_bool -> bool
sql/field.h:
  my_bool -> bool
sql/hash_filo.h:
  my_bool -> bool
sql/item.cc:
  my_bool -> bool
sql/item.h:
  my_bool -> bool
sql/item_cmpfunc.h:
  my_bool -> bool
  Changed result_for_null_param from my_bool to int as we stored -1 in it.
sql/item_func.cc:
  my_bool -> bool
  Modified udf wrapper functions so that the UDF functions would continue to use my_bool. (To keep compatibility with UDF:s)
sql/item_func.h:
  my_bool -> bool
sql/item_subselect.h:
  my_bool -> bool
sql/item_sum.cc:
  Modified udf wrapper functions so that the UDF functions would continue to use my_bool. (To keep compatibility with UDF:s)
sql/parse_file.h:
  my_bool -> bool
sql/rpl_mi.h:
  my_bool -> bool
sql/sp_rcontext.h:
  my_bool -> bool
sql/sql_analyse.h:
  my_bool -> bool
sql/sql_base.cc:
  Change some assignments so that we don't initialize bool variables with int's.
sql/sql_bitmap.h:
  my_bool -> bool
sql/sql_cache.cc:
  my_bool -> bool
sql/sql_cache.h:
  my_bool -> bool
sql/sql_class.h:
  my_bool -> bool
sql/sql_insert.cc:
  Change some assignments so that we don't initialize bool variables with int's.
sql/sql_prepare.cc:
  my_bool -> bool
sql/table.h:
  my_bool -> bool
storage/maria/ma_check.c:
  Removed duplicate assignment
strings/decimal.c:
  Fixed wrong variable usage.
  Don't do complex arithmetic on bool when simple works.
This commit is contained in:
Michael Widenius 2010-09-24 01:00:32 +03:00
parent 5ce4825b63
commit bdba1d11c4
36 changed files with 178 additions and 138 deletions

View File

@ -151,7 +151,7 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0,
tty_password= 0, opt_nobeep=0, opt_reconnect=1, tty_password= 0, opt_nobeep=0, opt_reconnect=1,
default_charset_used= 0, opt_secure_auth= 0, default_charset_used= 0, opt_secure_auth= 0,
default_pager_set= 0, opt_sigint_ignore= 0, default_pager_set= 0, opt_sigint_ignore= 0,
show_warnings= 0, executing_query= 0, interrupted_query= 0, show_warnings= 0, executing_query= 0,
ignore_spaces= 0; ignore_spaces= 0;
static my_bool debug_info_flag, debug_check_flag, batch_abort_on_error; static my_bool debug_info_flag, debug_check_flag, batch_abort_on_error;
static my_bool column_types_flag; static my_bool column_types_flag;
@ -162,6 +162,7 @@ static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0;
static uint my_end_arg; static uint my_end_arg;
static char * opt_mysql_unix_port=0; static char * opt_mysql_unix_port=0;
static int connect_flag=CLIENT_INTERACTIVE; static int connect_flag=CLIENT_INTERACTIVE;
static int interrupted_query= 0;
static char *current_host,*current_db,*current_user=0,*opt_password=0, static char *current_host,*current_db,*current_user=0,*opt_password=0,
*current_prompt=0, *delimiter_str= 0, *current_prompt=0, *delimiter_str= 0,
*default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME; *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
@ -3982,7 +3983,7 @@ static int
com_connect(String *buffer, char *line) com_connect(String *buffer, char *line)
{ {
char *tmp, buff[256]; char *tmp, buff[256];
bool save_rehash= opt_rehash; my_bool save_rehash= opt_rehash;
int error; int error;
bzero(buff, sizeof(buff)); bzero(buff, sizeof(buff));

View File

@ -1469,7 +1469,7 @@ static my_bool wait_pidfile(char *pidfile, time_t last_modified,
struct stat *pidfile_status) struct stat *pidfile_status)
{ {
char buff[FN_REFLEN]; char buff[FN_REFLEN];
int error= 1; my_bool error= 1;
uint count= 0; uint count= 0;
DBUG_ENTER("wait_pidfile"); DBUG_ENTER("wait_pidfile");

View File

@ -4727,11 +4727,11 @@ char *get_string(char **to_ptr, char **from_ptr,
} }
void set_reconnect(MYSQL* mysql, int val) void set_reconnect(MYSQL* mysql, my_bool val)
{ {
my_bool reconnect= val; my_bool reconnect= val;
DBUG_ENTER("set_reconnect"); DBUG_ENTER("set_reconnect");
DBUG_PRINT("info", ("val: %d", val)); DBUG_PRINT("info", ("val: %d", (int) val));
#if MYSQL_VERSION_ID < 50000 #if MYSQL_VERSION_ID < 50000
mysql->reconnect= reconnect; mysql->reconnect= reconnect;
#else #else
@ -8591,15 +8591,15 @@ void free_replace()
typedef struct st_replace { typedef struct st_replace {
my_bool found; int found;
struct st_replace *next[256]; struct st_replace *next[256];
} REPLACE; } REPLACE;
typedef struct st_replace_found { typedef struct st_replace_found {
my_bool found; int found;
char *replace_string;
uint to_offset; uint to_offset;
int from_offset; int from_offset;
char *replace_string;
} REPLACE_STRING; } REPLACE_STRING;
@ -8631,7 +8631,7 @@ void replace_strings_append(REPLACE *rep, DYNAMIC_STRING* ds,
} }
/* Found a string that needs to be replaced */ /* Found a string that needs to be replaced */
DBUG_PRINT("info", ("found: %d, to_offset: %d, from_offset: %d, string: %s", DBUG_PRINT("info", ("found: %d, to_offset: %u, from_offset: %d, string: %s",
rep_str->found, rep_str->to_offset, rep_str->found, rep_str->to_offset,
rep_str->from_offset, rep_str->replace_string)); rep_str->from_offset, rep_str->replace_string));

View File

@ -75,7 +75,7 @@ bufferevent_add(struct event *ev, int timeout)
*/ */
void void
bufferevent_read_pressure_cb(struct evbuffer *buf, size_t old, size_t now, bufferevent_read_pressure_cb(struct evbuffer *buf, size_t old __attribute__((unused)), size_t now,
void *arg) { void *arg) {
struct bufferevent *bufev = arg; struct bufferevent *bufev = arg;
/* /*

View File

@ -394,7 +394,8 @@ event_base_get_method(struct event_base *base)
} }
static void static void
event_loopexit_cb(int fd, short what, void *arg) event_loopexit_cb(int fd __attribute__((unused)),
short what __attribute__((unused)), void *arg)
{ {
struct event_base *base = arg; struct event_base *base = arg;
base->event_gotterm = 1; base->event_gotterm = 1;

View File

@ -69,7 +69,7 @@ static void evsignal_handler(int sig);
/* Callback for when the signal handler write a byte to our signaling socket */ /* Callback for when the signal handler write a byte to our signaling socket */
static void static void
evsignal_cb(int fd, short what, void *arg) evsignal_cb(int fd, short what __attribute__((unused)), void *arg __attribute__((unused)))
{ {
static char signals[100]; static char signals[100];
#ifdef WIN32 #ifdef WIN32

View File

@ -89,9 +89,9 @@ public:
my_time_t execute_at; my_time_t execute_at;
my_time_t starts; my_time_t starts;
my_time_t ends; my_time_t ends;
my_bool starts_null; bool starts_null;
my_bool ends_null; bool ends_null;
my_bool execute_at_null; bool execute_at_null;
longlong expression; longlong expression;
interval_type interval; interval_type interval;

View File

@ -610,7 +610,7 @@ Event_db_repository::open_event_table(THD *thd, enum thr_lock_type lock_type,
bool bool
Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data, Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
my_bool create_if_not) bool create_if_not)
{ {
int ret= 1; int ret= 1;
TABLE *table= NULL; TABLE *table= NULL;

View File

@ -73,7 +73,7 @@ public:
Event_db_repository(){} Event_db_repository(){}
bool bool
create_event(THD *thd, Event_parse_data *parse_data, my_bool create_if_not); create_event(THD *thd, Event_parse_data *parse_data, bool create_if_not);
bool bool
update_event(THD *thd, Event_parse_data *parse_data, LEX_STRING *new_dbname, update_event(THD *thd, Event_parse_data *parse_data, LEX_STRING *new_dbname,

View File

@ -70,9 +70,9 @@ public:
my_time_t starts; my_time_t starts;
my_time_t ends; my_time_t ends;
my_time_t execute_at; my_time_t execute_at;
my_bool starts_null; bool starts_null;
my_bool ends_null; bool ends_null;
my_bool execute_at_null; bool execute_at_null;
sp_name *identifier; sp_name *identifier;
Item* item_expression; Item* item_expression;

View File

@ -917,7 +917,7 @@ Events::fill_schema_events(THD *thd, TABLE_LIST *tables, COND * /* cond */)
*/ */
bool bool
Events::init(my_bool opt_noacl_or_bootstrap) Events::init(bool opt_noacl_or_bootstrap)
{ {
THD *thd; THD *thd;

View File

@ -92,7 +92,7 @@ public:
get_db_repository() { return db_repository; } get_db_repository() { return db_repository; }
static bool static bool
init(my_bool opt_noacl); init(bool opt_noacl);
static void static void
deinit(); deinit();

View File

@ -1284,7 +1284,7 @@ static bool test_if_real(const char *str,int length, CHARSET_INFO *cs)
This is used for printing bit_fields as numbers while debugging. This is used for printing bit_fields as numbers while debugging.
*/ */
String *Field::val_int_as_str(String *val_buffer, my_bool unsigned_val) String *Field::val_int_as_str(String *val_buffer, bool unsigned_val)
{ {
ASSERT_COLUMN_MARKED_FOR_READ; ASSERT_COLUMN_MARKED_FOR_READ;
CHARSET_INFO *cs= &my_charset_bin; CHARSET_INFO *cs= &my_charset_bin;
@ -6855,7 +6855,7 @@ int Field_string::do_save_field_metadata(uchar *metadata_ptr)
*/ */
int Field_string::pack_cmp(const uchar *a, const uchar *b, uint length, int Field_string::pack_cmp(const uchar *a, const uchar *b, uint length,
my_bool insert_or_update) bool insert_or_update)
{ {
uint a_length, b_length; uint a_length, b_length;
if (length > 255) if (length > 255)
@ -6893,7 +6893,7 @@ int Field_string::pack_cmp(const uchar *a, const uchar *b, uint length,
*/ */
int Field_string::pack_cmp(const uchar *key, uint length, int Field_string::pack_cmp(const uchar *key, uint length,
my_bool insert_or_update) bool insert_or_update)
{ {
uint row_length, local_key_length; uint row_length, local_key_length;
uchar *end; uchar *end;
@ -7372,7 +7372,7 @@ Field_varstring::unpack(uchar *to, const uchar *from,
int Field_varstring::pack_cmp(const uchar *a, const uchar *b, int Field_varstring::pack_cmp(const uchar *a, const uchar *b,
uint key_length_arg, uint key_length_arg,
my_bool insert_or_update) bool insert_or_update)
{ {
uint a_length, b_length; uint a_length, b_length;
if (key_length_arg > 255) if (key_length_arg > 255)
@ -7393,7 +7393,7 @@ int Field_varstring::pack_cmp(const uchar *a, const uchar *b,
int Field_varstring::pack_cmp(const uchar *b, uint key_length_arg, int Field_varstring::pack_cmp(const uchar *b, uint key_length_arg,
my_bool insert_or_update) bool insert_or_update)
{ {
uchar *a= ptr+ length_bytes; uchar *a= ptr+ length_bytes;
uint a_length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr); uint a_length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
@ -8124,7 +8124,7 @@ const uchar *Field_blob::unpack(uchar *to,
/* Keys for blobs are like keys on varchars */ /* Keys for blobs are like keys on varchars */
int Field_blob::pack_cmp(const uchar *a, const uchar *b, uint key_length_arg, int Field_blob::pack_cmp(const uchar *a, const uchar *b, uint key_length_arg,
my_bool insert_or_update) bool insert_or_update)
{ {
uint a_length, b_length; uint a_length, b_length;
if (key_length_arg > 255) if (key_length_arg > 255)
@ -8145,7 +8145,7 @@ int Field_blob::pack_cmp(const uchar *a, const uchar *b, uint key_length_arg,
int Field_blob::pack_cmp(const uchar *b, uint key_length_arg, int Field_blob::pack_cmp(const uchar *b, uint key_length_arg,
my_bool insert_or_update) bool insert_or_update)
{ {
uchar *a; uchar *a;
uint a_length, b_length; uint a_length, b_length;

View File

@ -64,9 +64,9 @@ private:
*/ */
enum_field_types field_type; /* Real field type*/ enum_field_types field_type; /* Real field type*/
/* Flag indicating that the field is physically stored in the database */ /* Flag indicating that the field is physically stored in the database */
my_bool stored_in_db; bool stored_in_db;
/* Flag indicating that the field used in a partitioning expression */ /* Flag indicating that the field used in a partitioning expression */
my_bool in_partitioning_expr; bool in_partitioning_expr;
public: public:
/* The expression to compute the value of the virtual column */ /* The expression to compute the value of the virtual column */
@ -217,7 +217,7 @@ public:
This trickery is used to decrease a number of malloc calls. This trickery is used to decrease a number of malloc calls.
*/ */
virtual String *val_str(String*,String *)=0; virtual String *val_str(String*,String *)=0;
String *val_int_as_str(String *val_buffer, my_bool unsigned_flag); String *val_int_as_str(String *val_buffer, bool unsigned_flag);
/* /*
str_needs_quotes() returns TRUE if the value returned by val_str() needs str_needs_quotes() returns TRUE if the value returned by val_str() needs
to be quoted when used in constructing an SQL query. to be quoted when used in constructing an SQL query.
@ -516,10 +516,10 @@ public:
{ return max_length;} { return max_length;}
virtual int pack_cmp(const uchar *a,const uchar *b, uint key_length_arg, virtual int pack_cmp(const uchar *a,const uchar *b, uint key_length_arg,
my_bool insert_or_update) bool insert_or_update)
{ return cmp(a,b); } { return cmp(a,b); }
virtual int pack_cmp(const uchar *b, uint key_length_arg, virtual int pack_cmp(const uchar *b, uint key_length_arg,
my_bool insert_or_update) bool insert_or_update)
{ return cmp(ptr,b); } { return cmp(ptr,b); }
uint offset(uchar *record) uint offset(uchar *record)
{ {
@ -785,7 +785,7 @@ public:
/* base class for float and double and decimal (old one) */ /* base class for float and double and decimal (old one) */
class Field_real :public Field_num { class Field_real :public Field_num {
public: public:
my_bool not_fixed; bool not_fixed;
Field_real(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, Field_real(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg, uchar null_bit_arg, utype unireg_check_arg,
@ -1212,7 +1212,7 @@ public:
NONE, field_name_arg, dec_arg, 0, 0) NONE, field_name_arg, dec_arg, 0, 0)
{} {}
Field_double(uint32 len_arg, bool maybe_null_arg, const char *field_name_arg, Field_double(uint32 len_arg, bool maybe_null_arg, const char *field_name_arg,
uint8 dec_arg, my_bool not_fixed_arg) uint8 dec_arg, bool not_fixed_arg)
:Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0, :Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0,
NONE, field_name_arg, dec_arg, 0, 0) NONE, field_name_arg, dec_arg, 0, 0)
{not_fixed= not_fixed_arg; } {not_fixed= not_fixed_arg; }
@ -1303,7 +1303,7 @@ public:
Field::set_default(); Field::set_default();
} }
/* Get TIMESTAMP field value as seconds since begging of Unix Epoch */ /* Get TIMESTAMP field value as seconds since begging of Unix Epoch */
inline long get_timestamp(my_bool *null_value) inline long get_timestamp(bool *null_value)
{ {
if ((*null_value= is_null())) if ((*null_value= is_null()))
return 0; return 0;
@ -1590,8 +1590,8 @@ public:
const Relay_log_info *rli, uint16 mflags); const Relay_log_info *rli, uint16 mflags);
uint row_pack_length() { return (field_length + 1); } uint row_pack_length() { return (field_length + 1); }
int pack_cmp(const uchar *a,const uchar *b,uint key_length, int pack_cmp(const uchar *a,const uchar *b,uint key_length,
my_bool insert_or_update); bool insert_or_update);
int pack_cmp(const uchar *b,uint key_length,my_bool insert_or_update); int pack_cmp(const uchar *b,uint key_length,bool insert_or_update);
uint packed_col_length(const uchar *to, uint length); uint packed_col_length(const uchar *to, uint length);
uint max_packed_col_length(uint max_length); uint max_packed_col_length(uint max_length);
uint size_of() const { return sizeof(*this); } uint size_of() const { return sizeof(*this); }
@ -1673,8 +1673,8 @@ public:
const uchar *unpack_key(uchar* to, const uchar *from, const uchar *unpack_key(uchar* to, const uchar *from,
uint max_length, bool low_byte_first); uint max_length, bool low_byte_first);
int pack_cmp(const uchar *a, const uchar *b, uint key_length, int pack_cmp(const uchar *a, const uchar *b, uint key_length,
my_bool insert_or_update); bool insert_or_update);
int pack_cmp(const uchar *b, uint key_length,my_bool insert_or_update); int pack_cmp(const uchar *b, uint key_length,bool insert_or_update);
int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0L); int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0L);
int key_cmp(const uchar *,const uchar*); int key_cmp(const uchar *,const uchar*);
int key_cmp(const uchar *str, uint length); int key_cmp(const uchar *str, uint length);
@ -1859,8 +1859,8 @@ public:
const uchar *unpack_key(uchar* to, const uchar *from, const uchar *unpack_key(uchar* to, const uchar *from,
uint max_length, bool low_byte_first); uint max_length, bool low_byte_first);
int pack_cmp(const uchar *a, const uchar *b, uint key_length, int pack_cmp(const uchar *a, const uchar *b, uint key_length,
my_bool insert_or_update); bool insert_or_update);
int pack_cmp(const uchar *b, uint key_length,my_bool insert_or_update); int pack_cmp(const uchar *b, uint key_length,bool insert_or_update);
uint packed_col_length(const uchar *col_ptr, uint length); uint packed_col_length(const uchar *col_ptr, uint length);
uint max_packed_col_length(uint max_length); uint max_packed_col_length(uint max_length);
void free() { value.free(); } void free() { value.free(); }
@ -2222,7 +2222,7 @@ class Copy_field :public Sql_alloc {
public: public:
uchar *from_ptr,*to_ptr; uchar *from_ptr,*to_ptr;
uchar *from_null_ptr,*to_null_ptr; uchar *from_null_ptr,*to_null_ptr;
my_bool *null_row; bool *null_row;
uint from_bit,to_bit; uint from_bit,to_bit;
uint from_length,to_length; uint from_length,to_length;
Field *from_field,*to_field; Field *from_field,*to_field;

View File

@ -107,7 +107,7 @@ public:
return entry; return entry;
} }
my_bool add(hash_filo_element *entry) bool add(hash_filo_element *entry)
{ {
if (cache.records == size) if (cache.records == size)
{ {

View File

@ -424,8 +424,8 @@ Item::Item(THD *thd, Item *item):
with_sum_func(item->with_sum_func), with_sum_func(item->with_sum_func),
fixed(item->fixed), fixed(item->fixed),
is_autogenerated_name(item->is_autogenerated_name), is_autogenerated_name(item->is_autogenerated_name),
collation(item->collation),
with_subselect(item->with_subselect), with_subselect(item->with_subselect),
collation(item->collation),
cmp_context(item->cmp_context) cmp_context(item->cmp_context)
{ {
next= thd->free_list; // Put in free list next= thd->free_list; // Put in free list
@ -2806,7 +2806,7 @@ bool Item_param::set_from_user_var(THD *thd, const user_var_entry *entry)
unsigned_flag= entry->unsigned_flag; unsigned_flag= entry->unsigned_flag;
if (limit_clause_param) if (limit_clause_param)
{ {
my_bool unused; bool unused;
set_int(entry->val_int(&unused), MY_INT64_NUM_DECIMAL_DIGITS); set_int(entry->val_int(&unused), MY_INT64_NUM_DECIMAL_DIGITS);
item_type= Item::INT_ITEM; item_type= Item::INT_ITEM;
DBUG_RETURN(!unsigned_flag && value.integer < 0 ? 1 : 0); DBUG_RETURN(!unsigned_flag && value.integer < 0 ? 1 : 0);

View File

@ -536,17 +536,17 @@ public:
uint name_length; /* Length of name */ uint name_length; /* Length of name */
int8 marker; int8 marker;
uint8 decimals; uint8 decimals;
my_bool maybe_null; /* If item may be null */ bool maybe_null; /* If item may be null */
my_bool null_value; /* if item is null */ bool null_value; /* if item is null */
my_bool unsigned_flag; bool unsigned_flag;
my_bool with_sum_func; bool with_sum_func;
my_bool fixed; /* If item fixed with fix_fields */ bool fixed; /* If item fixed with fix_fields */
my_bool is_autogenerated_name; /* indicate was name of this Item bool is_autogenerated_name; /* indicate was name of this Item
autogenerated or set by user */ autogenerated or set by user */
DTCollation collation; bool with_subselect; /* If this item is a subselect or some
my_bool with_subselect; /* If this item is a subselect or some
of its arguments is or contains a of its arguments is or contains a
subselect */ subselect */
DTCollation collation;
Item_result cmp_context; /* Comparison context */ Item_result cmp_context; /* Comparison context */
// alloc & destruct is done as start of select using sql_alloc // alloc & destruct is done as start of select using sql_alloc
Item(); Item();
@ -2649,7 +2649,7 @@ class Item_int_with_ref :public Item_int
{ {
Item *ref; Item *ref;
public: public:
Item_int_with_ref(longlong i, Item *ref_arg, my_bool unsigned_arg) : Item_int_with_ref(longlong i, Item *ref_arg, bool unsigned_arg) :
Item_int(i), ref(ref_arg) Item_int(i), ref(ref_arg)
{ {
unsigned_flag= unsigned_arg; unsigned_flag= unsigned_arg;
@ -2883,7 +2883,7 @@ public:
class Cached_item :public Sql_alloc class Cached_item :public Sql_alloc
{ {
public: public:
my_bool null_value; bool null_value;
Cached_item() :null_value(0) {} Cached_item() :null_value(0) {}
virtual bool cmp(void)=0; virtual bool cmp(void)=0;
virtual ~Cached_item(); /*line -e1509 */ virtual ~Cached_item(); /*line -e1509 */

View File

@ -220,7 +220,7 @@ public:
class Item_cache; class Item_cache;
#define UNKNOWN ((my_bool)-1) #define UNKNOWN (-1)
/* /*
@ -249,7 +249,7 @@ protected:
FALSE - result is FALSE FALSE - result is FALSE
TRUE - result is NULL TRUE - result is NULL
*/ */
my_bool result_for_null_param; int result_for_null_param;
public: public:
Item_in_optimizer(Item *a, Item_in_subselect *b): Item_in_optimizer(Item *a, Item_in_subselect *b):
Item_bool_func(a, my_reinterpret_cast(Item *)(b)), cache(0), Item_bool_func(a, my_reinterpret_cast(Item *)(b)), cache(0),
@ -657,7 +657,7 @@ struct interval_range
class Item_func_interval :public Item_int_func class Item_func_interval :public Item_int_func
{ {
Item_row *row; Item_row *row;
my_bool use_decimal_comparison; bool use_decimal_comparison;
interval_range *intervals; interval_range *intervals;
public: public:
Item_func_interval(Item_row *a) Item_func_interval(Item_row *a)
@ -865,7 +865,7 @@ public:
void value_to_item(uint pos, Item *item) void value_to_item(uint pos, Item *item)
{ {
((Item_int*) item)->value= ((packed_longlong*) base)[pos].val; ((Item_int*) item)->value= ((packed_longlong*) base)[pos].val;
((Item_int*) item)->unsigned_flag= (my_bool) ((Item_int*) item)->unsigned_flag= (bool)
((packed_longlong*) base)[pos].unsigned_flag; ((packed_longlong*) base)[pos].unsigned_flag;
} }
Item_result result_type() { return INT_RESULT; } Item_result result_type() { return INT_RESULT; }

View File

@ -3120,11 +3120,15 @@ void Item_udf_func::print(String *str, enum_query_type query_type)
double Item_func_udf_float::val_real() double Item_func_udf_float::val_real()
{ {
double res;
my_bool tmp_null_value;
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
DBUG_ENTER("Item_func_udf_float::val"); DBUG_ENTER("Item_func_udf_float::val");
DBUG_PRINT("info",("result_type: %d arg_count: %d", DBUG_PRINT("info",("result_type: %d arg_count: %d",
args[0]->result_type(), arg_count)); args[0]->result_type(), arg_count));
DBUG_RETURN(udf.val(&null_value)); res= udf.val(&tmp_null_value);
null_value= tmp_null_value;
DBUG_RETURN(res);
} }
@ -3141,9 +3145,13 @@ String *Item_func_udf_float::val_str(String *str)
longlong Item_func_udf_int::val_int() longlong Item_func_udf_int::val_int()
{ {
longlong res;
my_bool tmp_null_value;
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
DBUG_ENTER("Item_func_udf_int::val_int"); DBUG_ENTER("Item_func_udf_int::val_int");
DBUG_RETURN(udf.val_int(&null_value)); res= udf.val_int(&tmp_null_value);
null_value= tmp_null_value;
DBUG_RETURN(res);
} }
@ -3160,8 +3168,10 @@ String *Item_func_udf_int::val_str(String *str)
longlong Item_func_udf_decimal::val_int() longlong Item_func_udf_decimal::val_int()
{ {
my_decimal dec_buf, *dec= udf.val_decimal(&null_value, &dec_buf); my_bool tmp_null_value;
longlong result; longlong result;
my_decimal dec_buf, *dec= udf.val_decimal(&tmp_null_value, &dec_buf);
null_value= tmp_null_value;
if (null_value) if (null_value)
return 0; return 0;
my_decimal2int(E_DEC_FATAL_ERROR, dec, unsigned_flag, &result); my_decimal2int(E_DEC_FATAL_ERROR, dec, unsigned_flag, &result);
@ -3171,8 +3181,10 @@ longlong Item_func_udf_decimal::val_int()
double Item_func_udf_decimal::val_real() double Item_func_udf_decimal::val_real()
{ {
my_decimal dec_buf, *dec= udf.val_decimal(&null_value, &dec_buf); my_bool tmp_null_value;
double result; double result;
my_decimal dec_buf, *dec= udf.val_decimal(&tmp_null_value, &dec_buf);
null_value= tmp_null_value;
if (null_value) if (null_value)
return 0.0; return 0.0;
my_decimal2double(E_DEC_FATAL_ERROR, dec, &result); my_decimal2double(E_DEC_FATAL_ERROR, dec, &result);
@ -3182,18 +3194,24 @@ double Item_func_udf_decimal::val_real()
my_decimal *Item_func_udf_decimal::val_decimal(my_decimal *dec_buf) my_decimal *Item_func_udf_decimal::val_decimal(my_decimal *dec_buf)
{ {
my_decimal *res;
my_bool tmp_null_value;
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
DBUG_ENTER("Item_func_udf_decimal::val_decimal"); DBUG_ENTER("Item_func_udf_decimal::val_decimal");
DBUG_PRINT("info",("result_type: %d arg_count: %d", DBUG_PRINT("info",("result_type: %d arg_count: %d",
args[0]->result_type(), arg_count)); args[0]->result_type(), arg_count));
DBUG_RETURN(udf.val_decimal(&null_value, dec_buf)); res= udf.val_decimal(&tmp_null_value, dec_buf);
null_value= tmp_null_value;
DBUG_RETURN(res);
} }
String *Item_func_udf_decimal::val_str(String *str) String *Item_func_udf_decimal::val_str(String *str)
{ {
my_decimal dec_buf, *dec= udf.val_decimal(&null_value, &dec_buf); my_bool tmp_null_value;
my_decimal dec_buf, *dec= udf.val_decimal(&tmp_null_value, &dec_buf);
null_value= tmp_null_value;
if (null_value) if (null_value)
return 0; return 0;
if (str->length() < DECIMAL_MAX_STR_LENGTH) if (str->length() < DECIMAL_MAX_STR_LENGTH)
@ -3954,7 +3972,7 @@ Item_func_set_user_var::update_hash(void *ptr, uint length,
/** Get the value of a variable as a double. */ /** Get the value of a variable as a double. */
double user_var_entry::val_real(my_bool *null_value) double user_var_entry::val_real(bool *null_value)
{ {
if ((*null_value= (value == 0))) if ((*null_value= (value == 0)))
return 0.0; return 0.0;
@ -3983,7 +4001,7 @@ double user_var_entry::val_real(my_bool *null_value)
/** Get the value of a variable as an integer. */ /** Get the value of a variable as an integer. */
longlong user_var_entry::val_int(my_bool *null_value) const longlong user_var_entry::val_int(bool *null_value) const
{ {
if ((*null_value= (value == 0))) if ((*null_value= (value == 0)))
return LL(0); return LL(0);
@ -4015,7 +4033,7 @@ longlong user_var_entry::val_int(my_bool *null_value) const
/** Get the value of a variable as a string. */ /** Get the value of a variable as a string. */
String *user_var_entry::val_str(my_bool *null_value, String *str, String *user_var_entry::val_str(bool *null_value, String *str,
uint decimals) uint decimals)
{ {
if ((*null_value= (value == 0))) if ((*null_value= (value == 0)))
@ -4048,7 +4066,7 @@ String *user_var_entry::val_str(my_bool *null_value, String *str,
/** Get the value of a variable as a decimal. */ /** Get the value of a variable as a decimal. */
my_decimal *user_var_entry::val_decimal(my_bool *null_value, my_decimal *val) my_decimal *user_var_entry::val_decimal(bool *null_value, my_decimal *val)
{ {
if ((*null_value= (value == 0))) if ((*null_value= (value == 0)))
return 0; return 0;

View File

@ -1517,7 +1517,7 @@ class Item_func_get_system_var :public Item_func
longlong cached_llval; longlong cached_llval;
double cached_dval; double cached_dval;
String cached_strval; String cached_strval;
my_bool cached_null_value; bool cached_null_value;
query_id_t used_query_id; query_id_t used_query_id;
uchar cache_present; uchar cache_present;

View File

@ -30,7 +30,7 @@ class Item_bool_func2;
class Item_subselect :public Item_result_field class Item_subselect :public Item_result_field
{ {
my_bool value_assigned; /* value already assigned to subselect */ bool value_assigned; /* value already assigned to subselect */
protected: protected:
/* thread handler, will be assigned in fix_fields only */ /* thread handler, will be assigned in fix_fields only */
THD *thd; THD *thd;
@ -432,9 +432,9 @@ protected:
class subselect_single_select_engine: public subselect_engine class subselect_single_select_engine: public subselect_engine
{ {
my_bool prepared; /* simple subselect is prepared */ bool prepared; /* simple subselect is prepared */
my_bool optimized; /* simple subselect is optimized */ bool optimized; /* simple subselect is optimized */
my_bool executed; /* simple subselect is executed */ bool executed; /* simple subselect is executed */
st_select_lex *select_lex; /* corresponding select_lex */ st_select_lex *select_lex; /* corresponding select_lex */
JOIN * join; /* corresponding JOIN structure */ JOIN * join; /* corresponding JOIN structure */
public: public:

View File

@ -2637,8 +2637,10 @@ void Item_udf_sum::clear()
bool Item_udf_sum::add() bool Item_udf_sum::add()
{ {
my_bool tmp_null_value;
DBUG_ENTER("Item_udf_sum::add"); DBUG_ENTER("Item_udf_sum::add");
udf.add(&null_value); udf.add(&tmp_null_value);
null_value= tmp_null_value;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -2674,11 +2676,15 @@ Item *Item_sum_udf_float::copy_or_same(THD* thd)
double Item_sum_udf_float::val_real() double Item_sum_udf_float::val_real()
{ {
my_bool tmp_null_value;
double res;
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
DBUG_ENTER("Item_sum_udf_float::val"); DBUG_ENTER("Item_sum_udf_float::val");
DBUG_PRINT("info",("result_type: %d arg_count: %d", DBUG_PRINT("info",("result_type: %d arg_count: %d",
args[0]->result_type(), arg_count)); args[0]->result_type(), arg_count));
DBUG_RETURN(udf.val(&null_value)); res= udf.val(&tmp_null_value);
null_value= tmp_null_value;
DBUG_RETURN(res);
} }
@ -2714,12 +2720,16 @@ longlong Item_sum_udf_decimal::val_int()
my_decimal *Item_sum_udf_decimal::val_decimal(my_decimal *dec_buf) my_decimal *Item_sum_udf_decimal::val_decimal(my_decimal *dec_buf)
{ {
my_decimal *res;
my_bool tmp_null_value;
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
DBUG_ENTER("Item_func_udf_decimal::val_decimal"); DBUG_ENTER("Item_func_udf_decimal::val_decimal");
DBUG_PRINT("info",("result_type: %d arg_count: %d", DBUG_PRINT("info",("result_type: %d arg_count: %d",
args[0]->result_type(), arg_count)); args[0]->result_type(), arg_count));
DBUG_RETURN(udf.val_decimal(&null_value, dec_buf)); res= udf.val_decimal(&tmp_null_value, dec_buf);
null_value= tmp_null_value;
DBUG_RETURN(res);
} }
@ -2736,11 +2746,15 @@ Item *Item_sum_udf_int::copy_or_same(THD* thd)
longlong Item_sum_udf_int::val_int() longlong Item_sum_udf_int::val_int()
{ {
my_bool tmp_null_value;
longlong res;
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
DBUG_ENTER("Item_sum_udf_int::val_int"); DBUG_ENTER("Item_sum_udf_int::val_int");
DBUG_PRINT("info",("result_type: %d arg_count: %d", DBUG_PRINT("info",("result_type: %d arg_count: %d",
args[0]->result_type(), arg_count)); args[0]->result_type(), arg_count));
DBUG_RETURN(udf.val_int(&null_value)); res= udf.val_int(&tmp_null_value);
null_value= tmp_null_value;
DBUG_RETURN(res);
} }

View File

@ -89,12 +89,12 @@ class File_parser: public Sql_alloc
{ {
char *buff, *start, *end; char *buff, *start, *end;
LEX_STRING file_type; LEX_STRING file_type;
my_bool content_ok; bool content_ok;
public: public:
File_parser() :buff(0), start(0), end(0), content_ok(0) File_parser() :buff(0), start(0), end(0), content_ok(0)
{ file_type.str= 0; file_type.length= 0; } { file_type.str= 0; file_type.length= 0; }
my_bool ok() { return content_ok; } bool ok() { return content_ok; }
LEX_STRING *type() { return &file_type; } LEX_STRING *type() { return &file_type; }
my_bool parse(uchar* base, MEM_ROOT *mem_root, my_bool parse(uchar* base, MEM_ROOT *mem_root,
struct File_option *parameters, uint required, struct File_option *parameters, uint required,

View File

@ -66,10 +66,10 @@ class Master_info : public Slave_reporting_capability
char host[HOSTNAME_LENGTH+1]; char host[HOSTNAME_LENGTH+1];
char user[USERNAME_LENGTH+1]; char user[USERNAME_LENGTH+1];
char password[MAX_PASSWORD_LENGTH+1]; char password[MAX_PASSWORD_LENGTH+1];
my_bool ssl; // enables use of SSL connection if true bool ssl; // enables use of SSL connection if true
char ssl_ca[FN_REFLEN], ssl_capath[FN_REFLEN], ssl_cert[FN_REFLEN]; char ssl_ca[FN_REFLEN], ssl_capath[FN_REFLEN], ssl_cert[FN_REFLEN];
char ssl_cipher[FN_REFLEN], ssl_key[FN_REFLEN]; char ssl_cipher[FN_REFLEN], ssl_key[FN_REFLEN];
my_bool ssl_verify_server_cert; bool ssl_verify_server_cert;
my_off_t master_log_pos; my_off_t master_log_pos;
File fd; // we keep the file open, so we need to remember the file pointer File fd; // we keep the file open, so we need to remember the file pointer

View File

@ -281,7 +281,7 @@ public:
int int
close(THD *thd); close(THD *thd);
inline my_bool inline bool
is_open() is_open()
{ {
return test(server_side_cursor); return test(server_side_cursor);

View File

@ -71,7 +71,7 @@ class field_info :public Sql_alloc
protected: protected:
ulong treemem, tree_elements, empty, nulls, min_length, max_length; ulong treemem, tree_elements, empty, nulls, min_length, max_length;
uint room_in_tree; uint room_in_tree;
my_bool found; bool found;
TREE tree; TREE tree;
Item *item; Item *item;
analyse *pc; analyse *pc;

View File

@ -2341,7 +2341,8 @@ bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list, bool link_in)
table->tablenr=thd->current_tablenr++; table->tablenr=thd->current_tablenr++;
table->used_fields=0; table->used_fields=0;
table->const_table=0; table->const_table=0;
table->null_row= table->maybe_null= 0; table->null_row= 0;
table->maybe_null= 0;
table->force_index= table->force_index_order= table->force_index_group= 0; table->force_index= table->force_index_order= table->force_index_group= 0;
table->status=STATUS_NO_RECORD; table->status=STATUS_NO_RECORD;
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
@ -3007,7 +3008,8 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
table->tablenr=thd->current_tablenr++; table->tablenr=thd->current_tablenr++;
table->used_fields=0; table->used_fields=0;
table->const_table=0; table->const_table=0;
table->null_row= table->maybe_null= 0; table->null_row= 0;
table->maybe_null= 0;
table->force_index= table->force_index_order= table->force_index_group= 0; table->force_index= table->force_index_order= table->force_index_group= 0;
table->status=STATUS_NO_RECORD; table->status=STATUS_NO_RECORD;
table->insert_values= 0; table->insert_values= 0;

View File

@ -60,13 +60,13 @@ public:
} }
void subtract(Bitmap& map2) { bitmap_subtract(&map, &map2.map); } void subtract(Bitmap& map2) { bitmap_subtract(&map, &map2.map); }
void merge(Bitmap& map2) { bitmap_union(&map, &map2.map); } void merge(Bitmap& map2) { bitmap_union(&map, &map2.map); }
my_bool is_set(uint n) const { return bitmap_is_set(&map, n); } bool is_set(uint n) const { return bitmap_is_set(&map, n); }
my_bool is_prefix(uint n) const { return bitmap_is_prefix(&map, n); } bool is_prefix(uint n) const { return bitmap_is_prefix(&map, n); }
my_bool is_clear_all() const { return bitmap_is_clear_all(&map); } bool is_clear_all() const { return bitmap_is_clear_all(&map); }
my_bool is_set_all() const { return bitmap_is_set_all(&map); } bool is_set_all() const { return bitmap_is_set_all(&map); }
my_bool is_subset(const Bitmap& map2) const { return bitmap_is_subset(&map, &map2.map); } bool is_subset(const Bitmap& map2) const { return bitmap_is_subset(&map, &map2.map); }
my_bool is_overlapping(const Bitmap& map2) const { return bitmap_is_overlapping(&map, &map2.map); } bool is_overlapping(const Bitmap& map2) const { return bitmap_is_overlapping(&map, &map2.map); }
my_bool operator==(const Bitmap& map2) const { return bitmap_cmp(&map, &map2.map); } bool operator==(const Bitmap& map2) const { return bitmap_cmp(&map, &map2.map); }
char *print(char *buf) const char *print(char *buf) const
{ {
char *s=buf; char *s=buf;
@ -155,13 +155,13 @@ public:
void intersect_extended(ulonglong map2) { map&= map2; } void intersect_extended(ulonglong map2) { map&= map2; }
void subtract(Bitmap<64>& map2) { map&= ~map2.map; } void subtract(Bitmap<64>& map2) { map&= ~map2.map; }
void merge(Bitmap<64>& map2) { map|= map2.map; } void merge(Bitmap<64>& map2) { map|= map2.map; }
my_bool is_set(uint n) const { return test(map & (((ulonglong)1) << n)); } bool is_set(uint n) const { return test(map & (((ulonglong)1) << n)); }
my_bool is_prefix(uint n) const { return map == (((ulonglong)1) << n)-1; } bool is_prefix(uint n) const { return map == (((ulonglong)1) << n)-1; }
my_bool is_clear_all() const { return map == (ulonglong)0; } bool is_clear_all() const { return map == (ulonglong)0; }
my_bool is_set_all() const { return map == ~(ulonglong)0; } bool is_set_all() const { return map == ~(ulonglong)0; }
my_bool is_subset(const Bitmap<64>& map2) const { return !(map & ~map2.map); } bool is_subset(const Bitmap<64>& map2) const { return !(map & ~map2.map); }
my_bool is_overlapping(const Bitmap<64>& map2) const { return (map & map2.map)!= 0; } bool is_overlapping(const Bitmap<64>& map2) const { return (map & map2.map)!= 0; }
my_bool operator==(const Bitmap<64>& map2) const { return map == map2.map; } bool operator==(const Bitmap<64>& map2) const { return map == map2.map; }
char *print(char *buf) const { longlong2str(map,buf,16,1); return buf; } char *print(char *buf) const { longlong2str(map,buf,16,1); return buf; }
ulonglong to_ulonglong() const { return map; } ulonglong to_ulonglong() const { return map; }
class Iterator : public Table_map_iterator class Iterator : public Table_map_iterator

View File

@ -740,7 +740,7 @@ inline void Query_cache_query::lock_writing()
remove it. remove it.
*/ */
my_bool Query_cache_query::try_lock_writing() bool Query_cache_query::try_lock_writing()
{ {
DBUG_ENTER("Query_cache_block::try_lock_writing"); DBUG_ENTER("Query_cache_block::try_lock_writing");
if (rw_trywrlock(&lock)!=0) if (rw_trywrlock(&lock)!=0)

View File

@ -121,7 +121,7 @@ struct Query_cache_block
block_type type; block_type type;
TABLE_COUNTER_TYPE n_tables; // number of tables in query TABLE_COUNTER_TYPE n_tables; // number of tables in query
inline my_bool is_free(void) { return type == FREE; } inline bool is_free(void) { return type == FREE; }
void init(ulong length); void init(ulong length);
void destroy(); void destroy();
inline uint headers_len(); inline uint headers_len();
@ -162,7 +162,7 @@ struct Query_cache_query
} }
void lock_writing(); void lock_writing();
void lock_reading(); void lock_reading();
my_bool try_lock_writing(); bool try_lock_writing();
void unlock_writing(); void unlock_writing();
void unlock_reading(); void unlock_reading();
}; };
@ -312,7 +312,7 @@ protected:
uint mem_bin_num, mem_bin_steps; // See at init_cache & find_bin uint mem_bin_num, mem_bin_steps; // See at init_cache & find_bin
my_bool initialized; bool initialized;
/* Exclude/include from cyclic double linked list */ /* Exclude/include from cyclic double linked list */
static void double_linked_list_exclude(Query_cache_block *point, static void double_linked_list_exclude(Query_cache_block *point,

View File

@ -295,6 +295,9 @@ struct system_variables
When attempting to access a dynamic variable, if the session version When attempting to access a dynamic variable, if the session version
is out of date, then the session version is updated and realloced if is out of date, then the session version is updated and realloced if
neccessary and bytes copied from global to make up for missing data. neccessary and bytes copied from global to make up for missing data.
Note that one should use my_bool instead of bool here, as the variables
are used with my_getopt.c
*/ */
ulong dynamic_variables_version; ulong dynamic_variables_version;
char* dynamic_variables_ptr; char* dynamic_variables_ptr;
@ -1887,7 +1890,7 @@ public:
bool no_warnings_for_error; /* no warnings on call to my_error() */ bool no_warnings_for_error; /* no warnings on call to my_error() */
/* set during loop of derived table processing */ /* set during loop of derived table processing */
bool derived_tables_processing; bool derived_tables_processing;
my_bool tablespace_op; /* This is TRUE in DISCARD/IMPORT TABLESPACE */ bool tablespace_op; /* This is TRUE in DISCARD/IMPORT TABLESPACE */
sp_rcontext *spcont; // SP runtime context sp_rcontext *spcont; // SP runtime context
sp_cache *sp_proc_cache; sp_cache *sp_proc_cache;
@ -2958,10 +2961,10 @@ class user_var_entry
Item_result type; Item_result type;
bool unsigned_flag; bool unsigned_flag;
double val_real(my_bool *null_value); double val_real(bool *null_value);
longlong val_int(my_bool *null_value) const; longlong val_int(bool *null_value) const;
String *val_str(my_bool *null_value, String *str, uint decimals); String *val_str(bool *null_value, String *str, uint decimals);
my_decimal *val_decimal(my_bool *null_value, my_decimal *result); my_decimal *val_decimal(bool *null_value, my_decimal *result);
DTCollation collation; DTCollation collation;
}; };

View File

@ -3487,7 +3487,8 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
tmp_table.s->db_low_byte_first= tmp_table.s->db_low_byte_first=
test(create_info->db_type == myisam_hton || test(create_info->db_type == myisam_hton ||
create_info->db_type == heap_hton); create_info->db_type == heap_hton);
tmp_table.null_row=tmp_table.maybe_null=0; tmp_table.null_row= 0;
tmp_table.maybe_null= 0;
while ((item=it++)) while ((item=it++))
{ {

View File

@ -2185,7 +2185,7 @@ static const char *get_dynamic_sql_string(LEX *lex, uint *query_len)
lex->prepared_stmt_code.length)) lex->prepared_stmt_code.length))
&& entry->value) && entry->value)
{ {
my_bool is_var_null; bool is_var_null;
var_value= entry->val_str(&is_var_null, &str, NOT_FIXED_DEC); var_value= entry->val_str(&is_var_null, &str, NOT_FIXED_DEC);
/* /*
NULL value of variable checked early as entry->value so here NULL value of variable checked early as entry->value so here

View File

@ -793,7 +793,7 @@ struct st_table {
/* number of select if it is derived table */ /* number of select if it is derived table */
uint derived_select_number; uint derived_select_number;
int current_lock; /* Type of lock on table */ int current_lock; /* Type of lock on table */
my_bool copy_blobs; /* copy_blobs when storing */ bool copy_blobs; /* copy_blobs when storing */
/* /*
0 or JOIN_TYPE_{LEFT|RIGHT}. Currently this is only compared to 0. 0 or JOIN_TYPE_{LEFT|RIGHT}. Currently this is only compared to 0.
@ -805,34 +805,34 @@ struct st_table {
If true, the current table row is considered to have all columns set to If true, the current table row is considered to have all columns set to
NULL, including columns declared as "not null" (see maybe_null). NULL, including columns declared as "not null" (see maybe_null).
*/ */
my_bool null_row; bool null_row;
/* /*
TODO: Each of the following flags take up 8 bits. They can just as easily TODO: Each of the following flags take up 8 bits. They can just as easily
be put into one single unsigned long and instead of taking up 18 be put into one single unsigned long and instead of taking up 18
bytes, it would take up 4. bytes, it would take up 4.
*/ */
my_bool force_index; bool force_index;
/** /**
Flag set when the statement contains FORCE INDEX FOR ORDER BY Flag set when the statement contains FORCE INDEX FOR ORDER BY
See TABLE_LIST::process_index_hints(). See TABLE_LIST::process_index_hints().
*/ */
my_bool force_index_order; bool force_index_order;
/** /**
Flag set when the statement contains FORCE INDEX FOR GROUP BY Flag set when the statement contains FORCE INDEX FOR GROUP BY
See TABLE_LIST::process_index_hints(). See TABLE_LIST::process_index_hints().
*/ */
my_bool force_index_group; bool force_index_group;
my_bool distinct,const_table,no_rows; bool distinct,const_table,no_rows;
/** /**
If set, the optimizer has found that row retrieval should access index If set, the optimizer has found that row retrieval should access index
tree only. tree only.
*/ */
my_bool key_read; bool key_read;
my_bool no_keyread; bool no_keyread;
/* /*
Placeholder for an open table which prevents other connections Placeholder for an open table which prevents other connections
from taking name-locks on this table. Typically used with from taking name-locks on this table. Typically used with
@ -850,25 +850,25 @@ struct st_table {
object associated with it (db_stat is always 0), but please do object associated with it (db_stat is always 0), but please do
not rely on that. not rely on that.
*/ */
my_bool open_placeholder; bool open_placeholder;
my_bool locked_by_logger; bool locked_by_logger;
my_bool no_replicate; bool no_replicate;
my_bool locked_by_name; bool locked_by_name;
my_bool fulltext_searched; bool fulltext_searched;
my_bool no_cache; bool no_cache;
/* To signal that the table is associated with a HANDLER statement */ /* To signal that the table is associated with a HANDLER statement */
my_bool open_by_handler; bool open_by_handler;
/* /*
To indicate that a non-null value of the auto_increment field To indicate that a non-null value of the auto_increment field
was provided by the user or retrieved from the current record. was provided by the user or retrieved from the current record.
Used only in the MODE_NO_AUTO_VALUE_ON_ZERO mode. Used only in the MODE_NO_AUTO_VALUE_ON_ZERO mode.
*/ */
my_bool auto_increment_field_not_null; bool auto_increment_field_not_null;
my_bool insert_or_update; /* Can be used by the handler */ bool insert_or_update; /* Can be used by the handler */
my_bool alias_name_used; /* true if table_name is alias */ bool alias_name_used; /* true if table_name is alias */
my_bool get_fields_in_item_tree; /* Signal to fix_field */ bool get_fields_in_item_tree; /* Signal to fix_field */
/* If MERGE children attached to parent. See top comment in ha_myisammrg.cc */ /* If MERGE children attached to parent. See top comment in ha_myisammrg.cc */
my_bool children_attached; bool children_attached;
REGINFO reginfo; /* field connections */ REGINFO reginfo; /* field connections */
MEM_ROOT mem_root; MEM_ROOT mem_root;

View File

@ -4401,8 +4401,7 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
goto err; goto err;
} }
} }
share->state.state.data_file_length= share->state.state.data_file_length= share->state.state.data_file_length= sort_param->filepos;
sort_param->filepos;
/* Only whole records */ /* Only whole records */
share->state.version= (ulong) time((time_t*) 0); share->state.version= (ulong) time((time_t*) 0);
/* /*

View File

@ -346,7 +346,7 @@ int decimal2string(decimal_t *from, char *to, int *to_len,
char *s=to; char *s=to;
dec1 *buf, *buf0=from->buf, tmp; dec1 *buf, *buf0=from->buf, tmp;
DBUG_ASSERT(*to_len >= 2+from->sign); DBUG_ASSERT(*to_len >= 2+ (int) from->sign);
/* removing leading zeroes */ /* removing leading zeroes */
buf0= remove_leading_zeroes(from, &intg); buf0= remove_leading_zeroes(from, &intg);
@ -1801,7 +1801,8 @@ static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to)
int intg1=ROUND_UP(from1->intg), intg2=ROUND_UP(from2->intg), int intg1=ROUND_UP(from1->intg), intg2=ROUND_UP(from2->intg),
frac1=ROUND_UP(from1->frac), frac2=ROUND_UP(from2->frac); frac1=ROUND_UP(from1->frac), frac2=ROUND_UP(from2->frac);
int frac0=max(frac1, frac2), error; int frac0=max(frac1, frac2), error;
dec1 *buf1, *buf2, *buf0, *stop1, *stop2, *start1, *start2, carry=0; dec1 *buf1, *buf2, *buf0, *stop1, *stop2, *start1, *start2;
my_bool carry=0;
/* let carry:=1 if from2 > from1 */ /* let carry:=1 if from2 > from1 */
start1=buf1=from1->buf; stop1=buf1+intg1; start1=buf1=from1->buf; stop1=buf1+intg1;
@ -1869,7 +1870,7 @@ static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to)
swap_variables(dec1 *,start1, start2); swap_variables(dec1 *,start1, start2);
swap_variables(int,intg1,intg2); swap_variables(int,intg1,intg2);
swap_variables(int,frac1,frac2); swap_variables(int,frac1,frac2);
to->sign= 1 - to->sign; to->sign= !to->sign;
} }
FIX_INTG_FRAC_ERROR(to->len, intg1, frac0, error); FIX_INTG_FRAC_ERROR(to->len, intg1, frac0, error);