MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Item_param Class Reference
Inheritance diagram for Item_param:
Collaboration diagram for Item_param:

Public Types

enum  enum_item_param_state {
  NO_VALUE, NULL_VALUE, INT_VALUE, REAL_VALUE,
  STRING_VALUE, TIME_VALUE, LONG_DATA_VALUE, DECIMAL_VALUE
}
- Public Types inherited from Item
enum  Type {
  FIELD_ITEM = 0, FUNC_ITEM, SUM_FUNC_ITEM, STRING_ITEM,
  INT_ITEM, REAL_ITEM, NULL_ITEM, VARBIN_ITEM,
  COPY_STR_ITEM, FIELD_AVG_ITEM, DEFAULT_VALUE_ITEM, PROC_ITEM,
  COND_ITEM, REF_ITEM, FIELD_STD_ITEM, FIELD_VARIANCE_ITEM,
  INSERT_VALUE_ITEM, SUBSELECT_ITEM, ROW_ITEM, CACHE_ITEM,
  TYPE_HOLDER, PARAM_ITEM, TRIGGER_FIELD_ITEM, DECIMAL_ITEM,
  XPATH_NODESET, XPATH_NODESET_CMP, VIEW_FIXER_ITEM
}
enum  cond_result { COND_UNDEF, COND_OK, COND_TRUE, COND_FALSE }
enum  traverse_order { POSTFIX, PREFIX }

Public Member Functions

 Item_param (uint pos_in_query_arg)
enum Item_result result_type () const
enum Type type () const
enum_field_types field_type () const
double val_real ()
longlong val_int ()
my_decimalval_decimal (my_decimal *)
Stringval_str (String *)
bool get_time (MYSQL_TIME *tm)
bool get_date (MYSQL_TIME *tm, uint fuzzydate)
type_conversion_status save_in_field (Field *field, bool no_conversions)
void set_null ()
void set_int (longlong i, uint32 max_length_arg)
void set_double (double i)
void set_decimal (const char *str, ulong length)
void set_decimal (const my_decimal *dv)
bool set_str (const char *str, ulong length)
bool set_longdata (const char *str, ulong length)
void set_time (MYSQL_TIME *tm, timestamp_type type, uint32 max_length_arg)
bool set_from_user_var (THD *thd, const user_var_entry *entry)
void reset ()
const Stringquery_val_str (THD *thd, String *str) const
bool convert_str_value (THD *thd)
virtual table_map used_tables () const
virtual void print (String *str, enum_query_type query_type)
bool is_null ()
bool basic_const_item () const
Itemsafe_charset_converter (const CHARSET_INFO *tocs)
Itemclone_item ()
bool eq (const Item *item, bool binary_cmp) const
void set_param_type_and_swap_value (Item_param *from)
virtual const Send_fieldget_out_param_info () const
virtual void make_field (Send_field *field)
- Public Member Functions inherited from Item
 Item (THD *thd, Item *item)
void rename (char *new_name)
void init_make_field (Send_field *tmp_field, enum enum_field_types type)
virtual void cleanup ()
virtual void make_field (Send_field *field)
virtual Fieldmake_string_field (TABLE *table)
virtual bool fix_fields (THD *, Item **)
virtual void fix_after_pullout (st_select_lex *parent_select, st_select_lex *removed_select)
void quick_fix_field ()
type_conversion_status save_in_field_no_warnings (Field *field, bool no_conversions)
virtual type_conversion_status save_in_field (Field *field, bool no_conversions)
virtual void save_org_in_field (Field *field)
virtual type_conversion_status save_safe_in_field (Field *field)
virtual bool send (Protocol *protocol, String *str)
virtual bool eq (const Item *, bool binary_cmp) const
virtual Item_result result_type () const
virtual enum Item_result numeric_context_result_type () const
enum Item_result temporal_with_date_as_number_result_type () const
virtual Item_result cast_to_int_type () const
virtual enum_field_types string_field_type () const
virtual enum_field_types field_type () const
virtual enum Type type () const =0
virtual enum_monotonicity_info get_monotonicity_info () const
virtual longlong val_int_endpoint (bool left_endp, bool *incl_endp)
virtual double val_real ()=0
virtual longlong val_int ()=0
virtual longlong val_date_temporal ()
virtual longlong val_time_temporal ()
longlong val_temporal_by_field_type ()
longlong val_temporal_with_round (enum_field_types type, uint8 dec)
ulonglong val_uint ()
virtual Stringval_str (String *str)=0
virtual Stringval_str_ascii (String *str)
virtual my_decimalval_decimal (my_decimal *decimal_buffer)=0
virtual bool val_bool ()
virtual Stringval_nodeset (String *)
type_conversion_status save_time_in_field (Field *field)
type_conversion_status save_date_in_field (Field *field)
type_conversion_status save_str_value_in_field (Field *field, String *result)
virtual Fieldget_tmp_table_field ()
virtual Fieldtmp_table_field (TABLE *t_arg)
virtual const char * full_name () const
virtual double val_result ()
virtual longlong val_int_result ()
virtual longlong val_time_temporal_result ()
virtual longlong val_date_temporal_result ()
virtual Stringstr_result (String *tmp)
virtual my_decimalval_decimal_result (my_decimal *val)
virtual bool val_bool_result ()
virtual bool is_null_result ()
virtual table_map used_tables () const
virtual table_map resolved_used_tables () const
virtual table_map not_null_tables () const
virtual bool basic_const_item () const
virtual Itemclone_item ()
virtual cond_result eq_cmp_result () const
uint float_length (uint decimals_par) const
virtual uint decimal_precision () const
int decimal_int_part () const
virtual uint time_precision ()
virtual uint datetime_precision ()
virtual bool const_item () const
virtual bool const_during_execution () const
virtual void print (String *str, enum_query_type query_type)
void print_item_w_name (String *, enum_query_type query_type)
void print_for_order (String *str, enum_query_type query_type, bool used_alias)
virtual void update_used_tables ()
virtual void split_sum_func (THD *thd, Ref_ptr_array ref_pointer_array, List< Item > &fields)
void split_sum_func2 (THD *thd, Ref_ptr_array ref_pointer_array, List< Item > &fields, Item **ref, bool skip_registered)
virtual bool get_date (MYSQL_TIME *ltime, uint fuzzydate)=0
virtual bool get_time (MYSQL_TIME *ltime)=0
virtual bool get_timeval (struct timeval *tm, int *warnings)
virtual bool get_date_result (MYSQL_TIME *ltime, uint fuzzydate)
virtual bool is_null ()
virtual void update_null_value ()
virtual void top_level_item ()
virtual void set_result_field (Field *field)
virtual bool is_result_field ()
virtual bool is_bool_func ()
virtual void save_in_result_field (bool no_conversions)
virtual void no_rows_in_result ()
virtual Itemcopy_or_same (THD *thd)
virtual Itemcopy_andor_structure (THD *thd, bool real_items=false)
virtual Itemreal_item ()
virtual Itemget_tmp_table_item (THD *thd)
virtual const CHARSET_INFOcompare_collation ()
virtual const CHARSET_INFOcharset_for_protocol (void) const
virtual bool walk (Item_processor processor, bool walk_subquery, uchar *arg)
virtual Itemtransform (Item_transformer transformer, uchar *arg)
virtual Itemcompile (Item_analyzer analyzer, uchar **arg_p, Item_transformer transformer, uchar *arg_t)
virtual void traverse_cond (Cond_traverser traverser, void *arg, traverse_order order)
virtual bool intro_version (uchar *int_arg)
virtual bool remove_dependence_processor (uchar *arg)
virtual bool remove_fixed (uchar *arg)
virtual bool cleanup_processor (uchar *arg)
virtual bool collect_item_field_processor (uchar *arg)
virtual bool add_field_to_set_processor (uchar *arg)
virtual bool remove_column_from_bitmap (uchar *arg)
virtual bool find_item_in_field_list_processor (uchar *arg)
virtual bool change_context_processor (uchar *context)
virtual bool reset_query_id_processor (uchar *query_id_arg)
virtual bool find_item_processor (uchar *arg)
virtual bool register_field_in_read_map (uchar *arg)
virtual bool inform_item_in_cond_of_tab (uchar *join_tab_index)
virtual bool clean_up_after_removal (uchar *arg)
virtual bool cache_const_expr_analyzer (uchar **arg)
virtual Itemcache_const_expr_transformer (uchar *arg)
virtual bool item_field_by_name_analyzer (uchar **arg)
virtual Itemitem_field_by_name_transformer (uchar *arg)
virtual bool equality_substitution_analyzer (uchar **arg)
virtual Itemequality_substitution_transformer (uchar *arg)
virtual bool check_partition_func_processor (uchar *bool_arg)
virtual bool subst_argument_checker (uchar **arg)
virtual bool explain_subquery_checker (uchar **arg)
virtual Itemexplain_subquery_propagator (uchar *arg)
virtual Itemequal_fields_propagator (uchar *arg)
virtual bool set_no_const_sub (uchar *arg)
virtual Itemreplace_equal_field (uchar *arg)
virtual bool check_valid_arguments_processor (uchar *bool_arg)
virtual bool find_function_processor (uchar *arg)
virtual Itemthis_item ()
virtual const Itemthis_item () const
virtual Item ** this_item_addr (THD *thd, Item **addr_arg)
virtual uint cols ()
virtual Itemelement_index (uint i)
virtual Item ** addr (uint i)
virtual bool check_cols (uint c)
virtual bool null_inside ()
virtual void bring_value ()
Fieldtmp_table_field_from_field_type (TABLE *table, bool fixed_length)
virtual Item_fieldfield_for_view_update ()
virtual Itemneg_transformer (THD *thd)
virtual Itemupdate_value_transformer (uchar *select_arg)
virtual Itemsafe_charset_converter (const CHARSET_INFO *tocs)
void delete_self ()
virtual bool is_splocal ()
virtual
Settable_routine_parameter
get_settable_routine_parameter ()
bool is_temporal_with_date () const
bool is_temporal_with_date_and_time () const
bool is_temporal_with_time () const
bool is_temporal () const
bool has_compatible_context (Item *item) const
virtual Field::geometry_type get_geometry_type () const
Stringcheck_well_formed_result (String *str, bool send_error=0)
bool eq_by_collation (Item *item, bool binary_cmp, const CHARSET_INFO *cs)
virtual bool is_expensive ()
virtual bool can_be_evaluated_now () const
uint32 max_char_length () const
void fix_length_and_charset (uint32 max_char_length_arg, const CHARSET_INFO *cs)
void fix_char_length (uint32 max_char_length_arg)
void fix_char_length_ulonglong (ulonglong max_char_length_arg)
void fix_length_and_charset_datetime (uint32 max_char_length_arg)
void fix_length_and_dec_and_charset_datetime (uint32 max_char_length_arg, uint8 dec_arg)
virtual bool is_outer_field () const
bool is_blob_field () const
virtual bool has_subquery () const
virtual bool has_stored_program () const
virtual bool created_by_in2exists () const
 Whether this Item was created by the IN->EXISTS subquery transformation.

Public Attributes

enum
Item_param::enum_item_param_state 
state
String str_value_ptr
my_decimal decimal_value
union {
   longlong   integer
   double   real
   struct CONVERSION_INFO {
      const CHARSET_INFO *   character_set_client
      const CHARSET_INFO *   character_set_of_placeholder
      const CHARSET_INFO *   final_character_set_of_str_value
   }   cs_info
   MYSQL_TIME   time
value
enum Item_result item_result_type
enum Type item_type
enum enum_field_types param_type
uint pos_in_query
void(* set_param_func )(Item_param *param, uchar **pos, ulong len)
bool limit_clause_param
- Public Attributes inherited from Item
uint rsize
String str_value
Item_name_string item_name
Item_name_string orig_name
Itemnext
uint32 max_length
int marker
uint8 decimals
my_bool maybe_null
my_bool null_value
my_bool unsigned_flag
my_bool with_sum_func
my_bool fixed
DTCollation collation
Item_result cmp_context

Additional Inherited Members

- Static Public Member Functions inherited from Item
static void * operator new (size_t size) throw ()
static void * operator new (size_t size, MEM_ROOT *mem_root) throw ()
static void operator delete (void *ptr, size_t size)
static void operator delete (void *ptr, MEM_ROOT *mem_root)
static const CHARSET_INFOdefault_charset ()
- Protected Member Functions inherited from Item
Stringval_string_from_real (String *str)
Stringval_string_from_int (String *str)
Stringval_string_from_decimal (String *str)
Stringval_string_from_date (String *str)
Stringval_string_from_datetime (String *str)
Stringval_string_from_time (String *str)
my_decimalval_decimal_from_real (my_decimal *decimal_value)
my_decimalval_decimal_from_int (my_decimal *decimal_value)
my_decimalval_decimal_from_string (my_decimal *decimal_value)
my_decimalval_decimal_from_date (my_decimal *decimal_value)
my_decimalval_decimal_from_time (my_decimal *decimal_value)
longlong val_int_from_decimal ()
longlong val_int_from_date ()
longlong val_int_from_time ()
longlong val_int_from_datetime ()
double val_real_from_decimal ()
bool get_date_from_string (MYSQL_TIME *ltime, uint flags)
bool get_date_from_real (MYSQL_TIME *ltime, uint flags)
bool get_date_from_decimal (MYSQL_TIME *ltime, uint flags)
bool get_date_from_int (MYSQL_TIME *ltime, uint flags)
bool get_date_from_time (MYSQL_TIME *ltime)
bool get_date_from_numeric (MYSQL_TIME *ltime, uint fuzzydate)
bool get_date_from_non_temporal (MYSQL_TIME *ltime, uint fuzzydate)
bool get_time_from_string (MYSQL_TIME *ltime)
bool get_time_from_real (MYSQL_TIME *ltime)
bool get_time_from_decimal (MYSQL_TIME *ltime)
bool get_time_from_int (MYSQL_TIME *ltime)
bool get_time_from_date (MYSQL_TIME *ltime)
bool get_time_from_datetime (MYSQL_TIME *ltime)
bool get_time_from_numeric (MYSQL_TIME *ltime)
bool get_time_from_non_temporal (MYSQL_TIME *ltime)
- Protected Attributes inherited from Item
my_bool with_subselect
my_bool with_stored_program
bool tables_locked_cache
- Private Member Functions inherited from Settable_routine_parameter
virtual void set_required_privilege (bool rw)
virtual bool set_value (THD *thd, sp_rcontext *ctx, Item **it)=0
virtual void set_out_param_info (Send_field *info)
virtual const Send_fieldget_out_param_info () const

Detailed Description

Definition at line 2392 of file item.h.

Member Function Documentation

bool Item_param::convert_str_value ( THD *  thd)

Convert string from client character set to the character set of connection.

Definition at line 3939 of file item.cc.

const Send_field * Item_param::get_out_param_info ( ) const
virtual

Getter of Item_param::m_out_param_info.

m_out_param_info is used to store information about store routine OUT-parameters, such as stored routine name, database, stored routine variable name. It is supposed to be retrieved in Protocol_binary::send_out_parameters() during creation of OUT-parameter result set.

Definition at line 4219 of file item.cc.

Here is the caller graph for this function:

void Item_param::make_field ( Send_field field)
virtual

Fill meta-data information for the corresponding column in a result set. If this is an OUT-parameter of a stored procedure, preserve meta-data of stored-routine variable.

Parameters
fieldcontainer for meta-data to be filled

Definition at line 4233 of file item.cc.

const String * Item_param::query_val_str ( THD *  thd,
String str 
) const

Return Param item values in string format, for generating the dynamic query used in update/binary logs.

Todo:
  • Change interface and implementation to fill log data in place and avoid one more memcpy/alloc between str and log string.
  • In case of error we need to notify replication that binary log contains wrong statement

Definition at line 3882 of file item.cc.

Here is the call graph for this function:

void Item_param::reset ( void  )

Resets parameter after execution.

Note
We clear null_value here instead of setting it in set_* methods, because we want more easily handle case for long data.

Definition at line 3656 of file item.cc.

void Item_param::set_decimal ( const char *  str,
ulong  length 
)

Set decimal parameter value from string.

Parameters
strcharacter string
lengthstring length
Note
As we use character strings to send decimal values in binary protocol, we use str2my_decimal to convert it to internal decimal value.

Definition at line 3446 of file item.cc.

bool Item_param::set_from_user_var ( THD *  thd,
const user_var_entry *  entry 
)

Set parameter value from user variable value.

Parameters
thdCurrent thread
entryUser variable structure (NULL means use NULL value)
Return values
0OK
1Out of memory

Definition at line 3576 of file item.cc.

void Item_param::set_param_type_and_swap_value ( Item_param src)

Preserve the original parameter types and values when re-preparing a prepared statement.

Copy parameter type information and conversion function pointers from a parameter of the old statement to the corresponding parameter of the new one.

Move parameter values from the old parameters to the new one. We simply "exchange" the values, which allows to save on allocation and character set conversion in case a parameter is a string or a blob/clob.

The old parameter gets the value of this one, which ensures that all memory of this parameter is freed correctly.

Parameters
[in]srcparameter item of the original prepared statement

Definition at line 4085 of file item.cc.

Here is the call graph for this function:

void Item_param::set_time ( MYSQL_TIME tm,
timestamp_type  time_type,
uint32  max_length_arg 
)

Set parameter value from MYSQL_TIME value.

Parameters
tmdatetime value to set (time_type is ignored)
typetype of datetime value
max_length_argmax length of datetime value as string
Note
If we value to be stored is not normalized, zero value will be stored instead and proper warning will be produced. This function relies on the fact that even wrong value sent over binary protocol fits into MAX_DATE_STRING_REP_LENGTH buffer.

Definition at line 3487 of file item.cc.

Member Data Documentation

bool Item_param::limit_clause_param

Item is a argument to a limit clause.

Definition at line 2529 of file item.h.


The documentation for this class was generated from the following files: