more partition stuff
This commit is contained in:
55
libraries/Partition.class.php
Normal file
55
libraries/Partition.class.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Library for extracting information about the partitions
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* base Partition Class
|
||||
*/
|
||||
class PMA_Partition
|
||||
{
|
||||
/**
|
||||
* returns array of partition names for a specific db/table
|
||||
*
|
||||
* @access public
|
||||
* @uses PMA_DBI_fetch_result()
|
||||
* @return array of partition names
|
||||
*/
|
||||
static public function getPartitionNames($db, $table)
|
||||
{
|
||||
if (PMA_Partition::havePartitioning()) {
|
||||
return PMA_DBI_fetch_result("select `PARTITION_NAME` from `information_schema`.`PARTITIONS` where `TABLE_SCHEMA` = '" . $db . "' and `TABLE_NAME` = '" . $table . "'");
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* checks if MySQL server supports partitioning
|
||||
*
|
||||
* @static
|
||||
* @staticvar boolean $have_partitioning
|
||||
* @staticvar boolean $already_checked
|
||||
* @access public
|
||||
* @uses PMA_DBI_fetch_result()
|
||||
* @return boolean
|
||||
*/
|
||||
static public function havePartitioning()
|
||||
{
|
||||
static $have_partitioning = false;
|
||||
static $already_checked = false;
|
||||
|
||||
if (! $already_checked) {
|
||||
$have_partitioning = PMA_MYSQL_INT_VERSION >= 50100 && PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'have_partitioning';");
|
||||
$already_checked = true;
|
||||
}
|
||||
return $have_partitioning;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -16,6 +16,11 @@ PMA_checkParameters(array('db', 'table', 'action', 'num_fields'));
|
||||
require_once './libraries/mysql_charsets.lib.php';
|
||||
require_once './libraries/StorageEngine.class.php';
|
||||
|
||||
/**
|
||||
* Class for partition management
|
||||
*/
|
||||
require_once './libraries/Partition.class.php';
|
||||
|
||||
if (is_int($cfg['DefaultPropDisplay'])) {
|
||||
if ($num_fields <= $cfg['DefaultPropDisplay']) {
|
||||
$display_type = 'vertical';
|
||||
@@ -662,7 +667,7 @@ if ($action == 'tbl_create.php') {
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
if (PMA_MYSQL_INT_VERSION >= 50100 && PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'have_partitioning';")) {
|
||||
if (PMA_Partition::havePartitioning()) {
|
||||
?>
|
||||
<tr valign="top">
|
||||
<th><?php echo $strPartitionDefinition; ?>: <?php echo PMA_showMySQLDocu('Partitioning', 'Partitioning'); ?>
|
||||
|
@@ -32,6 +32,11 @@ $cfgRelation = PMA_getRelationsParam();
|
||||
require_once './libraries/mysql_charsets.lib.php';
|
||||
require_once './libraries/StorageEngine.class.php';
|
||||
|
||||
/**
|
||||
* Class for partition management
|
||||
*/
|
||||
require_once './libraries/Partition.class.php';
|
||||
|
||||
// reselect current db (needed in some cases probably due to
|
||||
// the calling of relation.lib.php)
|
||||
PMA_DBI_select_db($GLOBALS['db']);
|
||||
|
Reference in New Issue
Block a user