Merge MariaDB-5.2 -> MariaDB 5.3

This commit is contained in:
Sergey Petrunya 2010-03-20 15:01:47 +03:00
commit 7df026676b
1575 changed files with 93069 additions and 50967 deletions

View file

@ -527,6 +527,13 @@ public:
char * name; /* Name from select */
/* Original item name (if it was renamed)*/
char * orig_name;
/**
Intrusive list pointer for free list. If not null, points to the next
Item on some Query_arena's free list. For instance, stored procedures
have their own Query_arena's.
@see Query_arena::free_list
*/
Item *next;
uint32 max_length;
uint name_length; /* Length of name */
@ -793,10 +800,9 @@ public:
virtual cond_result eq_cmp_result() const { return COND_OK; }
inline uint float_length(uint decimals_par) const
{ return decimals != NOT_FIXED_DEC ? (DBL_DIG+2+decimals_par) : DBL_DIG+8;}
/** Returns the uncapped decimal precision of this item. */
virtual uint decimal_precision() const;
inline int decimal_int_part() const
{ return decimal_precision() - decimals; }
{ return my_decimal_int_part(decimal_precision(), decimals); }
/*
Returns true if this is constant (during query execution, i.e. its value
will not change until next fix_fields) and its value is known.
@ -1029,6 +1035,32 @@ public:
virtual Item *equal_fields_propagator(uchar * arg) { return this; }
virtual bool set_no_const_sub(uchar *arg) { return FALSE; }
virtual Item *replace_equal_field(uchar * arg) { return this; }
/*
Check if an expression value depends on the current timezone. Used by
partitioning code to reject timezone-dependent expressions in a
(sub)partitioning function.
*/
virtual bool is_timezone_dependent_processor(uchar *bool_arg)
{
return FALSE;
}
/**
Find a function of a given type
@param arg the function type to search (enum Item_func::Functype)
@return
@retval TRUE the function type we're searching for is found
@retval FALSE the function type wasn't found
@description
This function can be used (together with Item::walk()) to find functions
in an item tree fragment.
*/
virtual bool find_function_processor (uchar *arg)
{
return FALSE;
}
/*
For SP local variable returns pointer to Item representing its
@ -1144,7 +1176,11 @@ class sp_head;
class Item_basic_constant :public Item
{
table_map used_table_map;
public:
Item_basic_constant(): Item(), used_table_map(0) {};
void set_used_tables(table_map map) { used_table_map= map; }
table_map used_tables() const { return used_table_map; }
/* to prevent drop fixed flag (no need parent cleanup call) */
void cleanup()
{
@ -1156,7 +1192,6 @@ public:
if (orig_name)
name= orig_name;
}
Item_basic_constant() {} /* Remove gcc warning */
};
@ -2286,6 +2321,23 @@ public:
}
void cleanup();
bool check_vcol_func_processor(uchar *arg) { return FALSE;}
/*
This method is used for debug purposes to print the name of an
item to the debug log. The second use of this method is as
a helper function of print() and error messages, where it is
applicable. To suit both goals it should return a meaningful,
distinguishable and sintactically correct string. This method
should not be used for runtime type identification, use enum
{Sum}Functype and Item_func::functype()/Item_sum::sum_func()
instead.
Added here, to the parent class of both Item_func and Item_sum_func.
NOTE: for Items inherited from Item_sum, func_name() return part of
function name till first argument (including '(') to make difference in
names for functions with 'distinct' clause and without 'distinct' and
also to make printing of items inherited from Item_sum uniform.
*/
virtual const char *func_name() const= 0;
};
@ -3081,15 +3133,25 @@ protected:
*/
Field *cached_field;
enum enum_field_types cached_field_type;
/*
TRUE <=> cache holds value of the last stored item (i.e actual value).
store() stores item to be cached and sets this flag to FALSE.
On the first call of val_xxx function if this flag is set to FALSE the
cache_value() will be called to actually cache value of saved item.
cache_value() will set this flag to TRUE.
*/
bool value_cached;
public:
Item_cache():
example(0), used_table_map(0), cached_field(0), cached_field_type(MYSQL_TYPE_STRING)
Item_cache():
example(0), used_table_map(0), cached_field(0), cached_field_type(MYSQL_TYPE_STRING),
value_cached(0)
{
fixed= 1;
null_value= 1;
}
Item_cache(enum_field_types field_type_arg):
example(0), used_table_map(0), cached_field(0), cached_field_type(field_type_arg)
example(0), used_table_map(0), cached_field(0), cached_field_type(field_type_arg),
value_cached(0)
{
fixed= 1;
null_value= 1;
@ -3109,10 +3171,10 @@ public:
cached_field= ((Item_field *)item)->field;
return 0;
};
virtual void store(Item *)= 0;
enum Type type() const { return CACHE_ITEM; }
enum_field_types field_type() const { return cached_field_type; }
static Item_cache* get_cache(const Item *item);
static Item_cache* get_cache(const Item* item, const Item_result type);
table_map used_tables() const { return used_table_map; }
virtual void keep_array() {}
virtual void print(String *str, enum_query_type query_type);
@ -3129,6 +3191,8 @@ public:
return trace_unsupported_by_check_vcol_func_processor("cache");
}
virtual void store(Item *item);
virtual bool cache_value()= 0;
};
@ -3137,18 +3201,19 @@ class Item_cache_int: public Item_cache
protected:
longlong value;
public:
Item_cache_int(): Item_cache(), value(0) {}
Item_cache_int(): Item_cache(),
value(0) {}
Item_cache_int(enum_field_types field_type_arg):
Item_cache(field_type_arg), value(0) {}
void store(Item *item);
void store(Item *item, longlong val_arg);
double val_real() { DBUG_ASSERT(fixed == 1); return (double) value; }
longlong val_int() { DBUG_ASSERT(fixed == 1); return value; }
double val_real();
longlong val_int();
String* val_str(String *str);
my_decimal *val_decimal(my_decimal *);
enum Item_result result_type() const { return INT_RESULT; }
bool result_as_longlong() { return TRUE; }
bool cache_value();
};
@ -3156,14 +3221,15 @@ class Item_cache_real: public Item_cache
{
double value;
public:
Item_cache_real(): Item_cache(), value(0) {}
Item_cache_real(): Item_cache(),
value(0) {}
void store(Item *item);
double val_real() { DBUG_ASSERT(fixed == 1); return value; }
double val_real();
longlong val_int();
String* val_str(String *str);
my_decimal *val_decimal(my_decimal *);
enum Item_result result_type() const { return REAL_RESULT; }
bool cache_value();
};
@ -3174,12 +3240,12 @@ protected:
public:
Item_cache_decimal(): Item_cache() {}
void store(Item *item);
double val_real();
longlong val_int();
String* val_str(String *str);
my_decimal *val_decimal(my_decimal *);
enum Item_result result_type() const { return DECIMAL_RESULT; }
bool cache_value();
};
@ -3197,14 +3263,14 @@ public:
MYSQL_TYPE_VARCHAR &&
!((const Item_field *) item)->field->has_charset())
{}
void store(Item *item);
double val_real();
longlong val_int();
String* val_str(String *) { DBUG_ASSERT(fixed == 1); return value; }
String* val_str(String *);
my_decimal *val_decimal(my_decimal *);
enum Item_result result_type() const { return STRING_RESULT; }
CHARSET_INFO *charset() const { return value->charset(); };
int save_in_field(Field *field, bool no_conversions);
bool cache_value();
};
class Item_cache_row: public Item_cache
@ -3214,7 +3280,8 @@ class Item_cache_row: public Item_cache
bool save_array;
public:
Item_cache_row()
:Item_cache(), values(0), item_count(2), save_array(0) {}
:Item_cache(), values(0), item_count(2),
save_array(0) {}
/*
'allocate' used only in row transformer, to preallocate space for row
@ -3272,6 +3339,7 @@ public:
values= 0;
DBUG_VOID_RETURN;
}
bool cache_value();
};
@ -3322,4 +3390,4 @@ extern Cached_item *new_Cached_item(THD *thd, Item *item,
bool use_result_field);
extern Item_result item_cmp_type(Item_result a,Item_result b);
extern void resolve_const_item(THD *thd, Item **ref, Item *cmp_item);
extern int stored_field_cmp_to_item(Field *field, Item *item);
extern int stored_field_cmp_to_item(THD *thd, Field *field, Item *item);