Upgraded phpmyadmin to 4.0.4 (All Languages) - No modifications yet
[openemr.git] / phpmyadmin / libraries / Partition.class.php
blob72137f81a37eb184e7d4912bc86b8f3a70907e50
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Library for extracting information about the partitions
6 * @package PhpMyAdmin
7 */
8 if (! defined('PHPMYADMIN')) {
9 exit;
12 /**
13 * base Partition Class
15 * @package PhpMyAdmin
17 class PMA_Partition
19 /**
20 * returns array of partition names for a specific db/table
22 * @param string $db database name
23 * @param string $table table name
25 * @access public
26 * @return array of partition names
28 static public function getPartitionNames($db, $table)
30 if (PMA_Partition::havePartitioning()) {
31 return PMA_DBI_fetch_result(
32 "SELECT `PARTITION_NAME` FROM `information_schema`.`PARTITIONS`"
33 . " WHERE `TABLE_SCHEMA` = '" . $db
34 . "' AND `TABLE_NAME` = '" . $table . "'"
36 } else {
37 return array();
41 /**
42 * checks if MySQL server supports partitioning
44 * @static
45 * @staticvar boolean $have_partitioning
46 * @staticvar boolean $already_checked
47 * @access public
48 * @return boolean
50 static public function havePartitioning()
52 static $have_partitioning = false;
53 static $already_checked = false;
55 if (! $already_checked) {
56 if (PMA_MYSQL_INT_VERSION >= 50100) {
57 if (PMA_MYSQL_INT_VERSION < 50600) {
58 if (PMA_DBI_fetch_value(
59 "SHOW VARIABLES LIKE 'have_partitioning';"
60 )) {
61 $have_partitioning = true;
63 } else {
64 // see http://dev.mysql.com/doc/refman/5.6/en/partitioning.html
65 $plugins = PMA_DBI_fetch_result("SHOW PLUGINS");
66 foreach ($plugins as $value) {
67 if ($value['Name'] == 'partition') {
68 $have_partitioning = true;
69 break;
73 $already_checked = true;
76 return $have_partitioning;