~drizzle-trunk/drizzle/development

851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
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
21
#ifndef DRIZZLED_TMP_TABLE_PARAM_H
22
#define DRIZZLED_TMP_TABLE_PARAM_H
23
24
/*
25
  Param to create temporary tables when doing SELECT:s
26
  NOTE
27
    This structure is copied using memcpy as a part of JOIN.
28
*/
29
30
class Tmp_Table_Param :public Sql_alloc
31
{
32
private:
33
  /* Prevent use of these (not safe because of lists and copy_field) */
34
  Tmp_Table_Param(const Tmp_Table_Param &);
35
  void operator=(Tmp_Table_Param &);
36
37
public:
38
  List<Item> copy_funcs;
39
  List<Item> save_copy_funcs;
40
  Copy_field *copy_field, *copy_field_end;
41
  Copy_field *save_copy_field, *save_copy_field_end;
42
  unsigned char	    *group_buff;
43
  Item	    **items_to_copy;			/* Fields in tmp table */
44
  MI_COLUMNDEF *recinfo,*start_recinfo;
45
  KEY *keyinfo;
46
  ha_rows end_write_records;
47
  uint	field_count,sum_func_count,func_count;
48
  uint32_t  hidden_field_count;
49
  uint	group_parts,group_length,group_null_parts;
50
  uint	quick_group;
51
  bool  using_indirect_summary_function;
52
  /* If >0 convert all blob fields to varchar(convert_blob_length) */
53
  uint32_t  convert_blob_length;
54
  const CHARSET_INFO *table_charset;
55
  bool schema_table;
56
  /*
57
    True if GROUP BY and its aggregate functions are already computed
58
    by a table access method (e.g. by loose index scan). In this case
59
    query execution should not perform aggregation and should treat
60
    aggregate functions as normal functions.
61
  */
62
  bool precomputed_group_by;
63
  bool force_copy_fields;
64
  /*
65
    If true, create_tmp_field called from create_tmp_table will convert
66
    all BIT fields to 64-bit longs. This is a workaround the limitation
67
    that MEMORY tables cannot index BIT columns.
68
  */
69
  bool bit_fields_as_long;
70
71
  Tmp_Table_Param()
72
    :copy_field(0), group_parts(0),
73
     group_length(0), group_null_parts(0), convert_blob_length(0),
74
     schema_table(0), precomputed_group_by(0), force_copy_fields(0),
75
     bit_fields_as_long(0)
76
  {}
77
  ~Tmp_Table_Param()
78
  {
79
    cleanup();
80
  }
81
  void init(void);
82
  void cleanup(void);
83
};
84
85
#endif /* DRIZZLED_TMP_TABLE_PARAM_H */