summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-12-27 02:04:27 +0200
committerunknown <monty@hundin.mysql.fi>2001-12-27 02:04:27 +0200
commit17a757600240a73d4ca3aed39f9d6e253c149c49 (patch)
tree06bd9771a6953cb6da8a5f98d2b29b06e564806b /sql
parent044d2959f3a8c315930a05343693ac866d4ffa9d (diff)
downloadmariadb-git-17a757600240a73d4ca3aed39f9d6e253c149c49.tar.gz
Bugfix for WHERE key=@a OR key=@b
Docs/manual.texi: Changelog sql/sql_select.cc: Cleanup
Diffstat (limited to 'sql')
-rw-r--r--sql/item_func.cc38
-rw-r--r--sql/item_func.h4
-rw-r--r--sql/sql_select.cc2
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);