Commit f887a956 authored by Antony T Curtis's avatar Antony T Curtis

Const correctness and include dependency fixes.

parent 98e1bc25
......@@ -114,7 +114,7 @@ static bool report_unknown_option(THD *thd, engine_option_value *val,
DBUG_RETURN(FALSE);
}
static bool set_one_value(ha_create_table_option *opt,
static bool set_one_value(const ha_create_table_option *opt,
THD *thd, LEX_STRING *value, void *base,
my_bool suppress_warning,
MEM_ROOT *root)
......@@ -259,11 +259,11 @@ static const size_t ha_option_type_sizeof[]=
my_bool parse_option_list(THD* thd, void *option_struct_arg,
engine_option_value *option_list,
ha_create_table_option *rules,
const ha_create_table_option *rules,
my_bool suppress_warning,
MEM_ROOT *root)
{
ha_create_table_option *opt;
const ha_create_table_option *opt;
size_t option_struct_size= 0;
engine_option_value *val= option_list;
void **option_struct= (void**)option_struct_arg;
......
......@@ -73,7 +73,7 @@ my_bool parse_engine_table_options(THD *thd, handlerton *ht,
TABLE_SHARE *share);
my_bool parse_option_list(THD* thd, void *option_struct,
engine_option_value *option_list,
ha_create_table_option *rules,
const ha_create_table_option *rules,
my_bool suppress_warning,
MEM_ROOT *root);
my_bool engine_table_options_frm_read(const uchar *buff,
......
......@@ -1053,9 +1053,9 @@ struct handlerton
/*
Optional clauses in the CREATE/ALTER TABLE
*/
ha_create_table_option *table_options; // table level options
ha_create_table_option *field_options; // these are specified per field
ha_create_table_option *index_options; // these are specified per index
const ha_create_table_option *table_options; // table level options
const ha_create_table_option *field_options; // these are specified per field
const ha_create_table_option *index_options; // these are specified per index
};
......
......@@ -3592,6 +3592,23 @@ void Item_udf_func::print(String *str, enum_query_type query_type)
}
longlong Item_func_udf_float::val_int()
{
DBUG_ASSERT(fixed == 1);
return (longlong) rint(Item_func_udf_float::val_real());
}
my_decimal *Item_func_udf_float::val_decimal(my_decimal *dec_buf)
{
double res=val_real();
if (null_value)
return NULL;
double2my_decimal(E_DEC_FATAL_ERROR, res, dec_buf);
return dec_buf;
}
double Item_func_udf_float::val_real()
{
double res;
......@@ -3721,6 +3738,32 @@ String *Item_func_udf_str::val_str(String *str)
return res;
}
double Item_func_udf_str::val_real()
{
int err_not_used;
char *end_not_used;
String *res;
res= val_str(&str_value);
return res ? my_strntod(res->charset(),(char*) res->ptr(),
res->length(), &end_not_used, &err_not_used) : 0.0;
}
longlong Item_func_udf_str::val_int()
{
int err_not_used;
String *res; res=val_str(&str_value);
return res ? my_strntoll(res->charset(),res->ptr(),res->length(),10,
(char**) 0, &err_not_used) : (longlong) 0;
}
my_decimal *Item_func_udf_str::val_decimal(my_decimal *dec_buf)
{
String *res=val_str(&str_value);
if (!res)
return NULL;
string2my_decimal(E_DEC_FATAL_ERROR, res, dec_buf);
return dec_buf;
}
/**
@note
......
......@@ -1358,19 +1358,8 @@ class Item_func_udf_float :public Item_udf_func
Item_func_udf_float(udf_func *udf_arg,
List<Item> &list)
:Item_udf_func(udf_arg, list) {}
longlong val_int()
{
DBUG_ASSERT(fixed == 1);
return (longlong) rint(Item_func_udf_float::val_real());
}
my_decimal *val_decimal(my_decimal *dec_buf)
{
double res=val_real();
if (null_value)
return NULL;
double2my_decimal(E_DEC_FATAL_ERROR, res, dec_buf);
return dec_buf;
}
longlong val_int();
my_decimal *val_decimal(my_decimal *dec_buf);
double val_real();
String *val_str(String *str);
void fix_length_and_dec() { fix_num_length_and_dec(); }
......@@ -1417,30 +1406,9 @@ public:
Item_func_udf_str(udf_func *udf_arg, List<Item> &list)
:Item_udf_func(udf_arg, list) {}
String *val_str(String *);
double val_real()
{
int err_not_used;
char *end_not_used;
String *res;
res= val_str(&str_value);
return res ? my_strntod(res->charset(),(char*) res->ptr(),
res->length(), &end_not_used, &err_not_used) : 0.0;
}
longlong val_int()
{
int err_not_used;
String *res; res=val_str(&str_value);
return res ? my_strntoll(res->charset(),res->ptr(),res->length(),10,
(char**) 0, &err_not_used) : (longlong) 0;
}
my_decimal *val_decimal(my_decimal *dec_buf)
{
String *res=val_str(&str_value);
if (!res)
return NULL;
string2my_decimal(E_DEC_FATAL_ERROR, res, dec_buf);
return dec_buf;
}
double val_real();
longlong val_int();
my_decimal *val_decimal(my_decimal *dec_buf);
enum Item_result result_type () const { return STRING_RESULT; }
void fix_length_and_dec();
};
......
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