summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2012-03-09 19:04:59 -0800
committerIgor Babaev <igor@askmonty.org>2012-03-09 19:04:59 -0800
commite6578a345c807987cc6e7fb4e9504f03b36dfa00 (patch)
tree9e0b57c6d0cea4a77c23dc87356e09a524eb268d /sql/opt_range.cc
parent6c1aab92d25580643595962ae61a963a3e2fbd9d (diff)
parentf92cfdb8a9ff7f8287239c39ce4735789a23e3df (diff)
downloadmariadb-git-e6578a345c807987cc6e7fb4e9504f03b36dfa00.tar.gz
Merged 5.3 changes into the mwl #248 tree.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 8d4b2e971ad..e0841d3a696 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -552,6 +552,14 @@ public:
increment_use_count(1);
use_count++;
}
+ void incr_refs_all()
+ {
+ for (SEL_ARG *pos=first(); pos ; pos=pos->next)
+ {
+ pos->increment_use_count(1);
+ }
+ use_count++;
+ }
void free_tree()
{
for (SEL_ARG *pos=first(); pos ; pos=pos->next)
@@ -1090,9 +1098,11 @@ int SEL_IMERGE::and_sel_tree(RANGE_OPT_PARAM *param, SEL_TREE *tree,
for (SEL_TREE** or_tree= trees; or_tree != trees_next; or_tree++)
{
SEL_TREE *res_or_tree= 0;
- if (!(res_or_tree= new SEL_TREE()))
+ SEL_TREE *and_tree= 0;
+ if (!(res_or_tree= new SEL_TREE()) ||
+ !(and_tree= new SEL_TREE(tree, TRUE, param)))
return (-1);
- if (!and_range_trees(param, *or_tree, tree, res_or_tree))
+ if (!and_range_trees(param, *or_tree, and_tree, res_or_tree))
{
if (new_imerge->or_sel_tree(param, res_or_tree))
return (-1);
@@ -1305,7 +1315,7 @@ SEL_TREE::SEL_TREE(SEL_TREE *arg, bool without_merges,
for (uint idx= 0; idx < param->keys; idx++)
{
if ((keys[idx]= arg->keys[idx]))
- keys[idx]->incr_refs();
+ keys[idx]->incr_refs_all();
}
if (without_merges)