~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/join_cache.h

  • Committer: Brian Aker
  • Date: 2009-02-21 00:18:15 UTC
  • Revision ID: brian@tangent.org-20090221001815-x20e8h71e984lvs1
Completion (?) of uint conversion.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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, Inc.
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
 
 
23
 
namespace drizzled
24
 
{
25
 
 
26
 
class Field_blob;
27
 
typedef JoinTable JoinTable;
28
 
 
29
 
/**
30
 
  CacheField and JoinCache is used on full join to cache records in outer
31
 
  table
32
 
*/
33
 
class CacheField {
34
 
  /*
35
 
    Where source data is located (i.e. this points to somewhere in
36
 
    tableX->getInsertRecord())
37
 
  */
38
 
public:
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 <=> */
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
 
 
55
 
};
56
 
 
57
 
class JoinCache
58
 
{
59
 
public:
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;
76
 
  CacheField *field;
77
 
  CacheField **blob_ptr;
78
 
  optimizer::SqlSelect *select;
79
 
 
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
 
 
95
 
  void reset_cache_read();
96
 
  void reset_cache_write();
97
 
  bool store_record_in_cache();
98
 
};
99
 
 
100
 
int join_init_cache(Session *session, JoinTable *tables, uint32_t table_count);
101
 
 
102
 
} /* namespace drizzled */
103
 
 
104
 
#endif /* DRIZZLED_JOIN_CACHE_H */