2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Library for extracting information about the sub-partitions
8 namespace PMA\libraries
;
11 * Represents a sub partition of a table
18 * @var string the database
22 * @var string the table
26 * @var string partition name
30 * @var integer ordinal
34 * @var string partition method
38 * @var string partition expression
40 protected $expression;
42 * @var integer no of table rows in the partition
46 * @var integer data length
48 protected $dataLength;
50 * @var integer index length
52 protected $indexLength;
54 * @var string partition comment
59 * Constructs a partition
61 * @param array $row fetched row from information_schema.PARTITIONS
63 public function __construct($row)
65 $this->db
= $row['TABLE_SCHEMA'];
66 $this->table
= $row['TABLE_NAME'];
67 $this->loadData($row);
71 * Loads data from the fetched row from information_schema.PARTITIONS
73 * @param array $row fetched row
77 protected function loadData($row)
79 $this->name
= $row['SUBPARTITION_NAME'];
80 $this->ordinal
= $row['SUBPARTITION_ORDINAL_POSITION'];
81 $this->method
= $row['SUBPARTITION_METHOD'];
82 $this->expression
= $row['SUBPARTITION_EXPRESSION'];
83 $this->loadCommonData($row);
87 * Loads some data that is common to both partitions and sub partitions
89 * @param array $row fetched row
93 protected function loadCommonData($row)
95 $this->rows
= $row['TABLE_ROWS'];
96 $this->dataLength
= $row['DATA_LENGTH'];
97 $this->indexLength
= $row['INDEX_LENGTH'];
98 $this->comment
= $row['PARTITION_COMMENT'];
102 * Return the partition name
104 * @return string partition name
106 public function getName()
112 * Return the ordinal of the partition
114 * @return number the ordinal
116 public function getOrdinal()
118 return $this->ordinal
;
122 * Returns the partition method
124 * @return string partition method
126 public function getMethod()
128 return $this->method
;
132 * Returns the partition expression
134 * @return string partition expression
136 public function getExpression()
138 return $this->expression
;
142 * Returns the number of data rows
144 * @return integer number of rows
146 public function getRows()
152 * Returns the data length
154 * @return integer data length
156 public function getDataLength()
158 return $this->dataLength
;
162 * Returns the index length
164 * @return integer index length
166 public function getIndexLength()
168 return $this->indexLength
;
172 * Returns the partition comment
174 * @return string partition comment
176 public function getComment()
178 return $this->comment
;