~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to sql/partition_element.h

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2006 MySQL AB
 
2
 
 
3
   This program is free software; you can redistribute it and/or modify
 
4
   it under the terms of the GNU General Public License as published by
 
5
   the Free Software Foundation; version 2 of the License.
 
6
 
 
7
   This program is distributed in the hope that it will be useful,
 
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
   GNU General Public License for more details.
 
11
 
 
12
   You should have received a copy of the GNU General Public License
 
13
   along with this program; if not, write to the Free Software
 
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
15
 
 
16
/**
 
17
 * An enum and a struct to handle partitioning and subpartitioning.
 
18
 */
 
19
enum partition_type {
 
20
  NOT_A_PARTITION= 0,
 
21
  RANGE_PARTITION,
 
22
  HASH_PARTITION,
 
23
  LIST_PARTITION
 
24
};
 
25
 
 
26
enum partition_state {
 
27
  PART_NORMAL= 0,
 
28
  PART_IS_DROPPED= 1,
 
29
  PART_TO_BE_DROPPED= 2,
 
30
  PART_TO_BE_ADDED= 3,
 
31
  PART_TO_BE_REORGED= 4,
 
32
  PART_REORGED_DROPPED= 5,
 
33
  PART_CHANGED= 6,
 
34
  PART_IS_CHANGED= 7,
 
35
  PART_IS_ADDED= 8
 
36
};
 
37
 
 
38
/*
 
39
  This struct is used to contain the value of an element
 
40
  in the VALUES IN struct. It needs to keep knowledge of
 
41
  whether it is a signed/unsigned value and whether it is
 
42
  NULL or not.
 
43
*/
 
44
 
 
45
typedef struct p_elem_val
 
46
{
 
47
  longlong value;
 
48
  bool null_value;
 
49
  bool unsigned_flag;
 
50
} part_elem_value;
 
51
 
 
52
struct st_ddl_log_memory_entry;
 
53
 
 
54
class partition_element :public Sql_alloc {
 
55
public:
 
56
  List<partition_element> subpartitions;
 
57
  List<part_elem_value> list_val_list;
 
58
  ha_rows part_max_rows;
 
59
  ha_rows part_min_rows;
 
60
  longlong range_value;
 
61
  char *partition_name;
 
62
  char *tablespace_name;
 
63
  struct st_ddl_log_memory_entry *log_entry;
 
64
  char* part_comment;
 
65
  char* data_file_name;
 
66
  char* index_file_name;
 
67
  handlerton *engine_type;
 
68
  enum partition_state part_state;
 
69
  uint16 nodegroup_id;
 
70
  bool has_null_value;
 
71
  bool signed_flag;/* Indicate whether this partition uses signed constants */
 
72
  bool max_value;  /* Indicate whether this partition uses MAXVALUE */
 
73
 
 
74
  partition_element()
 
75
  : part_max_rows(0), part_min_rows(0), range_value(0),
 
76
    partition_name(NULL), tablespace_name(NULL),
 
77
    log_entry(NULL), part_comment(NULL),
 
78
    data_file_name(NULL), index_file_name(NULL),
 
79
    engine_type(NULL), part_state(PART_NORMAL),
 
80
    nodegroup_id(UNDEF_NODEGROUP), has_null_value(FALSE),
 
81
    signed_flag(FALSE), max_value(FALSE)
 
82
  {
 
83
  }
 
84
  partition_element(partition_element *part_elem)
 
85
  : part_max_rows(part_elem->part_max_rows),
 
86
    part_min_rows(part_elem->part_min_rows),
 
87
    range_value(0), partition_name(NULL),
 
88
    tablespace_name(part_elem->tablespace_name),
 
89
    part_comment(part_elem->part_comment),
 
90
    data_file_name(part_elem->data_file_name),
 
91
    index_file_name(part_elem->index_file_name),
 
92
    engine_type(part_elem->engine_type),
 
93
    part_state(part_elem->part_state),
 
94
    nodegroup_id(part_elem->nodegroup_id),
 
95
    has_null_value(FALSE)
 
96
  {
 
97
  }
 
98
  ~partition_element() {}
 
99
};