summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-12-02 14:17:04 +0200
committerunknown <monty@hundin.mysql.fi>2002-12-02 14:17:04 +0200
commitb79b6c357d1c4a1f952ff5b97580e9ca01bf8ec9 (patch)
tree53d8c9dd70189d9f9c72f04bc0a5f0ce9a19fb5d /sql/item_cmpfunc.cc
parente462abe648cb4a44eac1956b2e5fc0d2ce992d04 (diff)
parente3cecfd10c8006c6a9dabbb149225adbf5ce4deb (diff)
downloadmariadb-git-b79b6c357d1c4a1f952ff5b97580e9ca01bf8ec9.tar.gz
Merge work:/my/mysql-3.23 into hundin.mysql.fi:/my/mysql-3.23
mysql-test/r/group_by.result: Auto merged mysql-test/t/group_by.test: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_cmpfunc.h: Auto merged
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index b53d596da08..07704e3385f 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1219,6 +1219,45 @@ longlong Item_cond_or::val_int()
return 0;
}
+/*
+ Create an AND expression from two expressions
+
+ SYNOPSIS
+ and_expressions()
+ a expression or NULL
+ b expression.
+ org_item Don't modify a if a == *org_item
+ If a == NULL, org_item is set to point at b,
+ to ensure that future calls will not modify b.
+
+ NOTES
+ This will not modify item pointed to by org_item or b
+ The idea is that one can call this in a loop and create and
+ 'and' over all items without modifying any of the original items.
+
+ RETURN
+ NULL Error
+ Item
+*/
+
+Item *and_expressions(Item *a, Item *b, Item **org_item)
+{
+ if (!a)
+ return (*org_item= (Item*) b);
+ if (a == *org_item)
+ {
+ Item_cond *res;
+ if ((res= new Item_cond_and(a, (Item*) b)))
+ res->used_tables_cache= a->used_tables() | b->used_tables();
+ return res;
+ }
+ if (((Item_cond_and*) a)->add((Item*) b))
+ return 0;
+ ((Item_cond_and*) a)->used_tables_cache|= b->used_tables();
+ return a;
+}
+
+
longlong Item_func_isnull::val_int()
{
/*