summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2005-05-03 12:49:22 +0400
committerunknown <konstantin@mysql.com>2005-05-03 12:49:22 +0400
commitb883aebae088aa156f0ddba943fba4b4f4c17f8e (patch)
treefe569864863fd1ff447cbf75426bfd6e56b5d464 /sql/item.h
parent9f5a4955d0ccfd27f5338c04e17e5fabd3840616 (diff)
parent9fcda7fcc5efbc3f58049b8229c4e809c20cc503 (diff)
downloadmariadb-git-b883aebae088aa156f0ddba943fba4b4f4c17f8e.tar.gz
Merge mysql.com:/opt/local/work/mysql-4.1-root
into mysql.com:/opt/local/work/mysql-4.1-9096-fresh sql/item.h: Auto merged sql/item_func.cc: Auto merged
Diffstat (limited to 'sql/item.h')
-rw-r--r--sql/item.h27
1 files changed, 23 insertions, 4 deletions
diff --git a/sql/item.h b/sql/item.h
index d576fbbc60a..3f3ff491bb5 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -235,7 +235,7 @@ public:
virtual table_map not_null_tables() const { return used_tables(); }
/*
Returns true if this is a simple constant item like an integer, not
- a constant expression
+ a constant expression. Used in the optimizer to propagate basic constants.
*/
virtual bool basic_const_item() const { return 0; }
/* cloning of constant items (0 if it is not const) */
@@ -586,7 +586,6 @@ public:
bool convert_str_value(THD *thd);
- Item *new_item() { return new Item_param(pos_in_query); }
/*
If value for parameter was not set we treat it as non-const
so noone will use parameters value in fix_fields still
@@ -595,12 +594,29 @@ public:
virtual table_map used_tables() const
{ return state != NO_VALUE ? (table_map)0 : PARAM_TABLE_BIT; }
void print(String *str) { str->append('?'); }
- /* parameter never equal to other parameter of other item */
- bool eq(const Item *item, bool binary_cmp) const { return 0; }
bool is_null()
{ DBUG_ASSERT(state != NO_VALUE); return state == NULL_VALUE; }
+ bool basic_const_item() const;
+ /*
+ This method is used to make a copy of a basic constant item when
+ propagating constants in the optimizer. The reason to create a new
+ item and not use the existing one is not precisely known (2005/04/16).
+ Probably we are trying to preserve tree structure of items, in other
+ words, avoid pointing at one item from two different nodes of the tree.
+ Return a new basic constant item if parameter value is a basic
+ constant, assert otherwise. This method is called only if
+ basic_const_item returned TRUE.
+ */
+ Item *new_item();
+ /*
+ Implement by-value equality evaluation if parameter value
+ is set and is a basic constant (integer, real or string).
+ Otherwise return FALSE.
+ */
+ bool eq(const Item *item, bool binary_cmp) const;
};
+
class Item_int :public Item_num
{
public:
@@ -627,6 +643,7 @@ public:
void cleanup() {}
void print(String *str);
Item_num *neg() { value= -value; return this; }
+ bool eq(const Item *, bool binary_cmp) const;
};
@@ -682,6 +699,7 @@ public:
void cleanup() {}
Item *new_item() { return new Item_real(name,value,decimals,max_length); }
Item_num *neg() { value= -value; return this; }
+ bool eq(const Item *, bool binary_cmp) const;
};
@@ -815,6 +833,7 @@ public:
enum_field_types field_type() const { return MYSQL_TYPE_STRING; }
// to prevent drop fixed flag (no need parent cleanup call)
void cleanup() {}
+ bool eq(const Item *item, bool binary_cmp) const;
};