~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
 *
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
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
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
20
#pragma once
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
21
2252.1.15 by Olaf van der Spek
Common fwd
22
namespace drizzled {
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
23
24
/**
1539.1.6 by Brian Aker
Update for Join structure changes.
25
  CacheField and JoinCache is used on full join to cache records in outer
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
26
  table
27
*/
1894.1.1 by tdavies
in .../drizzled/join_cache.h converted structs JoinCache and CacheField to C++ classes
28
class CacheField {
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
29
  /*
30
    Where source data is located (i.e. this points to somewhere in
1672.3.6 by Brian Aker
First pass in encapsulating row
31
    tableX->getInsertRecord())
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
32
  */
1894.1.1 by tdavies
in .../drizzled/join_cache.h converted structs JoinCache and CacheField to C++ classes
33
public:
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
34
  unsigned char *str;
35
  uint32_t length; /* Length of data at *str, in bytes */
36
  uint32_t blob_length; /* Valid IFF blob_field != 0 */
37
  Field_blob *blob_field;
38
  bool strip; /* true <=> Strip endspaces ?? */
39
  Table *get_rowid; /* _ != NULL <=> */
1894.1.1 by tdavies
in .../drizzled/join_cache.h converted structs JoinCache and CacheField to C++ classes
40
41
  CacheField():
42
    str(NULL),
43
    length(0),
44
    blob_length(0),
45
    blob_field(NULL),
46
    strip(false),
47
    get_rowid(NULL)
48
  {}
49
1539.1.6 by Brian Aker
Update for Join structure changes.
50
};
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
51
1894.1.1 by tdavies
in .../drizzled/join_cache.h converted structs JoinCache and CacheField to C++ classes
52
class JoinCache
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
53
{
1894.1.1 by tdavies
in .../drizzled/join_cache.h converted structs JoinCache and CacheField to C++ classes
54
public:
2047.1.2 by Andrew Hutchings
Revert join_cache buffer cleanup, causes valgrind problems and as much as I don't like it I think the current implementation seems to work
55
  unsigned char *buff;
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
56
  unsigned char *pos;    /* Start of free space in the buffer */
57
  unsigned char *end;
58
  uint32_t records;  /* # of row cominations currently stored in the cache */
59
  uint32_t record_nr;
60
  uint32_t ptr_record;
61
  /*
62
    Number of fields (i.e. cache_field objects). Those correspond to table
63
    columns, and there are also special fields for
64
     - table's column null bits
65
     - table's null-complementation byte
66
     - [new] table's rowid.
67
  */
68
  uint32_t fields;
69
  uint32_t length;
70
  uint32_t blobs;
1539.1.6 by Brian Aker
Update for Join structure changes.
71
  CacheField *field;
72
  CacheField **blob_ptr;
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
73
  optimizer::SqlSelect *select;
1539.1.7 by Brian Aker
JoinCache rename.
74
1894.1.1 by tdavies
in .../drizzled/join_cache.h converted structs JoinCache and CacheField to C++ classes
75
  JoinCache():
2047.1.2 by Andrew Hutchings
Revert join_cache buffer cleanup, causes valgrind problems and as much as I don't like it I think the current implementation seems to work
76
    buff(NULL),
1894.1.1 by tdavies
in .../drizzled/join_cache.h converted structs JoinCache and CacheField to C++ classes
77
    pos(NULL),
78
    end(NULL),
79
    records(0),
80
    record_nr(0),
81
    ptr_record(0),
82
    fields(0),
83
    length(0),
84
    blobs(0),
85
    field(NULL),
86
    blob_ptr(NULL),
87
    select(NULL)
88
  {}
89
1539.1.7 by Brian Aker
JoinCache rename.
90
  void reset_cache_read();
91
  void reset_cache_write();
92
  bool store_record_in_cache();
1539.1.6 by Brian Aker
Update for Join structure changes.
93
};
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
94
1089.1.1 by Brian Aker
Remove of JOIN_TAB to JoinTable
95
int join_init_cache(Session *session, JoinTable *tables, uint32_t table_count);
1039.2.3 by Jay Pipes
Phase 3 of refactoring JOIN
96
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
97
} /* namespace drizzled */
98