~drizzle-trunk/drizzle/development

1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
1237.9.4 by Padraig O'Sullivan
Removed the inclusion of drizzled/field.h in the server_includes header file.
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2009 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_RECORDS_H
21
#define DRIZZLED_RECORDS_H
22
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
23
namespace drizzled
24
{
25
1237.9.4 by Padraig O'Sullivan
Removed the inclusion of drizzled/field.h in the server_includes header file.
26
/**
27
  Initialize READ_RECORD structure to perform full index scan (in forward
28
  direction) using read_record.read_record() interface.
29
30
    This function has been added at late stage and is used only by
31
    UPDATE/DELETE. Other statements perform index scans using
32
    join_read_first/next functions.
33
34
  @param info         READ_RECORD structure to initialize.
35
  @param session          Thread handle
36
  @param table        Table to be accessed
37
  @param print_error  If true, call table->print_error() if an error
38
                      occurs (except for end-of-records error)
39
  @param idx          index to scan
40
*/
41
void init_read_record_idx(READ_RECORD *info, 
42
                          Session *session, 
43
                          Table *table,
44
                          bool print_error, 
45
                          uint32_t idx);
46
47
/*
48
  init_read_record is used to scan by using a number of different methods.
49
  Which method to use is set-up in this call so that later calls to
50
  the info->read_record will call the appropriate method using a function
51
  pointer.
52
53
  There are five methods that relate completely to the sort function
54
  filesort. The result of a filesort is retrieved using read_record
55
  calls. The other two methods are used for normal table access.
56
57
  The filesort will produce references to the records sorted, these
58
  references can be stored in memory or in a temporary cursor.
59
60
  The temporary cursor is normally used when the references doesn't fit into
61
  a properly sized memory buffer. For most small queries the references
62
  are stored in the memory buffer.
63
64
  The temporary cursor is also used when performing an update where a key is
65
  modified.
66
67
  Methods used when ref's are in memory (using rr_from_pointers):
68
    rr_unpack_from_buffer:
69
    ----------------------
70
      This method is used when table->sort.addon_field is allocated.
71
      This is allocated for most SELECT queries not involving any BLOB's.
72
      In this case the records are fetched from a memory buffer.
73
    rr_from_pointers:
74
    -----------------
75
      Used when the above is not true, UPDATE, DELETE and so forth and
76
      SELECT's involving BLOB's. It is also used when the addon_field
77
      buffer is not allocated due to that its size was bigger than the
78
      session variable max_length_for_sort_data.
79
      In this case the record data is fetched from the handler using the
80
      saved reference using the rnd_pos handler call.
81
82
  Methods used when ref's are in a temporary cursor (using rr_from_tempfile)
83
    rr_unpack_from_tempfile:
84
    ------------------------
85
      Same as rr_unpack_from_buffer except that references are fetched from
86
      temporary cursor. Should obviously not really happen other than in
87
      strange configurations.
88
89
    rr_from_tempfile:
90
    -----------------
91
      Same as rr_from_pointers except that references are fetched from
92
      temporary cursor instead of from
93
    rr_from_cache:
94
    --------------
95
      This is a special variant of rr_from_tempfile that can be used for
96
      handlers that is not using the HA_FAST_KEY_READ table flag. Instead
97
      of reading the references one by one from the temporary cursor it reads
98
      a set of them, sorts them and reads all of them into a buffer which
99
      is then used for a number of subsequent calls to rr_from_cache.
100
      It is only used for SELECT queries and a number of other conditions
101
      on table size.
102
103
  All other accesses use either index access methods (rr_quick) or a full
104
  table scan (rr_sequential).
105
  rr_quick:
106
  ---------
107
    rr_quick uses one of the QUICK_SELECT classes in optimizer/range.cc to
108
    perform an index scan. There are loads of functionality hidden
109
    in these quick classes. It handles all index scans of various kinds.
110
  rr_sequential:
111
  --------------
112
    This is the most basic access method of a table using rnd_init,
113
    rnd_next and rnd_end. No indexes are used.
114
*/
115
void init_read_record(READ_RECORD *info, 
116
                      Session *session, 
117
                      Table *reg_form,
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
118
                      optimizer::SqlSelect *select,
1237.9.4 by Padraig O'Sullivan
Removed the inclusion of drizzled/field.h in the server_includes header file.
119
                      int use_record_cache, 
120
                      bool print_errors);
121
122
void end_read_record(READ_RECORD *info);
123
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
124
} /* namespace drizzled */
125
1237.9.4 by Padraig O'Sullivan
Removed the inclusion of drizzled/field.h in the server_includes header file.
126
#endif /* DRIZZLED_RECORDS_H */