Commit d0c69399 authored by unknown's avatar unknown

misc fixes for compile-time errors


sql/item_sum.cc:
  "unused variable" warning
sql/item_timefunc.cc:
  "unused variable" warning
sql/log_event.h:
  const bool is_valid() -> bool is_valid() const
sql/opt_range.cc:
  cast log's argument to double (otherwise an error on some compilers)
sql/opt_range.h:
  get_quick_select_for_ref should be declared in the global scope to be visible.
parent 362ce6a8
......@@ -2102,7 +2102,6 @@ bool Item_func_group_concat::setup(THD *thd)
List<Item> list;
SELECT_LEX *select_lex= thd->lex->current_select;
uint const_fields;
byte *record;
qsort_cmp2 compare_key;
DBUG_ENTER("Item_func_group_concat::setup");
......@@ -2163,7 +2162,6 @@ bool Item_func_group_concat::setup(THD *thd)
table->no_rows= 1;
key_length= table->reclength;
record= table->record[0];
/* Offset to first result field in table */
field_list_offset= table->fields - (list.elements - const_fields);
......
......@@ -2519,7 +2519,6 @@ longlong Item_func_timestamp_diff::val_int()
uint year;
uint year_beg, year_end, month_beg, month_end;
uint diff_days= (uint) (seconds/86400L);
uint diff_months= 0;
uint diff_years= 0;
if (neg == -1)
{
......
......@@ -521,7 +521,7 @@ class Log_event
virtual int write_data_body(IO_CACHE* file __attribute__((unused)))
{ return 0; }
virtual Log_event_type get_type_code() = 0;
virtual const bool is_valid() = 0;
virtual bool is_valid() const = 0;
inline bool get_cache_stmt() { return cache_stmt; }
Log_event(const char* buf, const Format_description_log_event* description_event);
virtual ~Log_event() { free_temp_buf();}
......@@ -669,7 +669,7 @@ class Query_log_event: public Log_event
Log_event_type get_type_code() { return QUERY_EVENT; }
int write(IO_CACHE* file);
int write_data(IO_CACHE* file); // returns 0 on success, -1 on error
const bool is_valid() { return query != 0; }
bool is_valid() const { return query != 0; }
int get_data_size()
{
/* Note that the "1" below is the db's length. */
......@@ -711,7 +711,7 @@ class Slave_log_event: public Log_event
Slave_log_event(const char* buf, uint event_len);
~Slave_log_event();
int get_data_size();
const bool is_valid() { return master_host != 0; }
bool is_valid() const { return master_host != 0; }
Log_event_type get_type_code() { return SLAVE_EVENT; }
int write_data(IO_CACHE* file );
};
......@@ -806,7 +806,7 @@ class Load_log_event: public Log_event
}
int write_data_header(IO_CACHE* file);
int write_data_body(IO_CACHE* file);
const bool is_valid() { return table_name != 0; }
bool is_valid() const { return table_name != 0; }
int get_data_size()
{
return (table_name_len + db_len + 2 + fname_len
......@@ -873,7 +873,7 @@ class Start_log_event_v3: public Log_event
~Start_log_event_v3() {}
Log_event_type get_type_code() { return START_EVENT_V3;}
int write_data(IO_CACHE* file);
const bool is_valid() { return 1; }
bool is_valid() const { return 1; }
int get_data_size()
{
return START_V3_HEADER_LEN; //no variable-sized part
......@@ -913,7 +913,7 @@ class Format_description_log_event: public Start_log_event_v3
~Format_description_log_event() { my_free((gptr)post_header_len, MYF(0)); }
Log_event_type get_type_code() { return FORMAT_DESCRIPTION_EVENT;}
int write_data(IO_CACHE* file);
const bool is_valid()
bool is_valid() const
{
return ((common_header_len >= ((binlog_version==1) ? OLD_HEADER_LEN :
LOG_EVENT_MINIMAL_HEADER_LEN)) &&
......@@ -968,7 +968,7 @@ class Intvar_log_event: public Log_event
const char* get_var_type_name();
int get_data_size() { return 9; /* sizeof(type) + sizeof(val) */;}
int write_data(IO_CACHE* file);
const bool is_valid() { return 1; }
bool is_valid() const { return 1; }
};
/*****************************************************************************
......@@ -1004,7 +1004,7 @@ class Rand_log_event: public Log_event
Log_event_type get_type_code() { return RAND_EVENT;}
int get_data_size() { return 16; /* sizeof(ulonglong) * 2*/ }
int write_data(IO_CACHE* file);
const bool is_valid() { return 1; }
bool is_valid() const { return 1; }
};
/*****************************************************************************
......@@ -1051,7 +1051,7 @@ class User_var_log_event: public Log_event
UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE + val_len);
}
int write_data(IO_CACHE* file);
const bool is_valid() { return 1; }
bool is_valid() const { return 1; }
};
/*****************************************************************************
......@@ -1077,7 +1077,7 @@ class Stop_log_event: public Log_event
{}
~Stop_log_event() {}
Log_event_type get_type_code() { return STOP_EVENT;}
const bool is_valid() { return 1; }
bool is_valid() const { return 1; }
};
#endif /* HAVE_REPLICATION */
......@@ -1126,7 +1126,7 @@ class Rotate_log_event: public Log_event
return (LOG_EVENT_MINIMAL_HEADER_LEN + get_data_size());
}
int get_data_size() { return ident_len + ROTATE_HEADER_LEN;}
const bool is_valid() { return new_log_ident != 0; }
bool is_valid() const { return new_log_ident != 0; }
int write_data(IO_CACHE* file);
};
......@@ -1186,7 +1186,7 @@ class Create_file_log_event: public Load_log_event
Load_log_event::get_data_size() +
4 + 1 + block_len);
}
const bool is_valid() { return inited_from_old || block != 0; }
bool is_valid() const { return inited_from_old || block != 0; }
int write_data_header(IO_CACHE* file);
int write_data_body(IO_CACHE* file);
/*
......@@ -1236,7 +1236,7 @@ class Append_block_log_event: public Log_event
~Append_block_log_event() {}
Log_event_type get_type_code() { return APPEND_BLOCK_EVENT;}
int get_data_size() { return block_len + APPEND_BLOCK_HEADER_LEN ;}
const bool is_valid() { return block != 0; }
bool is_valid() const { return block != 0; }
int write_data(IO_CACHE* file);
const char* get_db() { return db; }
};
......@@ -1268,7 +1268,7 @@ class Delete_file_log_event: public Log_event
~Delete_file_log_event() {}
Log_event_type get_type_code() { return DELETE_FILE_EVENT;}
int get_data_size() { return DELETE_FILE_HEADER_LEN ;}
const bool is_valid() { return file_id != 0; }
bool is_valid() const { return file_id != 0; }
int write_data(IO_CACHE* file);
const char* get_db() { return db; }
};
......@@ -1299,7 +1299,7 @@ class Execute_load_log_event: public Log_event
~Execute_load_log_event() {}
Log_event_type get_type_code() { return EXEC_LOAD_EVENT;}
int get_data_size() { return EXEC_LOAD_HEADER_LEN ;}
const bool is_valid() { return file_id != 0; }
bool is_valid() const { return file_id != 0; }
int write_data(IO_CACHE* file);
const char* get_db() { return db; }
};
......@@ -1319,7 +1319,7 @@ class Unknown_log_event: public Log_event
~Unknown_log_event() {}
void print(FILE* file, bool short_form= 0, LAST_EVENT_INFO* last_event_info= 0);
Log_event_type get_type_code() { return UNKNOWN_EVENT;}
const bool is_valid() { return 1; }
bool is_valid() const { return 1; }
};
#endif
......
......@@ -2070,7 +2070,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
double roru_total_cost;
roru_total_cost= roru_index_costs +
rows2double(roru_total_records)*log(n_child_scans) /
rows2double(roru_total_records)*log((double)n_child_scans) /
(TIME_FOR_COMPARE_ROWID * M_LN2) +
get_sweep_read_cost(param, roru_total_records);
......@@ -2895,7 +2895,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
tree->ror_scans, ror_scan_mark););
/* Add priority queue use cost. */
total_cost += rows2double(records)*log(ror_scan_mark - tree->ror_scans) /
total_cost += rows2double(records)*
log((double)(ror_scan_mark - tree->ror_scans)) /
(TIME_FOR_COMPARE_ROWID * M_LN2);
DBUG_PRINT("info", ("Covering ROR-intersect full cost: %g", total_cost));
......
......@@ -569,4 +569,6 @@ class FT_SELECT: public QUICK_RANGE_SELECT {
int get_type() { return QS_TYPE_FULLTEXT; }
};
QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
struct st_table_ref *ref);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment