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
3.0 KiB

20 years ago
  1. /* Copyright (C) 2000,200666666 MySQL AB & MySQL Finland AB & TCX DataKonsult 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; either version 2 of the License, or
  5. (at your option) any later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program; if not, write to the Free Software
  12. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
  13. /**
  14. * An enum and a struct to handle partitioning and subpartitioning.
  15. */
  16. enum partition_type {
  17. NOT_A_PARTITION= 0,
  18. RANGE_PARTITION,
  19. HASH_PARTITION,
  20. LIST_PARTITION
  21. };
  22. enum partition_state {
  23. PART_NORMAL= 0,
  24. PART_IS_DROPPED= 1,
  25. PART_TO_BE_DROPPED= 2,
  26. PART_TO_BE_ADDED= 3,
  27. PART_TO_BE_REORGED= 4,
  28. PART_REORGED_DROPPED= 5,
  29. PART_CHANGED= 6,
  30. PART_IS_CHANGED= 7,
  31. PART_IS_ADDED= 8
  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. ulonglong part_max_rows;
  51. ulonglong 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. partition_name(NULL),
  79. tablespace_name(part_elem->tablespace_name),
  80. range_value(0), 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. };