From e8248f8772b17f44af06637ecba6b63a4a83722a Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Mon, 17 Mar 2008 17:17:59 +0000 Subject: [PATCH] MARIA: TRANSACTIONAL create option (in Operations) --- libraries/sqlparser.data.php | 3 ++- libraries/tbl_info.inc.php | 2 +- tbl_operations.php | 38 ++++++++++++++++++++++++++++++++---- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/libraries/sqlparser.data.php b/libraries/sqlparser.data.php index 5e226a752..d8e92c028 100644 --- a/libraries/sqlparser.data.php +++ b/libraries/sqlparser.data.php @@ -657,6 +657,7 @@ $PMA_SQPdata_reserved_word = array ( 'THEN', 'TO', 'TRAILING', + 'TRANSACTIONAL', // 5.1 ? 'TRUNCATE', 'TYPE', 'TYPES', @@ -684,7 +685,7 @@ $PMA_SQPdata_reserved_word = array ( * * @global integer MySQL reserved words count */ -$PMA_SQPdata_reserved_word_cnt = 282; +$PMA_SQPdata_reserved_word_cnt = 283; /** * The previous array must be sorted so that the binary search work. * Sometimes a word is not added in the correct order, so diff --git a/libraries/tbl_info.inc.php b/libraries/tbl_info.inc.php index 7540763fd..b2f329c70 100644 --- a/libraries/tbl_info.inc.php +++ b/libraries/tbl_info.inc.php @@ -88,7 +88,7 @@ if ($table_info_result && PMA_DBI_num_rows($table_info_result) > 0) { ? explode(' ', $showtable['Create_options']) : array(); - // export create options by its name as variables into gloabel namespace + // export create options by its name as variables into global namespace // f.e. pack_keys=1 becomes available as $pack_keys with value of '1' unset($pack_keys); foreach ($create_options as $each_create_option) { diff --git a/tbl_operations.php b/tbl_operations.php index 2cec4ef01..e7312435b 100644 --- a/tbl_operations.php +++ b/tbl_operations.php @@ -48,10 +48,19 @@ PMA_DBI_select_db($GLOBALS['db']); require './libraries/tbl_info.inc.php'; // define some globals here, for improved syntax in the conditionals -$is_myisam_or_maria = $is_isam = $is_innodb = $is_berkeleydb = false; +$is_myisam_or_maria = $is_isam = $is_innodb = $is_berkeleydb = $is_maria = false; // set initial value of these globals, based on the current table engine PMA_set_global_variables_for_engine($tbl_type); +if ($is_maria) { + // 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) + // ($transactional may have been set by libraries/tbl_info.inc.php, + // from the $create_options) + $transactional = (isset($transactional) && $transactional == '0') ? '0' : '1'; +} + $reread_info = false; $table_alters = array(); @@ -102,6 +111,12 @@ if (isset($_REQUEST['submitoptions'])) { $table_alters[] = 'checksum = ' . $_REQUEST['new_checksum']; } + $_REQUEST['new_transactional'] = empty($_REQUEST['new_transactional']) ? '0' : '1'; + if ($is_maria + && $_REQUEST['new_transactional'] !== $transactional) { + $table_alters[] = 'TRANSACTIONAL = ' . $_REQUEST['new_transactional']; + } + $delay_key_write = empty($delay_key_write) ? '0' : '1'; $_REQUEST['new_delay_key_write'] = empty($_REQUEST['new_delay_key_write']) ? '0' : '1'; if ($is_myisam_or_maria @@ -347,10 +362,24 @@ if ($is_myisam_or_maria) { + + /> + + + + 0 && ($is_myisam_or_maria || $is_innodb)) { ?> - + @@ -614,13 +643,14 @@ require_once './libraries/footer.inc.php'; function PMA_set_global_variables_for_engine($tbl_type) { - global $is_myisam_or_maria, $is_innodb, $is_isam, $is_berkeleydb; + global $is_myisam_or_maria, $is_innodb, $is_isam, $is_berkeleydb, $is_maria; - $is_myisam_or_maria = $is_isam = $is_innodb = $is_berkeleydb = false; + $is_myisam_or_maria = $is_isam = $is_innodb = $is_berkeleydb = $is_maria = false; $upper_tbl_type = strtoupper($tbl_type); //Options that apply to MYISAM usually apply to MARIA $is_myisam_or_maria = ($upper_tbl_type == 'MYISAM' || $upper_tbl_type == 'MARIA'); + $is_maria = ($upper_tbl_type == 'MARIA'); $is_isam = ($upper_tbl_type == 'ISAM'); $is_innodb = ($upper_tbl_type == 'INNODB');