isEngine() public method

Checks the storage engine used to create table
public isEngine ( $engine ) : boolean
return boolean True, if $engine matches the storage engine for the table, False otherwise.
Exemplo n.º 1
0
require 'libraries/tbl_common.inc.php';
$url_query .= '&goto=tbl_operations.php&back=tbl_operations.php';
$url_params['goto'] = $url_params['back'] = 'tbl_operations.php';
/**
 * Gets relation settings
 */
$cfgRelation = PMA_getRelationsParam();
// reselect current db (needed in some cases probably due to
// the calling of relation.lib.php)
$GLOBALS['dbi']->selectDb($GLOBALS['db']);
/**
 * Gets tables information
 */
require 'libraries/tbl_info.inc.php';
// set initial value of these variables, based on the current table engine
if ($pma_table->isEngine('ARIA')) {
    // the value for transactional can be implicit
    // (no create option found, in this case it means 1)
    // or explicit (option found with a value of 0 or 1)
    // ($create_options['transactional'] may have been set by libraries/tbl_info.inc.php,
    // from the $create_options)
    $create_options['transactional'] = isset($create_options['transactional']) && $create_options['transactional'] == '0' ? '0' : '1';
    $create_options['page_checksum'] = isset($create_options['page_checksum']) ? $create_options['page_checksum'] : '';
}
$reread_info = false;
$table_alters = array();
/**
 * If the table has to be moved to some other database
 */
if (isset($_REQUEST['submit_move']) || isset($_REQUEST['submit_copy'])) {
    //$_message = '';
Exemplo n.º 2
0
/**
 * Get table alters array
 *
 * @param Table   $pma_table           The Table object
 * @param string  $pack_keys           pack keys
 * @param string  $checksum            value of checksum
 * @param string  $page_checksum       value of page checksum
 * @param string  $delay_key_write     delay key write
 * @param string  $row_format          row format
 * @param string  $newTblStorageEngine table storage engine
 * @param string  $transactional       value of transactional
 * @param string  $tbl_collation       collation of the table
 *
 * @return array  $table_alters
 */
function PMA_getTableAltersArray($pma_table, $pack_keys, $checksum, $page_checksum, $delay_key_write, $row_format, $newTblStorageEngine, $transactional, $tbl_collation)
{
    global $auto_increment;
    $table_alters = array();
    if (isset($_REQUEST['comment']) && urldecode($_REQUEST['prev_comment']) !== $_REQUEST['comment']) {
        $table_alters[] = 'COMMENT = \'' . $GLOBALS['dbi']->escapeString($_REQUEST['comment']) . '\'';
    }
    if (!empty($newTblStorageEngine) && mb_strtolower($newTblStorageEngine) !== mb_strtolower($GLOBALS['tbl_storage_engine'])) {
        $table_alters[] = 'ENGINE = ' . $newTblStorageEngine;
    }
    if (!empty($_REQUEST['tbl_collation']) && $_REQUEST['tbl_collation'] !== $tbl_collation) {
        $table_alters[] = 'DEFAULT ' . Util::getCharsetQueryPart($_REQUEST['tbl_collation']);
    }
    if ($pma_table->isEngine(array('MYISAM', 'ARIA', 'ISAM')) && isset($_REQUEST['new_pack_keys']) && $_REQUEST['new_pack_keys'] != (string) $pack_keys) {
        $table_alters[] = 'pack_keys = ' . $_REQUEST['new_pack_keys'];
    }
    $_REQUEST['new_checksum'] = empty($_REQUEST['new_checksum']) ? '0' : '1';
    if ($pma_table->isEngine(array('MYISAM', 'ARIA')) && $_REQUEST['new_checksum'] !== $checksum) {
        $table_alters[] = 'checksum = ' . $_REQUEST['new_checksum'];
    }
    $_REQUEST['new_transactional'] = empty($_REQUEST['new_transactional']) ? '0' : '1';
    if ($pma_table->isEngine('ARIA') && $_REQUEST['new_transactional'] !== $transactional) {
        $table_alters[] = 'TRANSACTIONAL = ' . $_REQUEST['new_transactional'];
    }
    $_REQUEST['new_page_checksum'] = empty($_REQUEST['new_page_checksum']) ? '0' : '1';
    if ($pma_table->isEngine('ARIA') && $_REQUEST['new_page_checksum'] !== $page_checksum) {
        $table_alters[] = 'PAGE_CHECKSUM = ' . $_REQUEST['new_page_checksum'];
    }
    $_REQUEST['new_delay_key_write'] = empty($_REQUEST['new_delay_key_write']) ? '0' : '1';
    if ($pma_table->isEngine(array('MYISAM', 'ARIA')) && $_REQUEST['new_delay_key_write'] !== $delay_key_write) {
        $table_alters[] = 'delay_key_write = ' . $_REQUEST['new_delay_key_write'];
    }
    if ($pma_table->isEngine(array('MYISAM', 'ARIA', 'INNODB', 'PBXT')) && !empty($_REQUEST['new_auto_increment']) && (!isset($auto_increment) || $_REQUEST['new_auto_increment'] !== $auto_increment)) {
        $table_alters[] = 'auto_increment = ' . $GLOBALS['dbi']->escapeString($_REQUEST['new_auto_increment']);
    }
    if (!empty($_REQUEST['new_row_format'])) {
        $newRowFormat = $_REQUEST['new_row_format'];
        $newRowFormatLower = mb_strtolower($newRowFormat);
        if ($pma_table->isEngine(array('MYISAM', 'ARIA', 'INNODB', 'PBXT')) && (strlen($row_format) === 0 || $newRowFormatLower !== mb_strtolower($row_format))) {
            $table_alters[] = 'ROW_FORMAT = ' . $GLOBALS['dbi']->escapeString($newRowFormat);
        }
    }
    return $table_alters;
}