~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/optimizer/sel_imerge.cc

  • Committer: Olaf van der Spek
  • Date: 2011-06-22 18:29:16 UTC
  • mto: This revision was merged to the branch mainline in revision 2347.
  • Revision ID: olafvdspek@gmail.com-20110622182916-6t109xy9j7v41mhk
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
}
58
58
 
59
59
 
60
 
int optimizer::SEL_IMERGE::or_sel_tree_with_checks(optimizer::RangeParameter *param, optimizer::SEL_TREE *new_tree)
 
60
int optimizer::SEL_IMERGE::or_sel_tree_with_checks(optimizer::RangeParameter& param, optimizer::SEL_TREE& new_tree)
61
61
{
62
62
  for (optimizer::SEL_TREE** tree = trees; tree != trees_next; tree++)
63
63
  {
64
 
    if (sel_trees_can_be_ored(**tree, *new_tree, *param))
 
64
    if (sel_trees_can_be_ored(**tree, new_tree, param))
65
65
    {
66
 
      *tree = tree_or(param, *tree, new_tree);
 
66
      *tree = tree_or(&param, *tree, &new_tree);
67
67
      if (!*tree)
68
68
        return 1;
69
 
      if (((*tree)->type == optimizer::SEL_TREE::MAYBE) ||
70
 
          ((*tree)->type == optimizer::SEL_TREE::ALWAYS))
 
69
      if (((*tree)->type == SEL_TREE::MAYBE) ||
 
70
          ((*tree)->type == SEL_TREE::ALWAYS))
71
71
        return 1;
72
72
      /* optimizer::SEL_TREE::IMPOSSIBLE is impossible here */
73
73
      return 0;
75
75
  }
76
76
 
77
77
  /* New tree cannot be combined with any of existing trees. */
78
 
  or_sel_tree(param, new_tree);
 
78
  or_sel_tree(&param, &new_tree);
79
79
  return 0;
80
80
}
81
81
 
82
82
 
83
83
int optimizer::SEL_IMERGE::or_sel_imerge_with_checks(optimizer::RangeParameter *param, optimizer::SEL_IMERGE* imerge)
84
84
{
85
 
  for (optimizer::SEL_TREE** tree= imerge->trees;
86
 
       tree != imerge->trees_next;
87
 
       tree++)
 
85
  for (optimizer::SEL_TREE** tree= imerge->trees; tree != imerge->trees_next; tree++)
88
86
  {
89
 
    if (or_sel_tree_with_checks(param, *tree))
 
87
    if (or_sel_tree_with_checks(*param, **tree))
90
88
      return 1;
91
89
  }
92
90
  return 0;