~drizzle-trunk/drizzle/development

1089.1.8 by Brian Aker
Shuffled around a few structures.
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2008-2009 Sun Microsystems
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 */
20
21
/**
22
 * @file
23
 *
24
 * Defines the JoinTable class which is the primary class
25
 * used in the nested loops join implementation.
26
 */
27
28
#ifndef DRIZZLED_TABLE_REFERENCE_H
29
#define DRIZZLED_TABLE_REFERENCE_H
30
1089.1.13 by Brian Aker
Sorting methods into class files.
31
#include <drizzled/global.h>
32
#include <drizzled/base.h>
33
#include <drizzled/sql_bitmap.h>
34
1089.1.8 by Brian Aker
Shuffled around a few structures.
35
class StoredKey;
1089.1.13 by Brian Aker
Sorting methods into class files.
36
class Item;
1089.1.8 by Brian Aker
Shuffled around a few structures.
37
1089.1.14 by Brian Aker
Fix TABLE_REF structure
38
struct table_reference_st
1089.1.8 by Brian Aker
Shuffled around a few structures.
39
{
40
  bool key_err;
41
  uint32_t key_parts; /**< num of key parts */
42
  uint32_t key_length; /**< length of key_buff */
43
  int32_t key; /**< key no (index) */
44
  unsigned char *key_buff; /**< value to look for with key */
45
  unsigned char *key_buff2; /**< key_buff+key_length */
46
  StoredKey **key_copy; /**< No idea what this does... */
47
  Item **items; /**< val()'s for each keypart */
48
  /**
49
    Array of pointers to trigger variables. Some/all of the pointers may be
50
    NULL.  The ref access can be used iff
51
52
      for each used key part i, (!cond_guards[i] || *cond_guards[i])
53
54
    This array is used by subquery code. The subquery code may inject
55
    triggered conditions, i.e. conditions that can be 'switched off'. A ref
56
    access created from such condition is not valid when at least one of the
57
    underlying conditions is switched off (see subquery code for more details)
58
  */
59
  bool **cond_guards;
60
  /**
61
    (null_rejecting & (1<<i)) means the condition is '=' and no matching
62
    rows will be produced if items[i] IS NULL (see add_not_null_conds())
63
  */
64
  key_part_map  null_rejecting;
65
  table_map	depend_map; /**< Table depends on these tables. */
66
  /** null byte position in the key_buf. Used for REF_OR_NULL optimization */
67
  unsigned char *null_ref_key;
68
  /**
69
    true <=> disable the "cache" as doing lookup with the same key value may
70
    produce different results (because of Index Condition Pushdown)
71
  */
72
  bool disable_cache;
1089.1.14 by Brian Aker
Fix TABLE_REF structure
73
};
1089.1.8 by Brian Aker
Shuffled around a few structures.
74
75
#endif /* DRIZZLED_TABLE_REFERENCE_H */