~drizzle-trunk/drizzle/development

1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2008 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; version 2 of the License.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU General Public License
16
 *  along with this program; if not, write to the Free Software
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 */
19
20
#ifndef DRIZZLED_JOIN_CACHE_H
21
#define DRIZZLED_JOIN_CACHE_H
22
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
23
namespace drizzled
24
{
25
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
26
class Field_blob;
1089.1.1 by Brian Aker
Remove of JOIN_TAB to JoinTable
27
typedef JoinTable JoinTable;
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
28
29
/**
1539.1.6 by Brian Aker
Update for Join structure changes.
30
  CacheField and JoinCache is used on full join to cache records in outer
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
31
  table
32
*/
1539.1.6 by Brian Aker
Update for Join structure changes.
33
struct CacheField {
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
34
  /*
35
    Where source data is located (i.e. this points to somewhere in
36
    tableX->record[0])
37
  */
38
  unsigned char *str;
39
  uint32_t length; /* Length of data at *str, in bytes */
40
  uint32_t blob_length; /* Valid IFF blob_field != 0 */
41
  Field_blob *blob_field;
42
  bool strip; /* true <=> Strip endspaces ?? */
43
44
  Table *get_rowid; /* _ != NULL <=> */
1539.1.6 by Brian Aker
Update for Join structure changes.
45
};
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
46
1539.1.6 by Brian Aker
Update for Join structure changes.
47
struct JoinCache
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
48
{
49
  unsigned char *buff;
50
  unsigned char *pos;    /* Start of free space in the buffer */
51
  unsigned char *end;
52
  uint32_t records;  /* # of row cominations currently stored in the cache */
53
  uint32_t record_nr;
54
  uint32_t ptr_record;
55
  /*
56
    Number of fields (i.e. cache_field objects). Those correspond to table
57
    columns, and there are also special fields for
58
     - table's column null bits
59
     - table's null-complementation byte
60
     - [new] table's rowid.
61
  */
62
  uint32_t fields;
63
  uint32_t length;
64
  uint32_t blobs;
1539.1.6 by Brian Aker
Update for Join structure changes.
65
  CacheField *field;
66
  CacheField **blob_ptr;
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
67
  optimizer::SqlSelect *select;
1539.1.7 by Brian Aker
JoinCache rename.
68
69
  void reset_cache_read();
70
  void reset_cache_write();
71
  bool store_record_in_cache();
1539.1.6 by Brian Aker
Update for Join structure changes.
72
};
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
73
1089.1.1 by Brian Aker
Remove of JOIN_TAB to JoinTable
74
int join_init_cache(Session *session, JoinTable *tables, uint32_t table_count);
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
75
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
76
} /* namespace drizzled */
77
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
78
#endif /* DRIZZLED_JOIN_CACHE_H */