You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.9 KiB

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