Translated using Weblate (Catalan)
[phpmyadmin.git] / libraries / Partition.class.php
blobf96285e8c6603150ed2b184e09d6a254156fafca
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 $GLOBALS['dbi']->fetchResult(
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 < 50600) {
57 if ($GLOBALS['dbi']->fetchValue(
58 "SHOW VARIABLES LIKE 'have_partitioning';"
59 )) {
60 $have_partitioning = true;
62 } else {
63 // see http://dev.mysql.com/doc/refman/5.6/en/partitioning.html
64 $plugins = $GLOBALS['dbi']->fetchResult("SHOW PLUGINS");
65 foreach ($plugins as $value) {
66 if ($value['Name'] == 'partition') {
67 $have_partitioning = true;
68 break;
72 $already_checked = true;
74 return $have_partitioning;