604
606
st_select_lex *select);
606
class Item_null :public Item_basic_constant
609
Item_null(char *name_par=0)
611
maybe_null= null_value= true;
613
name= name_par ? name_par : (char*) "NULL";
615
collation.set(&my_charset_bin, DERIVATION_IGNORABLE);
617
enum Type type() const { return NULL_ITEM; }
618
bool eq(const Item *item, bool binary_cmp) const;
621
String *val_str(String *str);
622
my_decimal *val_decimal(my_decimal *);
623
int save_in_field(Field *field, bool no_conversions);
624
int save_safe_in_field(Field *field);
625
bool send(Protocol *protocol, String *str);
626
enum Item_result result_type () const { return STRING_RESULT; }
627
enum_field_types field_type() const { return DRIZZLE_TYPE_NULL; }
628
bool basic_const_item() const { return 1; }
629
Item *clone_item() { return new Item_null(name); }
630
bool is_null() { return 1; }
632
virtual inline void print(String *str, enum_query_type)
634
str->append(STRING_WITH_LEN("NULL"));
637
Item *safe_charset_converter(const CHARSET_INFO * const tocs);
638
bool check_vcol_func_processor(unsigned char *)
642
class Item_null_result :public Item_null
646
Item_null_result() : Item_null(), result_field(0) {}
647
bool is_result_field() { return result_field != 0; }
648
void save_in_result_field(bool no_conversions)
650
save_in_field(result_field, no_conversions);
652
bool check_vcol_func_processor(unsigned char *)
656
/* Item represents one placeholder ('?') of prepared statement */
658
class Item_param :public Item
660
char cnvbuf[MAX_FIELD_WIDTH];
665
enum enum_item_param_state
667
NO_VALUE, NULL_VALUE, INT_VALUE, REAL_VALUE,
668
STRING_VALUE, TIME_VALUE, LONG_DATA_VALUE,
673
A buffer for string and long data values. Historically all allocated
674
values returned from val_str() were treated as eligible to
675
modification. I. e. in some cases Item_func_concat can append it's
676
second argument to return value of the first one. Because of that we
677
can't return the original buffer holding string data from val_str(),
678
and have to have one buffer for data and another just pointing to
679
the data. This is the latter one and it's returned from val_str().
680
Can not be declared inside the union as it's not a POD type.
682
String str_value_ptr;
683
my_decimal decimal_value;
689
Character sets conversion info for string values.
690
Character sets of client and connection defined at bind time are used
691
for all conversions, even if one of them is later changed (i.e.
692
between subsequent calls to mysql_stmt_execute).
694
struct CONVERSION_INFO
696
const CHARSET_INFO *character_set_client;
697
const CHARSET_INFO *character_set_of_placeholder;
699
This points at character set of connection if conversion
700
to it is required (i. e. if placeholder typecode is not BLOB).
701
Otherwise it's equal to character_set_client (to simplify
702
check in convert_str_value()).
704
const CHARSET_INFO *final_character_set_of_str_value;
709
/* Cached values for virtual methods to save us one switch. */
710
enum Item_result item_result_type;
714
Used when this item is used in a temporary table.
715
This is NOT placeholder metadata sent to client, as this value
716
is assigned after sending metadata (in setup_one_conversion_function).
717
For example in case of 'SELECT ?' you'll get DRIZZLE_TYPE_STRING both
718
in result set and placeholders metadata, no matter what type you will
719
supply for this placeholder in mysql_stmt_execute.
721
enum enum_field_types param_type;
723
Offset of placeholder inside statement text. Used to create
724
no-placeholders version of this statement for the binary log.
726
uint32_t pos_in_query;
728
Item_param(uint32_t pos_in_query_arg);
730
enum Item_result result_type () const { return item_result_type; }
731
enum Type type() const { return item_type; }
732
enum_field_types field_type() const { return param_type; }
736
my_decimal *val_decimal(my_decimal*);
737
String *val_str(String*);
738
bool get_time(DRIZZLE_TIME *tm);
739
bool get_date(DRIZZLE_TIME *tm, uint32_t fuzzydate);
740
int save_in_field(Field *field, bool no_conversions);
743
void set_int(int64_t i, uint32_t max_length_arg);
744
void set_double(double i);
745
void set_decimal(char *str, ulong length);
746
bool set_str(const char *str, ulong length);
747
bool set_longdata(const char *str, ulong length);
748
void set_time(DRIZZLE_TIME *tm, enum enum_drizzle_timestamp_type type,
749
uint32_t max_length_arg);
750
bool set_from_user_var(Session *session, const user_var_entry *entry);
753
Assign placeholder value from bind data.
754
Note, that 'len' has different semantics in embedded library (as we
755
don't need to check that packet is not broken there). See
756
sql_prepare.cc for details.
758
void (*set_param_func)(Item_param *param, unsigned char **pos, ulong len);
760
const String *query_val_str(String *str) const;
762
bool convert_str_value(Session *session);
765
If value for parameter was not set we treat it as non-const
766
so noone will use parameters value in fix_fields still
767
parameter is constant during execution.
769
virtual table_map used_tables() const
770
{ return state != NO_VALUE ? (table_map)0 : PARAM_TABLE_BIT; }
771
virtual void print(String *str, enum_query_type query_type);
773
{ assert(state != NO_VALUE); return state == NULL_VALUE; }
774
bool basic_const_item() const;
776
This method is used to make a copy of a basic constant item when
777
propagating constants in the optimizer. The reason to create a new
778
item and not use the existing one is not precisely known (2005/04/16).
779
Probably we are trying to preserve tree structure of items, in other
780
words, avoid pointing at one item from two different nodes of the tree.
781
Return a new basic constant item if parameter value is a basic
782
constant, assert otherwise. This method is called only if
783
basic_const_item returned true.
785
Item *safe_charset_converter(const CHARSET_INFO * const tocs);
788
Implement by-value equality evaluation if parameter value
789
is set and is a basic constant (integer, real or string).
790
Otherwise return false.
792
bool eq(const Item *item, bool binary_cmp) const;
793
/** Item is a argument to a limit clause. */
794
bool limit_clause_param;
798
608
class Item_int :public Item_num