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 |
*/
|
|
1894.1.1
by tdavies
in .../drizzled/join_cache.h converted structs JoinCache and CacheField to C++ classes |
33 |
class 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
|
|
1672.3.6
by Brian Aker
First pass in encapsulating row |
36 |
tableX->getInsertRecord())
|
1039.2.3
by Jay Pipes
Phase 3 of refactoring JOIN |
37 |
*/
|
1894.1.1
by tdavies
in .../drizzled/join_cache.h converted structs JoinCache and CacheField to C++ classes |
38 |
public: |
1039.2.3
by Jay Pipes
Phase 3 of refactoring JOIN |
39 |
unsigned char *str; |
40 |
uint32_t length; /* Length of data at *str, in bytes */ |
|
41 |
uint32_t blob_length; /* Valid IFF blob_field != 0 */ |
|
42 |
Field_blob *blob_field; |
|
43 |
bool strip; /* true <=> Strip endspaces ?? */ |
|
44 |
Table *get_rowid; /* _ != NULL <=> */ |
|
1894.1.1
by tdavies
in .../drizzled/join_cache.h converted structs JoinCache and CacheField to C++ classes |
45 |
|
46 |
CacheField(): |
|
47 |
str(NULL), |
|
48 |
length(0), |
|
49 |
blob_length(0), |
|
50 |
blob_field(NULL), |
|
51 |
strip(false), |
|
52 |
get_rowid(NULL) |
|
53 |
{}
|
|
54 |
||
1539.1.6
by Brian Aker
Update for Join structure changes. |
55 |
};
|
1039.2.3
by Jay Pipes
Phase 3 of refactoring JOIN |
56 |
|
1894.1.1
by tdavies
in .../drizzled/join_cache.h converted structs JoinCache and CacheField to C++ classes |
57 |
class JoinCache |
1039.2.3
by Jay Pipes
Phase 3 of refactoring JOIN |
58 |
{
|
1894.1.1
by tdavies
in .../drizzled/join_cache.h converted structs JoinCache and CacheField to C++ classes |
59 |
public: |
1039.2.3
by Jay Pipes
Phase 3 of refactoring JOIN |
60 |
unsigned char *buff; |
61 |
unsigned char *pos; /* Start of free space in the buffer */ |
|
62 |
unsigned char *end; |
|
63 |
uint32_t records; /* # of row cominations currently stored in the cache */ |
|
64 |
uint32_t record_nr; |
|
65 |
uint32_t ptr_record; |
|
66 |
/*
|
|
67 |
Number of fields (i.e. cache_field objects). Those correspond to table
|
|
68 |
columns, and there are also special fields for
|
|
69 |
- table's column null bits
|
|
70 |
- table's null-complementation byte
|
|
71 |
- [new] table's rowid.
|
|
72 |
*/
|
|
73 |
uint32_t fields; |
|
74 |
uint32_t length; |
|
75 |
uint32_t blobs; |
|
1539.1.6
by Brian Aker
Update for Join structure changes. |
76 |
CacheField *field; |
77 |
CacheField **blob_ptr; |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
78 |
optimizer::SqlSelect *select; |
1539.1.7
by Brian Aker
JoinCache rename. |
79 |
|
1894.1.1
by tdavies
in .../drizzled/join_cache.h converted structs JoinCache and CacheField to C++ classes |
80 |
JoinCache(): |
81 |
buff(NULL), |
|
82 |
pos(NULL), |
|
83 |
end(NULL), |
|
84 |
records(0), |
|
85 |
record_nr(0), |
|
86 |
ptr_record(0), |
|
87 |
fields(0), |
|
88 |
length(0), |
|
89 |
blobs(0), |
|
90 |
field(NULL), |
|
91 |
blob_ptr(NULL), |
|
92 |
select(NULL) |
|
93 |
{}
|
|
94 |
||
1539.1.7
by Brian Aker
JoinCache rename. |
95 |
void reset_cache_read(); |
96 |
void reset_cache_write(); |
|
97 |
bool store_record_in_cache(); |
|
1539.1.6
by Brian Aker
Update for Join structure changes. |
98 |
};
|
1039.2.3
by Jay Pipes
Phase 3 of refactoring JOIN |
99 |
|
1089.1.1
by Brian Aker
Remove of JOIN_TAB to JoinTable |
100 |
int join_init_cache(Session *session, JoinTable *tables, uint32_t table_count); |
1039.2.3
by Jay Pipes
Phase 3 of refactoring JOIN |
101 |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
102 |
} /* namespace drizzled */ |
103 |
||
1039.2.3
by Jay Pipes
Phase 3 of refactoring JOIN |
104 |
#endif /* DRIZZLED_JOIN_CACHE_H */ |