📄 read_dump.php
字号:
// Values for verbose-mode $max_nofile_length = 0; $max_nofile_pieces = 50; // Nijel: Here must be some limit, as extended inserts can be really // huge and parsing them eats megabytes of memory $max_file_length = 50000; $max_file_pieces = 50; } if ($sql_file != 'none' && (($max_file_pieces != 0 && ($pieces_count > $max_file_pieces)) || ($max_file_length != 0 && (strlen($sql_query) > $max_file_length)))) { // Be nice with bandwidth... $sql_query_cpy = $sql_query = ''; $save_bandwidth = TRUE; $save_bandwidth_length = $max_file_length; $save_bandwidth_pieces = $max_file_pieces; } else { $sql_query_cpy = $sql_query; // Be nice with bandwidth... for now, an arbitrary limit of 500, // could be made configurable but probably not necessary if (($max_nofile_length != 0 && (strlen($sql_query_cpy) > $max_nofile_length)) || ($max_nofile_pieces != 0 && $pieces_count > $max_nofile_pieces)) { $sql_query_cpy = $sql_query = ''; $save_bandwidth = TRUE; $save_bandwidth_length = $max_nofile_length; $save_bandwidth_pieces = $max_nofile_pieces; } } // really run the query? if ($view_bookmark == 0) { // Only one query to run if ($pieces_count == 1 && !empty($pieces[0]['query'])) { $sql_query = $pieces[0]['query']; // .*? below is non greedy expansion, just in case somebody wants to understand it... if (preg_match('@^((-- |#)[^\n]*\n|/\*.*?\*/)*(DROP|CREATE)[[:space:]]+(IF EXISTS[[:space:]]+)?(TABLE|DATABASE)[[:space:]]+(.+)@im', $sql_query)) { $reload = 1; } require('./sql.php'); } // Runs multiple queries // (Possibly to create a db, so no db was selected in the // left frame and $db is empty) else if (empty($db) || PMA_DBI_select_db($db)) { $mult = TRUE; $info_msg = ''; $info_count = 0; // just skip last empty query (can contain just comments at the end) $count = $pieces_count; if ($pieces[$count - 1]['empty']) $count--; for ($i = 0; $i < $count; $i++) { $a_sql_query = $pieces[$i]['query']; // .*? below is non greedy expansion, just in case somebody wants to understand it... // looks ok here without using PCRE_MULTILINE if ($i == $count - 1 && preg_match('@^((-- |#)[^\n]*\n|[\s]*\n|/\*.*?\*/)*(SELECT|SHOW)@i', $a_sql_query)) { $complete_query = $sql_query; $display_query = $sql_query; $sql_query = $a_sql_query; require('./sql.php'); } $result = PMA_DBI_try_query($a_sql_query); if ($result == FALSE) { // readdump failed if (isset($my_die) && $cfg['IgnoreMultiSubmitErrors']) { $my_die[] = "\n\n" . $a_sql_query; } elseif ($cfg['IgnoreMultiSubmitErrors']) { $my_die = array(); $my_die[] = $a_sql_query; } else { $my_die = $a_sql_query; } if ($cfg['VerboseMultiSubmit']) { $info_msg .= $a_sql_query . '; # ' . $strError . "\n"; $info_count++; } if (!$cfg['IgnoreMultiSubmitErrors']) { break; } } else if ($cfg['VerboseMultiSubmit']) { $a_num_rows = (int)@PMA_DBI_num_rows($result); $a_aff_rows = (int)@PMA_DBI_affected_rows(); if ($a_num_rows > 0) { $a_rows = $a_num_rows; $a_switch = $strRows . ': '; } elseif ($a_aff_rows > 0) { $a_rows = $a_aff_rows; $a_switch = $strAffectedRows;; } else { $a_rows = ''; $a_switch = $strEmptyResultSet; } $info_msg .= $a_sql_query . "; # " . $a_switch . $a_rows . "\n"; $info_count++; } // If a 'USE <db>' SQL-clause was found and the query succeeded, set our current $db to the new one // .*? below is non greedy expansion, just in case somebody wants to understand it... if ($result != FALSE && preg_match('@^((-- |#)^[\n]*|/\*.*?\*/)*USE[[:space:]]*([\S]+)@i', $a_sql_query, $match)) { $db = trim($match[3]); $reload = 1; } // .*? below is non greedy expansion, just in case somebody wants to understand it... // must check $a_sql_query and use PCRE_MULTILINE if (!isset($reload) && preg_match('@^((-- |#)[^\n]*\n|/\*.*?\*/)*(DROP|CREATE)[\s]+(IF EXISTS[[:space:]]+)?(TABLE|DATABASE)[[:space:]]+(.+)@im', $a_sql_query)) { $reload = 1; } } // end for if ($cfg['VerboseMultiSubmit'] && strlen($info_msg) > 0 && ((!isset($save_bandwidth) || $save_bandwidth == FALSE) || ($save_bandwidth_pieces == 0 && strlen($info_msg) < $save_bandwidth_length) || ($save_bandwidth_length == 0 && $info_count < $save_bandwidth_pieces))) { $sql_query = $info_msg; } } // end else if } // end if (really run the query) unset($pieces);} // end if/** * MySQL error */if (isset($my_die)) { $js_to_run = 'functions.js'; require_once('./header.inc.php'); if (is_array($my_die)) { foreach ($my_die AS $key => $die_string) { PMA_mysqlDie('', $die_string, '', $err_url, FALSE); echo '<hr />'; } } else { PMA_mysqlDie('', $my_die, '', $err_url, TRUE); }}/** * Go back to the calling script */// Checks for a valid target scriptif (isset($table) && $table == '') { unset($table);}if (isset($db) && $db == '') { unset($db);}$is_db = $is_table = FALSE;if ($goto == 'tbl_properties.php') { if (!isset($table)) { $goto = 'db_details.php'; } else { PMA_DBI_select_db($db); $is_table = PMA_DBI_try_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'', NULL, PMA_DBI_QUERY_STORE); if (!($is_table && @PMA_DBI_num_rows($is_table))) { $goto = 'db_details.php'; unset($table); } } // end if... else...}if ($goto == 'db_details.php') { if (isset($table)) { unset($table); } if (!isset($db)) { $goto = 'main.php'; } else { $is_db = @PMA_DBI_select_db($db); if (!$is_db) { $goto = 'main.php'; unset($db); } } // end if... else...}// Defines the message to be displayedif (!empty($id_bookmark) && $action_bookmark == 2) { $message = $strBookmarkDeleted;} else if (!isset($sql_query_cpy)) { if (empty($message)) { $message = $strNoQuery; }} else if ($sql_query_cpy == '') { $message = "$strSuccess:[br]$strTheContent (" . (isset($sql_file_name) ? $sql_file_name . ': ' : '') . "$pieces_count $strInstructions) ";} else { $message = $strSuccess;}// Loads to target scriptif ($goto == 'db_details.php' || $goto == 'tbl_properties.php' || $goto == 'tbl_properties_structure.php') {// maybe we should do this instead://if (strpos(' ' . $goto, 'db_details') == 1 || strpos(' ' . $goto, 'tbl_properties') == 1) {// but I'm not sure $js_to_run = 'functions.js';}if ($goto != 'main.php') { require_once('./header.inc.php');}$active_page = $goto;require('./' . $goto);?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -