~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/optimizer/key_field.h

  • Committer: Jay Pipes
  • Date: 2009-09-15 21:01:42 UTC
  • mto: (1126.2.5 merge)
  • mto: This revision was merged to the branch mainline in revision 1128.
  • Revision ID: jpipes@serialcoder-20090915210142-x8mwiqn1q0vzjspp
Moves Alter_info out into its own header and source file, cleans up some related include mess in sql_lex.h, and renames Alter_info to AlterInfo.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2009 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2009 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
20
20
#ifndef DRIZZLED_OPTIMIZER_KEY_FIELD_H
21
21
#define DRIZZLED_OPTIMIZER_KEY_FIELD_H
22
22
 
 
23
#include <drizzled/server_includes.h>
23
24
#include <drizzled/sql_select.h>
24
25
 
25
26
#include <vector>
47
48
      cond_guard(NULL)
48
49
  {}
49
50
 
50
 
  KeyField(Field *in_field,
51
 
           Item *in_val,
52
 
           uint32_t in_level,
53
 
           uint32_t in_optimize,
54
 
           bool in_eq_func,
55
 
           bool in_null_rejecting,
56
 
           bool *in_cond_guard)
57
 
    :
58
 
      field(in_field),
59
 
      val(in_val),
60
 
      level(in_level),
61
 
      optimize(in_optimize),
62
 
      eq_func(in_eq_func),
63
 
      null_rejecting(in_null_rejecting),
64
 
      cond_guard(in_cond_guard)
65
 
  {}
66
 
 
67
 
  Field *getField()
68
 
  {
69
 
    return field;
70
 
  }
71
 
 
72
 
  void setField(Field *in_field)
73
 
  {
74
 
    field= in_field;
75
 
  }
76
 
 
77
 
  Item *getValue()
78
 
  {
79
 
    return val;
80
 
  }
81
 
 
82
 
  void setValue(Item *in_val)
83
 
  {
84
 
    val= in_val;
85
 
  }
86
 
 
87
 
  uint32_t getLevel()
88
 
  {
89
 
    return level;
90
 
  }
91
 
 
92
 
  void setLevel(uint32_t in_level)
93
 
  {
94
 
    level= in_level;
95
 
  }
96
 
 
97
 
  uint32_t getOptimizeFlags()
98
 
  {
99
 
    return optimize;
100
 
  }
101
 
 
102
 
  void setOptimizeFlags(uint32_t in_opt)
103
 
  {
104
 
    optimize= in_opt;
105
 
  }
106
 
 
107
 
  bool isEqualityCondition() const
108
 
  {
109
 
    return eq_func;
110
 
  }
111
 
 
112
 
  void setEqualityConditionUsed(bool in_val)
113
 
  {
114
 
    eq_func= in_val;
115
 
  }
116
 
 
117
 
  bool rejectNullValues() const
118
 
  {
119
 
    return null_rejecting;
120
 
  }
121
 
 
122
 
  void setRejectNullValues(bool in_val)
123
 
  {
124
 
    null_rejecting= in_val;
125
 
  }
126
 
 
127
 
  bool *getConditionalGuard()
128
 
  {
129
 
    return cond_guard;
130
 
  }
131
 
 
132
 
  void setConditionalGuard(bool *in_cond_guard)
133
 
  {
134
 
    cond_guard= in_cond_guard;
135
 
  }
136
 
 
137
 
private:
138
 
 
139
51
  Field *field;
140
52
  Item *val; /**< May be empty if diff constant */
141
53
  uint32_t level;
147
59
  */
148
60
  bool null_rejecting;
149
61
  bool *cond_guard; /**< @see KeyUse::cond_guard */
150
 
 
151
62
};
152
63
 
153
 
void add_key_fields(Join *join, 
 
64
void add_key_fields(JOIN *join, 
154
65
                    KeyField **key_fields,
155
66
                    uint32_t *and_level,
156
67
                    COND *cond,
193
104
 *   @endcode
194
105
 *   Here we can add 'ref' access candidates for t1 and t2, but not for t3.
195
106
 */
196
 
void add_key_fields_for_nj(Join *join,
 
107
void add_key_fields_for_nj(JOIN *join,
197
108
                           TableList *nested_join_table,
198
109
                           KeyField **end,
199
110
                           uint32_t *and_level,