diff options
author | unknown <monty@hundin.mysql.fi> | 2001-12-27 02:05:12 +0200 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2001-12-27 02:05:12 +0200 |
commit | 534548aaebe1f59fa789919e18a53f3f820068ad (patch) | |
tree | d7f737ffa2972fd9ce2349ac46e3b53680bbc278 /sql | |
parent | 519c88afa0f245193c94dc1d3d0750d9e737a934 (diff) | |
parent | 17a757600240a73d4ca3aed39f9d6e253c149c49 (diff) | |
download | mariadb-git-534548aaebe1f59fa789919e18a53f3f820068ad.tar.gz |
Merge work:/home/bk/mysql into hundin.mysql.fi:/my/bk/mysql
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_func.cc | 38 | ||||
-rw-r--r-- | sql/item_func.h | 4 | ||||
-rw-r--r-- | sql/sql_select.cc | 2 |
3 files changed, 43 insertions, 1 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 94464bdc594..e7e8964b07a 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1772,6 +1772,16 @@ Item_func_set_user_var::val_str(String *str) } +void Item_func_set_user_var::print(String *str) +{ + str->append('('); + str->append(name.str,name.length); + str->append(":=",2); + args[0]->print(str); + str->append(')'); +} + + user_var_entry *Item_func_get_user_var::get_entry() { if (!entry || ! entry->value) @@ -1864,6 +1874,34 @@ enum Item_result Item_func_get_user_var::result_type() const return entry->type; } + +void Item_func_get_user_var::print(String *str) +{ + str->append('@'); + str->append(name.str,name.length); + str->append(')'); +} + +bool Item_func_get_user_var::eq(const Item *item) const +{ + /* Assume we don't have rtti */ + if (this == item) + return 1; // Same item is same. + /* Check if other type is also a get_user_var() object */ +#ifdef FIX_THIS + if (item->eq == &Item_func_get_user_var::eq) + return 0; +#else + if (item->type() != FUNC_ITEM || + ((Item_func*) item)->func_name() != func_name()) + return 0; +#endif + Item_func_get_user_var *other=(Item_func_get_user_var*) item; + return (name.length == other->name.length && + !memcmp(name.str, other->name.str, name.length)); +} + + longlong Item_func_inet_aton::val_int() { uint byte_result = 0; diff --git a/sql/item_func.h b/sql/item_func.h index ac4c230f312..4a8f808de57 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -817,6 +817,7 @@ public: enum Item_result result_type () const { return cached_result_type; } bool fix_fields(THD *thd,struct st_table_list *tables); void fix_length_and_dec(); + void print(String *str); const char *func_name() const { return "set_user_var"; } }; @@ -835,13 +836,16 @@ public: longlong val_int(); String *val_str(String* str); void fix_length_and_dec(); + void print(String *str); enum Item_result result_type() const; const char *func_name() const { return "get_user_var"; } bool const_item() const { return const_var_flag; } table_map used_tables() const { return const_var_flag ? 0 : RAND_TABLE_BIT; } + bool eq(const Item *item) const; }; + class Item_func_inet_aton : public Item_int_func { public: diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 330df610b46..9ff64780bdd 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -35,7 +35,7 @@ const char *join_type_str[]={ "UNKNOWN","system","const","eq_ref","ref", "MAYBE_REF","ALL","range","index","fulltext" }; static bool make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds, - DYNAMIC_ARRAY *keyuse); + DYNAMIC_ARRAY *keyuse); static bool update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse, JOIN_TAB *join_tab, uint tables,COND *conds,table_map table_map); |