~drizzle-pbxt/drizzle/drizzle-pbxt-2

« back to all changes in this revision

Viewing changes to drizzled/join_cache.h

  • Committer: Paul McCullagh
  • Date: 2009-11-10 14:18:39 UTC
  • mfrom: (1038.1.7 drizzle-pbxt-pre-merge)
  • Revision ID: paul.mccullagh@primebase.org-20091110141839-2j3k43b17ag6f605
Merged Drizzle trunk and PBXT 1.0.09

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
 
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
class Field_blob;
 
24
typedef JoinTable JoinTable;
 
25
 
 
26
/**
 
27
  CACHE_FIELD and JOIN_CACHE is used on full join to cache records in outer
 
28
  table
 
29
*/
 
30
typedef struct st_cache_field {
 
31
  /*
 
32
    Where source data is located (i.e. this points to somewhere in
 
33
    tableX->record[0])
 
34
  */
 
35
  unsigned char *str;
 
36
  uint32_t length; /* Length of data at *str, in bytes */
 
37
  uint32_t blob_length; /* Valid IFF blob_field != 0 */
 
38
  Field_blob *blob_field;
 
39
  bool strip; /* true <=> Strip endspaces ?? */
 
40
 
 
41
  Table *get_rowid; /* _ != NULL <=> */
 
42
} CACHE_FIELD;
 
43
 
 
44
typedef struct st_join_cache
 
45
{
 
46
  unsigned char *buff;
 
47
  unsigned char *pos;    /* Start of free space in the buffer */
 
48
  unsigned char *end;
 
49
  uint32_t records;  /* # of row cominations currently stored in the cache */
 
50
  uint32_t record_nr;
 
51
  uint32_t ptr_record;
 
52
  /*
 
53
    Number of fields (i.e. cache_field objects). Those correspond to table
 
54
    columns, and there are also special fields for
 
55
     - table's column null bits
 
56
     - table's null-complementation byte
 
57
     - [new] table's rowid.
 
58
  */
 
59
  uint32_t fields;
 
60
  uint32_t length;
 
61
  uint32_t blobs;
 
62
  CACHE_FIELD *field;
 
63
  CACHE_FIELD **blob_ptr;
 
64
  SQL_SELECT *select;
 
65
} JOIN_CACHE;
 
66
 
 
67
int join_init_cache(Session *session, JoinTable *tables, uint32_t table_count);
 
68
void reset_cache_read(JOIN_CACHE *cache);
 
69
void reset_cache_write(JOIN_CACHE *cache);
 
70
bool store_record_in_cache(JOIN_CACHE *cache);
 
71
 
 
72
#endif /* DRIZZLED_JOIN_CACHE_H */