~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/join_cache.h

  • Committer: Brian Aker
  • Date: 2009-11-12 16:13:04 UTC
  • mfrom: (1211.1.7 staging)
  • Revision ID: brian@gaz-20091112161304-opamiauv36fg0n6u
Rollup of Brian, Padraig, and Stewart patches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
20
20
#ifndef DRIZZLED_JOIN_CACHE_H
21
21
#define DRIZZLED_JOIN_CACHE_H
22
22
 
23
 
namespace drizzled
24
 
{
25
 
 
26
23
class Field_blob;
27
24
typedef JoinTable JoinTable;
28
25
 
29
26
/**
30
 
  CacheField and JoinCache is used on full join to cache records in outer
 
27
  CACHE_FIELD and JOIN_CACHE is used on full join to cache records in outer
31
28
  table
32
29
*/
33
 
class CacheField {
 
30
typedef struct st_cache_field {
34
31
  /*
35
32
    Where source data is located (i.e. this points to somewhere in
36
 
    tableX->getInsertRecord())
 
33
    tableX->record[0])
37
34
  */
38
 
public:
39
35
  unsigned char *str;
40
36
  uint32_t length; /* Length of data at *str, in bytes */
41
37
  uint32_t blob_length; /* Valid IFF blob_field != 0 */
42
38
  Field_blob *blob_field;
43
39
  bool strip; /* true <=> Strip endspaces ?? */
 
40
 
44
41
  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
 
42
} CACHE_FIELD;
 
43
 
 
44
typedef struct st_join_cache
58
45
{
59
 
public:
60
46
  unsigned char *buff;
61
47
  unsigned char *pos;    /* Start of free space in the buffer */
62
48
  unsigned char *end;
73
59
  uint32_t fields;
74
60
  uint32_t length;
75
61
  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
 
};
 
62
  CACHE_FIELD *field;
 
63
  CACHE_FIELD **blob_ptr;
 
64
  SQL_SELECT *select;
 
65
} JOIN_CACHE;
99
66
 
100
67
int join_init_cache(Session *session, JoinTable *tables, uint32_t table_count);
101
 
 
102
 
} /* namespace drizzled */
 
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);
103
71
 
104
72
#endif /* DRIZZLED_JOIN_CACHE_H */