summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.h
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2003-11-03 12:28:36 +0200
committerunknown <bell@sanja.is.com.ua>2003-11-03 12:28:36 +0200
commitef163ff0fc200c8c647b48e1390d187ebffed2ba (patch)
tree9fcd3368f411e3ebf81bd5b0e3aa64c0f430970f /sql/item_cmpfunc.h
parent22c9da4dee3f5c7b1f780aa47f1a361191e51487 (diff)
downloadmariadb-git-ef163ff0fc200c8c647b48e1390d187ebffed2ba.tar.gz
after review fix
mysql-test/r/func_str.result: new results sql/item.cc: charset changed printing string moved to String sql/item_cmpfunc.cc: new comparation class builder to avoid long switch new print_agrs used sql/item_cmpfunc.h: new comparation class builder to avoid long switch sql/item_func.cc: new print_agrs sql/item_func.h: new print_agrs sql/item_strfunc.cc: new print_agrs sql/item_subselect.cc: new comparation class builder to avoid long switch sql/item_subselect.h: new comparation class builder to avoid long switch sql/item_timefunc.cc: charset changed sql/mysql_priv.h: new comparation class builder to avoid long switch sql/mysqld.cc: new comparation class builder to avoid long switch sql/sql_parse.cc: new comparation class builder to avoid long switch sql/sql_string.cc: string printing moved to String class sql/sql_string.h: string printing moved to String class sql/sql_yacc.yy: birect class creation where it is possible
Diffstat (limited to 'sql/item_cmpfunc.h')
-rw-r--r--sql/item_cmpfunc.h70
1 files changed, 63 insertions, 7 deletions
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 3f73c7736da..081374345d8 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -109,6 +109,69 @@ public:
Item_cache **get_cache() { return &cache; }
};
+class Comp_creator
+{
+public:
+ virtual Item_bool_func2* create(Item *a, Item *b) const = 0;
+ virtual const char* symbol(bool invert) const = 0;
+ virtual bool eqne_op() const = 0;
+ virtual bool l_op() const = 0;
+};
+
+class Eq_creator :public Comp_creator
+{
+public:
+ virtual Item_bool_func2* create(Item *a, Item *b) const;
+ virtual const char* symbol(bool invert) const { return invert? "<>" : "="; }
+ virtual bool eqne_op() const { return 1; }
+ virtual bool l_op() const { return 0; }
+};
+
+class Ne_creator :public Comp_creator
+{
+public:
+ virtual Item_bool_func2* create(Item *a, Item *b) const;
+ virtual const char* symbol(bool invert) const { return invert? "=" : "<>"; }
+ virtual bool eqne_op() const { return 1; }
+ virtual bool l_op() const { return 0; }
+};
+
+class Gt_creator :public Comp_creator
+{
+public:
+ virtual Item_bool_func2* create(Item *a, Item *b) const;
+ virtual const char* symbol(bool invert) const { return invert? "<=" : ">"; }
+ virtual bool eqne_op() const { return 0; }
+ virtual bool l_op() const { return 0; }
+};
+
+class Lt_creator :public Comp_creator
+{
+public:
+ virtual Item_bool_func2* create(Item *a, Item *b) const;
+ virtual const char* symbol(bool invert) const { return invert? ">=" : "<"; }
+ virtual bool eqne_op() const { return 0; }
+ virtual bool l_op() const { return 1; }
+};
+
+class Ge_creator :public Comp_creator
+{
+public:
+ virtual Item_bool_func2* create(Item *a, Item *b) const;
+ virtual const char* symbol(bool invert) const { return invert? "<" : ">="; }
+ virtual bool eqne_op() const { return 0; }
+ virtual bool l_op() const { return 0; }
+};
+
+class Le_creator :public Comp_creator
+{
+public:
+ virtual Item_bool_func2* create(Item *a, Item *b) const;
+ virtual const char* symbol(bool invert) const { return invert? ">" : "<="; }
+ virtual bool eqne_op() const { return 0; }
+ virtual bool l_op() const { return 1; }
+};
+
class Item_bool_func2 :public Item_int_func
{ /* Bool with 2 string args */
protected:
@@ -129,13 +192,6 @@ public:
void print(String *str) { Item_func::print_op(str); }
bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); }
- static Item_bool_func2* eq_creator(Item *a, Item *b);
- static Item_bool_func2* ne_creator(Item *a, Item *b);
- static Item_bool_func2* gt_creator(Item *a, Item *b);
- static Item_bool_func2* lt_creator(Item *a, Item *b);
- static Item_bool_func2* ge_creator(Item *a, Item *b);
- static Item_bool_func2* le_creator(Item *a, Item *b);
-
friend class Arg_comparator;
};