Merge branch 'master' into hideTables
This commit is contained in:
commit
0b702a9943
@ -39,6 +39,7 @@ phpMyAdmin - ChangeLog
|
||||
- bug Incorrect Drizzle 7 detection
|
||||
- bug #4019 Create database if not exists (export): add an option to the
|
||||
interface to enable generating CREATE DATABASE and USE (false by default)
|
||||
- bug #4012 Crash on CSV file import
|
||||
|
||||
4.0.4.1 (2013-06-30)
|
||||
- [security] Global variables scope injection vulnerability (see PMASA-2013-7)
|
||||
|
||||
@ -85,6 +85,6 @@ $multi_values .= "\n";
|
||||
$multi_values .= '</select></div>';
|
||||
|
||||
$export_type = 'database';
|
||||
require_once 'libraries/display_export.lib.php';
|
||||
require_once 'libraries/display_export.inc.php';
|
||||
|
||||
?>
|
||||
|
||||
13
js/sql.js
13
js/sql.js
@ -364,7 +364,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
$("#resultsForm.ajax .mult_submit[value=edit]").live('click', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
/*Check whether atleast one row is selected for change*/
|
||||
/*Check whether at least one row is selected*/
|
||||
if ($("#table_results tbody tr, #table_results tbody tr td").hasClass("marked")) {
|
||||
var $div = $('<div id="change_row_dialog"></div>');
|
||||
|
||||
@ -426,6 +426,17 @@ AJAX.registerOnload('sql.js', function () {
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Checks whether at least one row is selected for deletion or export
|
||||
*/
|
||||
$("#resultsForm.ajax .mult_submit[value=delete]," +
|
||||
"#resultsForm.ajax .mult_submit[value=export]").live('click', function (event) {
|
||||
/*Check whether at least one row is selected*/
|
||||
if (!$("#table_results tbody tr, #table_results tbody tr td").hasClass("marked")) {
|
||||
event.preventDefault();
|
||||
PMA_ajaxShowMessage(PMA_messages.strNoRowSelected);
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Click action for "Go" button in ajax dialog insertForm -> insertRowTable
|
||||
*/
|
||||
|
||||
@ -362,7 +362,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
// other
|
||||
} else {
|
||||
// type explicitly identified
|
||||
if (sqlTypes[key] !== null) {
|
||||
if (sqlTypes[key] != null) {
|
||||
if (sqlTypes[key] == 'bit') {
|
||||
sql_query += "b'" + value + "', ";
|
||||
}
|
||||
@ -376,6 +376,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
}
|
||||
}
|
||||
}
|
||||
// remove two extraneous characters ', '
|
||||
sql_query = sql_query.substring(0, sql_query.length - 2);
|
||||
sql_query += ' WHERE ' + PMA_urldecode(searchedData[searchedDataKey].where_clause);
|
||||
|
||||
|
||||
@ -5279,7 +5279,7 @@ class PMA_DisplayResults
|
||||
|
||||
// Export link
|
||||
// (the url_query has extra parameters that won't be used to export)
|
||||
// (the single_table parameter is used in display_export.lib.php
|
||||
// (the single_table parameter is used in display_export.inc.php
|
||||
// to hide the SQL and the structure export dialogs)
|
||||
// If the parser found a PROCEDURE clause
|
||||
// (most probably PROCEDURE ANALYSE()) it makes no sense to
|
||||
|
||||
72
libraries/display_export.inc.php
Normal file
72
libraries/display_export.inc.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Displays export tab.
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get relations & co. status
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
if (isset($_REQUEST['single_table'])) {
|
||||
$GLOBALS['single_table'] = $_REQUEST['single_table'];
|
||||
}
|
||||
|
||||
require_once './libraries/file_listing.lib.php';
|
||||
require_once './libraries/plugin_interface.lib.php';
|
||||
require_once './libraries/display_export.lib.php';
|
||||
|
||||
/* Scan for plugins */
|
||||
$export_list = PMA_getPlugins(
|
||||
"export",
|
||||
'libraries/plugins/export/',
|
||||
array(
|
||||
'export_type' => $export_type,
|
||||
'single_table' => isset($single_table)
|
||||
)
|
||||
);
|
||||
|
||||
/* Fail if we didn't find any plugin */
|
||||
if (empty($export_list)) {
|
||||
PMA_Message::error(
|
||||
__('Could not load export plugins, please check your installation!')
|
||||
)->display();
|
||||
exit;
|
||||
}
|
||||
|
||||
$html = '<form method="post" action="export.php" '
|
||||
. ' name="dump" class="disableAjax">';
|
||||
|
||||
//output Hidden Inputs
|
||||
$single_table_str = isset($single_table)? $single_table : '';
|
||||
$sql_query_str = isset($sql_query)? $sql_query : '';
|
||||
$html .= PMA_getHtmlForHiddenInput(
|
||||
$export_type,
|
||||
$db,
|
||||
$table,
|
||||
$single_table_str,
|
||||
$sql_query_str
|
||||
);
|
||||
|
||||
//output Export Options
|
||||
$num_tables_str = isset($num_tables)? $num_tables : '';
|
||||
$unlim_num_rows_str = isset($unlim_num_rows)? $unlim_num_rows : '';
|
||||
$multi_values_str = isset($multi_values)? $multi_values : '';
|
||||
$html .= PMA_getHtmlForExportOptions(
|
||||
$export_type,
|
||||
$db,
|
||||
$table,
|
||||
$multi_values_str,
|
||||
$num_tables_str,
|
||||
$export_list,
|
||||
$unlim_num_rows_str
|
||||
);
|
||||
|
||||
$html .= '</form>';
|
||||
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addHTML($html);
|
||||
@ -1,24 +1,17 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
|
||||
/**
|
||||
* Displays export tab.
|
||||
* functions for displaying server, database and table export
|
||||
*
|
||||
* @usedby server_export.php and display_export.inc.php
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get relations & co. status
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
if (isset($_REQUEST['single_table'])) {
|
||||
$GLOBALS['single_table'] = $_REQUEST['single_table'];
|
||||
}
|
||||
|
||||
require_once './libraries/file_listing.lib.php';
|
||||
require_once './libraries/plugin_interface.lib.php';
|
||||
|
||||
/**
|
||||
* Outputs appropriate checked statement for checkbox.
|
||||
*
|
||||
@ -33,134 +26,288 @@ function PMA_exportCheckboxCheck($str)
|
||||
}
|
||||
}
|
||||
|
||||
/* Scan for plugins */
|
||||
$export_list = PMA_getPlugins(
|
||||
"export",
|
||||
'libraries/plugins/export/',
|
||||
array(
|
||||
'export_type' => $export_type,
|
||||
'single_table' => isset($single_table)
|
||||
)
|
||||
);
|
||||
/**
|
||||
* Prints Html For Export Selection Options
|
||||
*
|
||||
* @param String $tmp_select Tmp selected method of export
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForExportSelectOptions($tmp_select = '')
|
||||
{
|
||||
$multi_values = '<div style="text-align: left">';
|
||||
$multi_values .= '<a href="#"';
|
||||
$multi_values .= ' onclick="setSelectOptions'
|
||||
. '(\'dump\', \'db_select[]\', true); return false;">';
|
||||
$multi_values .= __('Select All');
|
||||
$multi_values .= '</a>';
|
||||
$multi_values .= ' / ';
|
||||
$multi_values .= '<a href="#"';
|
||||
$multi_values .= ' onclick="setSelectOptions'
|
||||
. '(\'dump\', \'db_select[]\', false); return false;">';
|
||||
$multi_values .= __('Unselect All') . '</a><br />';
|
||||
|
||||
$multi_values .= '<select name="db_select[]" '
|
||||
. 'id="db_select" size="10" multiple="multiple">';
|
||||
$multi_values .= "\n";
|
||||
|
||||
// Check if the selected databases are defined in $_GET
|
||||
// (from clicking Back button on export.php)
|
||||
if (isset($_GET['db_select'])) {
|
||||
$_GET['db_select'] = urldecode($_GET['db_select']);
|
||||
$_GET['db_select'] = explode(",", $_GET['db_select']);
|
||||
}
|
||||
|
||||
foreach ($GLOBALS['pma']->databases as $current_db) {
|
||||
if ($current_db == 'information_schema'
|
||||
|| $current_db == 'performance_schema'
|
||||
|| $current_db == 'mysql'
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
if (isset($_GET['db_select'])) {
|
||||
if (in_array($current_db, $_GET['db_select'])) {
|
||||
$is_selected = ' selected="selected"';
|
||||
} else {
|
||||
$is_selected = '';
|
||||
}
|
||||
} elseif (!empty($tmp_select)) {
|
||||
if (strpos(' ' . $tmp_select, '|' . $current_db . '|')) {
|
||||
$is_selected = ' selected="selected"';
|
||||
} else {
|
||||
$is_selected = '';
|
||||
}
|
||||
} else {
|
||||
$is_selected = ' selected="selected"';
|
||||
}
|
||||
$current_db = htmlspecialchars($current_db);
|
||||
$multi_values .= ' <option value="' . $current_db . '"'
|
||||
. $is_selected . '>' . $current_db . '</option>' . "\n";
|
||||
} // end while
|
||||
$multi_values .= "\n";
|
||||
$multi_values .= '</select></div>';
|
||||
|
||||
/* Fail if we didn't find any plugin */
|
||||
if (empty($export_list)) {
|
||||
PMA_Message::error(
|
||||
__('Could not load export plugins, please check your installation!')
|
||||
)->display();
|
||||
exit;
|
||||
return $multi_values;
|
||||
}
|
||||
|
||||
$html = "";
|
||||
$html .= '<form method="post" action="export.php" '
|
||||
. ' name="dump" class="disableAjax">';
|
||||
|
||||
if ($export_type == 'server') {
|
||||
$html .= PMA_generate_common_hidden_inputs('', '', 1);
|
||||
} elseif ($export_type == 'database') {
|
||||
$html .= PMA_generate_common_hidden_inputs($db, '', 1);
|
||||
} else {
|
||||
$html .= PMA_generate_common_hidden_inputs($db, $table, 1);
|
||||
/**
|
||||
* Prints Html For Export Hidden Input
|
||||
*
|
||||
* @param String $export_type Selected Export Type
|
||||
* @param String $db Selected DB
|
||||
* @param String $table Selected Table
|
||||
* @param String $single_table Single Table
|
||||
* @param String $sql_query Sql Query
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForHiddenInput(
|
||||
$export_type, $db, $table, $single_table, $sql_query
|
||||
) {
|
||||
global $cfg;
|
||||
$html = "";
|
||||
if ($export_type == 'server') {
|
||||
$html .= PMA_generate_common_hidden_inputs('', '', 1);
|
||||
} elseif ($export_type == 'database') {
|
||||
$html .= PMA_generate_common_hidden_inputs($db, '', 1);
|
||||
} else {
|
||||
$html .= PMA_generate_common_hidden_inputs($db, $table, 1);
|
||||
}
|
||||
|
||||
// just to keep this value for possible next display of this form after saving
|
||||
// on server
|
||||
if (!empty($single_table)) {
|
||||
$html .= '<input type="hidden" name="single_table" value="TRUE" />'
|
||||
. "\n";
|
||||
}
|
||||
|
||||
$html .= '<input type="hidden" name="export_type" value="'
|
||||
. $export_type . '" />';
|
||||
$html .= "\n";
|
||||
|
||||
// If the export method was not set, the default is quick
|
||||
if (isset($_GET['export_method'])) {
|
||||
$cfg['Export']['method'] = $_GET['export_method'];
|
||||
} elseif (! isset($cfg['Export']['method'])) {
|
||||
$cfg['Export']['method'] = 'quick';
|
||||
}
|
||||
// The export method (quick, custom or custom-no-form)
|
||||
$html .= '<input type="hidden" name="export_method" value="'
|
||||
. htmlspecialchars($cfg['Export']['method']) . '" />';
|
||||
|
||||
|
||||
if (isset($_GET['sql_query'])) {
|
||||
$html .= '<input type="hidden" name="sql_query" value="'
|
||||
. htmlspecialchars($_GET['sql_query']) . '" />' . "\n";
|
||||
} elseif (! empty($sql_query)) {
|
||||
$html .= '<input type="hidden" name="sql_query" value="'
|
||||
. htmlspecialchars($sql_query) . '" />' . "\n";
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
// just to keep this value for possible next display of this form after saving
|
||||
// on server
|
||||
if (isset($single_table)) {
|
||||
$html .= '<input type="hidden" name="single_table" value="TRUE" />'
|
||||
. "\n";
|
||||
/**
|
||||
* Prints Html For Export Options Header
|
||||
*
|
||||
* @param String $export_type Selected Export Type
|
||||
* @param String $db Selected DB
|
||||
* @param String $table Selected Table
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForExportOptionHeader($export_type, $db, $table)
|
||||
{
|
||||
$html = '<div class="exportoptions" id="header">';
|
||||
$html .= '<h2>';
|
||||
$html .= PMA_Util::getImage('b_export.png', __('Export'));
|
||||
if ($export_type == 'server') {
|
||||
$html .= __('Exporting databases from the current server');
|
||||
} elseif ($export_type == 'database') {
|
||||
$html .= sprintf(
|
||||
__('Exporting tables from "%s" database'),
|
||||
htmlspecialchars($db)
|
||||
);
|
||||
} else {
|
||||
$html .= sprintf(
|
||||
__('Exporting rows from "%s" table'),
|
||||
htmlspecialchars($table)
|
||||
);
|
||||
}
|
||||
$html .= '</h2>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
$html .= '<input type="hidden" name="export_type" value="'
|
||||
. $export_type . '" />';
|
||||
$html .= "\n";
|
||||
|
||||
// If the export method was not set, the default is quick
|
||||
if (isset($_GET['export_method'])) {
|
||||
$cfg['Export']['method'] = $_GET['export_method'];
|
||||
} elseif (! isset($cfg['Export']['method'])) {
|
||||
$cfg['Export']['method'] = 'quick';
|
||||
}
|
||||
// The export method (quick, custom or custom-no-form)
|
||||
$html .= '<input type="hidden" name="export_method" value="'
|
||||
. htmlspecialchars($cfg['Export']['method']) . '" />';
|
||||
|
||||
|
||||
if (isset($_GET['sql_query'])) {
|
||||
$html .= '<input type="hidden" name="sql_query" value="'
|
||||
. htmlspecialchars($_GET['sql_query']) . '" />' . "\n";
|
||||
} elseif (! empty($sql_query)) {
|
||||
$html .= '<input type="hidden" name="sql_query" value="'
|
||||
. htmlspecialchars($sql_query) . '" />' . "\n";
|
||||
/**
|
||||
* Prints Html For Export Options Method
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForExportOptionsMethod()
|
||||
{
|
||||
global $cfg;
|
||||
if (isset($_GET['quick_or_custom'])) {
|
||||
$export_method = $_GET['quick_or_custom'];
|
||||
} else {
|
||||
$export_method = $cfg['Export']['method'];
|
||||
}
|
||||
|
||||
$html = '<div class="exportoptions" id="quick_or_custom">';
|
||||
$html .= '<h3>' . __('Export Method:') . '</h3>';
|
||||
$html .= '<ul>';
|
||||
$html .= '<li>';
|
||||
$html .= '<input type="radio" name="quick_or_custom" value="quick" '
|
||||
. ' id="radio_quick_export"';
|
||||
if ($export_method == 'quick' || $export_method == 'quick_no_form') {
|
||||
$html .= ' checked="checked"';
|
||||
}
|
||||
$html .= ' />';
|
||||
$html .= '<label for ="radio_quick_export">';
|
||||
$html .= __('Quick - display only the minimal options');
|
||||
$html .= '</label>';
|
||||
$html .= '</li>';
|
||||
|
||||
$html .= '<li>';
|
||||
$html .= '<input type="radio" name="quick_or_custom" value="custom" '
|
||||
. ' id="radio_custom_export"';
|
||||
if ($export_method == 'custom' || $export_method == 'custom_no_form') {
|
||||
$html .= ' checked="checked"';
|
||||
}
|
||||
$html .= ' />';
|
||||
$html .= '<label for="radio_custom_export">';
|
||||
$html .= __('Custom - display all possible options');
|
||||
$html .= '</label>';
|
||||
$html .= '</li>';
|
||||
|
||||
$html .= '</ul>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
$html .= '<div class="exportoptions" id="header">';
|
||||
$html .= '<h2>';
|
||||
$html .= PMA_Util::getImage('b_export.png', __('Export'));
|
||||
if ($export_type == 'server') {
|
||||
$html .= __('Exporting databases from the current server');
|
||||
} elseif ($export_type == 'database') {
|
||||
$html .= sprintf(
|
||||
__('Exporting tables from "%s" database'),
|
||||
htmlspecialchars($db)
|
||||
/**
|
||||
* Prints Html For Export Options Selection
|
||||
*
|
||||
* @param String $export_type Selected Export Type
|
||||
* @param String $multi_values Export Options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForExportOptionsSelection($export_type, $multi_values)
|
||||
{
|
||||
$html = '<div class="exportoptions" id="databases_and_tables">';
|
||||
if ($export_type == 'server') {
|
||||
$html .= '<h3>' . __('Database(s):') . '</h3>';
|
||||
} else if ($export_type == 'database') {
|
||||
$html .= '<h3>' . __('Table(s):') . '</h3>';
|
||||
}
|
||||
if (! empty($multi_values)) {
|
||||
$html .= $multi_values;
|
||||
}
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints Html For Export Options Format
|
||||
*
|
||||
* @param String $export_list Export List
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForExportOptionsFormat($export_list)
|
||||
{
|
||||
$html = '<div class="exportoptions" id="format">';
|
||||
$html .= '<h3>' . __('Format:') . '</h3>';
|
||||
$html .= PMA_pluginGetChoice('Export', 'what', $export_list, 'format');
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div class="exportoptions" id="format_specific_opts">';
|
||||
$html .= '<h3>' . __('Format-specific options:') . '</h3>';
|
||||
$html .= '<p class="no_js_msg" id="scroll_to_options_msg">';
|
||||
$html .= __(
|
||||
'Scroll down to fill in the options for the selected format '
|
||||
. 'and ignore the options for other formats.'
|
||||
);
|
||||
} else {
|
||||
$html .= sprintf(
|
||||
__('Exporting rows from "%s" table'),
|
||||
htmlspecialchars($table)
|
||||
$html .= '</p>';
|
||||
$html .= PMA_pluginGetOptions('Export', $export_list);
|
||||
$html .= '</div>';
|
||||
|
||||
if (function_exists('PMA_Kanji_encodingForm')) {
|
||||
// Encoding setting form appended by Y.Kawada
|
||||
// Japanese encoding setting
|
||||
$html .= '<div class="exportoptions" id="kanji_encoding">';
|
||||
$html .= '<h3>' . __('Encoding Conversion:') . '</h3>';
|
||||
$html .= PMA_Kanji_encodingForm();
|
||||
$html .= '</div>';
|
||||
}
|
||||
|
||||
$html .= '<div class="exportoptions" id="submit">';
|
||||
|
||||
$html .= PMA_Util::getExternalBug(
|
||||
__('SQL compatibility mode'), 'mysql', '50027', '14515'
|
||||
);
|
||||
|
||||
$html .= '<input type="submit" value="' . __('Go') . '" id="buttonGo" />';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
$html .= '</h2>';
|
||||
$html .= '</div>';
|
||||
|
||||
if (isset($_GET['quick_or_custom'])) {
|
||||
$export_method = $_GET['quick_or_custom'];
|
||||
} else {
|
||||
$export_method = $cfg['Export']['method'];
|
||||
}
|
||||
|
||||
$html .= '<div class="exportoptions" id="quick_or_custom">';
|
||||
$html .= '<h3>' . __('Export Method:') . '</h3>';
|
||||
$html .= '<ul>';
|
||||
$html .= '<li>';
|
||||
$html .= '<input type="radio" name="quick_or_custom" value="quick" '
|
||||
. ' id="radio_quick_export"';
|
||||
if ($export_method == 'quick' || $export_method == 'quick_no_form') {
|
||||
$html .= ' checked="checked"';
|
||||
}
|
||||
$html .= ' />';
|
||||
$html .= '<label for ="radio_quick_export">';
|
||||
$html .= __('Quick - display only the minimal options');
|
||||
$html .= '</label>';
|
||||
$html .= '</li>';
|
||||
|
||||
$html .= '<li>';
|
||||
$html .= '<input type="radio" name="quick_or_custom" value="custom" '
|
||||
. ' id="radio_custom_export"';
|
||||
if ($export_method == 'custom' || $export_method == 'custom_no_form') {
|
||||
$html .= ' checked="checked"';
|
||||
}
|
||||
$html .= ' />';
|
||||
$html .= '<label for="radio_custom_export">';
|
||||
$html .= __('Custom - display all possible options');
|
||||
$html .= '</label>';
|
||||
$html .= '</li>';
|
||||
|
||||
$html .= '</ul>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div class="exportoptions" id="databases_and_tables">';
|
||||
if ($export_type == 'server') {
|
||||
$html .= '<h3>' . __('Database(s):') . '</h3>';
|
||||
} else if ($export_type == 'database') {
|
||||
$html .= '<h3>' . __('Table(s):') . '</h3>';
|
||||
}
|
||||
if (! empty($multi_values)) {
|
||||
$html .= $multi_values;
|
||||
}
|
||||
$html .= '</div>';
|
||||
|
||||
if (strlen($table) && ! isset($num_tables) && ! PMA_Table::isMerge($db, $table)) {
|
||||
$html .= '<div class="exportoptions" id="rows">';
|
||||
/**
|
||||
* Prints Html For Export Options Rows
|
||||
*
|
||||
* @param String $db Selected DB
|
||||
* @param String $table Selected Table
|
||||
* @param String $unlim_num_rows Num of Rows
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForExportOptionsRows($db, $table, $unlim_num_rows)
|
||||
{
|
||||
$html = '<div class="exportoptions" id="rows">';
|
||||
$html .= '<h3>' . __('Rows:') . '</h3>';
|
||||
$html .= '<ul>';
|
||||
$html .= '<li>';
|
||||
@ -176,7 +323,7 @@ if (strlen($table) && ! isset($num_tables) && ! PMA_Table::isMerge($db, $table))
|
||||
$html .= '<input type="text" id="limit_to" name="limit_to" size="5" value="';
|
||||
if (isset($_GET['limit_to'])) {
|
||||
$html .= htmlspecialchars($_GET['limit_to']);
|
||||
} elseif (isset($unlim_num_rows)) {
|
||||
} elseif (!empty($unlim_num_rows)) {
|
||||
$html .= $unlim_num_rows;
|
||||
} else {
|
||||
$html .= PMA_Table::countRecords($db, $table);
|
||||
@ -205,10 +352,18 @@ if (strlen($table) && ! isset($num_tables) && ! PMA_Table::isMerge($db, $table))
|
||||
$html .= '</li>';
|
||||
$html .= '</ul>';
|
||||
$html .= '</div>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) {
|
||||
$html .= '<div class="exportoptions" id="output_quick_export">';
|
||||
/**
|
||||
* Prints Html For Export Options Quick Export
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForExportOptionsQuickExport()
|
||||
{
|
||||
global $cfg;
|
||||
$html = '<div class="exportoptions" id="output_quick_export">';
|
||||
$html .= '<h3>' . __('Output:') . '</h3>';
|
||||
$html .= '<ul>';
|
||||
$html .= '<li>';
|
||||
@ -234,23 +389,19 @@ if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) {
|
||||
$html .= '</li>';
|
||||
$html .= '</ul>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
$html .= '<div class="exportoptions" id="output">';
|
||||
$html .= '<h3>' . __('Output:') . '</h3>';
|
||||
$html .= '<ul id="ul_output">';
|
||||
$html .= '<li>';
|
||||
$html .= '<input type="radio" name="output_format" value="sendit" ';
|
||||
$html .= 'id="radio_dump_asfile" ';
|
||||
if (!isset($_GET['repopulate'])) {
|
||||
$html .= PMA_exportCheckboxCheck('asfile');
|
||||
}
|
||||
$html .= '/>';
|
||||
$html .= '<label for="radio_dump_asfile">'
|
||||
. __('Save output to a file') . '</label>';
|
||||
$html .= '<ul id="ul_save_asfile">';
|
||||
if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) {
|
||||
$html .= '<li>';
|
||||
/**
|
||||
* Prints Html For Export Options Save Dir
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForExportOptionsOutputSaveDir()
|
||||
{
|
||||
global $cfg;
|
||||
$html = '<li>';
|
||||
$html .= '<input type="checkbox" name="onserver" value="saveit" ';
|
||||
$html .= 'id="checkbox_dump_onserver" ';
|
||||
$html .= PMA_exportCheckboxCheck('onserver');
|
||||
@ -271,79 +422,106 @@ if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) {
|
||||
$html .= __('Overwrite existing file(s)');
|
||||
$html .= '</label>';
|
||||
$html .= '</li>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
$html .= '<li>';
|
||||
$html .= '<label for="filename_template" class="desc">';
|
||||
$html .= __('File name template:');
|
||||
$trans = new PMA_Message;
|
||||
$trans->addMessage(__('@SERVER@ will become the server name'));
|
||||
if ($export_type == 'database' || $export_type == 'table') {
|
||||
$trans->addMessage(__(', @DATABASE@ will become the database name'));
|
||||
if ($export_type == 'table') {
|
||||
$trans->addMessage(__(', @TABLE@ will become the table name'));
|
||||
|
||||
|
||||
/**
|
||||
* Prints Html For Export Options
|
||||
*
|
||||
* @param String $export_type Selected Export Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForExportOptionsOutputFormat($export_type)
|
||||
{
|
||||
$html = '<li>';
|
||||
$html .= '<label for="filename_template" class="desc">';
|
||||
$html .= __('File name template:');
|
||||
$trans = new PMA_Message;
|
||||
$trans->addMessage(__('@SERVER@ will become the server name'));
|
||||
if ($export_type == 'database' || $export_type == 'table') {
|
||||
$trans->addMessage(__(', @DATABASE@ will become the database name'));
|
||||
if ($export_type == 'table') {
|
||||
$trans->addMessage(__(', @TABLE@ will become the table name'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$msg = new PMA_Message(
|
||||
__('This value is interpreted using %1$sstrftime%2$s, so you can use time formatting strings. Additionally the following transformations will happen: %3$s. Other text will be kept as is. See the %4$sFAQ%5$s for details.')
|
||||
);
|
||||
$msg->addParam(
|
||||
'<a href="' . PMA_linkURL(PMA_getPHPDocLink('function.strftime.php'))
|
||||
. '" target="documentation" title="' . __('Documentation') . '">',
|
||||
false
|
||||
);
|
||||
$msg->addParam('</a>', false);
|
||||
$msg->addParam($trans);
|
||||
$doc_url = PMA_Util::getDocuLink('faq', 'faq6-27');
|
||||
$msg->addParam(
|
||||
'<a href="'. $doc_url . '" target="documentation">',
|
||||
false
|
||||
);
|
||||
$msg->addParam('</a>', false);
|
||||
|
||||
$html .= PMA_Util::showHint($msg);
|
||||
$html .= '</label>';
|
||||
$html .= '<input type="text" name="filename_template" id="filename_template" ';
|
||||
$html .= ' value="';
|
||||
if (isset($_GET['filename_template'])) {
|
||||
$html .= htmlspecialchars($_GET['filename_template']);
|
||||
} else {
|
||||
if ($export_type == 'database') {
|
||||
$html .= htmlspecialchars(
|
||||
$GLOBALS['PMA_Config']->getUserValue(
|
||||
'pma_db_filename_template',
|
||||
$GLOBALS['cfg']['Export']['file_template_database']
|
||||
)
|
||||
);
|
||||
} elseif ($export_type == 'table') {
|
||||
$html .= htmlspecialchars(
|
||||
$GLOBALS['PMA_Config']->getUserValue(
|
||||
'pma_table_filename_template',
|
||||
$GLOBALS['cfg']['Export']['file_template_table']
|
||||
)
|
||||
);
|
||||
|
||||
$msg = new PMA_Message(
|
||||
__(
|
||||
'This value is interpreted using %1$sstrftime%2$s, '
|
||||
. 'so you can use time formatting strings. '
|
||||
. 'Additionally the following transformations will happen: %3$s. '
|
||||
. 'Other text will be kept as is. See the %4$sFAQ%5$s for details.'
|
||||
)
|
||||
);
|
||||
$msg->addParam(
|
||||
'<a href="' . PMA_linkURL(PMA_getPHPDocLink('function.strftime.php'))
|
||||
. '" target="documentation" title="' . __('Documentation') . '">',
|
||||
false
|
||||
);
|
||||
$msg->addParam('</a>', false);
|
||||
$msg->addParam($trans);
|
||||
$doc_url = PMA_Util::getDocuLink('faq', 'faq6-27');
|
||||
$msg->addParam(
|
||||
'<a href="'. $doc_url . '" target="documentation">',
|
||||
false
|
||||
);
|
||||
$msg->addParam('</a>', false);
|
||||
|
||||
$html .= PMA_Util::showHint($msg);
|
||||
$html .= '</label>';
|
||||
$html .= '<input type="text" name="filename_template" id="filename_template" ';
|
||||
$html .= ' value="';
|
||||
if (isset($_GET['filename_template'])) {
|
||||
$html .= htmlspecialchars($_GET['filename_template']);
|
||||
} else {
|
||||
$html .= htmlspecialchars(
|
||||
$GLOBALS['PMA_Config']->getUserValue(
|
||||
'pma_server_filename_template',
|
||||
$GLOBALS['cfg']['Export']['file_template_server']
|
||||
)
|
||||
);
|
||||
if ($export_type == 'database') {
|
||||
$html .= htmlspecialchars(
|
||||
$GLOBALS['PMA_Config']->getUserValue(
|
||||
'pma_db_filename_template',
|
||||
$GLOBALS['cfg']['Export']['file_template_database']
|
||||
)
|
||||
);
|
||||
} elseif ($export_type == 'table') {
|
||||
$html .= htmlspecialchars(
|
||||
$GLOBALS['PMA_Config']->getUserValue(
|
||||
'pma_table_filename_template',
|
||||
$GLOBALS['cfg']['Export']['file_template_table']
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$html .= htmlspecialchars(
|
||||
$GLOBALS['PMA_Config']->getUserValue(
|
||||
'pma_server_filename_template',
|
||||
$GLOBALS['cfg']['Export']['file_template_server']
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
$html .= '"';
|
||||
$html .= '/>';
|
||||
$html .= '<input type="checkbox" name="remember_template" ';
|
||||
$html .= 'id="checkbox_remember_template" ';
|
||||
$html .= PMA_exportCheckboxCheck('remember_file_template');
|
||||
$html .= '/>';
|
||||
$html .= '<label for="checkbox_remember_template">';
|
||||
$html .= __('use this for future exports');
|
||||
$html .= '</label>';
|
||||
$html .= '</li>';
|
||||
return $html;
|
||||
}
|
||||
$html .= '"';
|
||||
$html .= '/>';
|
||||
$html .= '<input type="checkbox" name="remember_template" ';
|
||||
$html .= 'id="checkbox_remember_template" ';
|
||||
$html .= PMA_exportCheckboxCheck('remember_file_template');
|
||||
$html .= '/>';
|
||||
$html .= '<label for="checkbox_remember_template">';
|
||||
$html .= __('use this for future exports');
|
||||
$html .= '</label>';
|
||||
$html .= '</li>';
|
||||
// charset of file
|
||||
if ($GLOBALS['PMA_recoding_engine'] != PMA_CHARSET_NONE) {
|
||||
$html .= ' <li><label for="select_charset_of_file" class="desc">'
|
||||
|
||||
/**
|
||||
* Prints Html For Export Options Charset
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForExportOptionsOutputCharset()
|
||||
{
|
||||
global $cfg;
|
||||
$html = ' <li><label for="select_charset_of_file" class="desc">'
|
||||
. __('Character set of the file:') . '</label>' . "\n";
|
||||
reset($cfg['AvailableCharsets']);
|
||||
$html .= '<select id="select_charset_of_file" name="charset_of_file" size="1">';
|
||||
@ -360,99 +538,168 @@ if ($GLOBALS['PMA_recoding_engine'] != PMA_CHARSET_NONE) {
|
||||
}
|
||||
$html .= '>' . $temp_charset . '</option>';
|
||||
} // end foreach
|
||||
$html .= '</select></li>';
|
||||
} // end if
|
||||
$html .= '</select></li>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
if (isset($_GET['compression'])) {
|
||||
$selected_compression = $_GET['compression'];
|
||||
} elseif (isset($cfg['Export']['compression'])) {
|
||||
$selected_compression = $cfg['Export']['compression'];
|
||||
} else {
|
||||
$selected_compression = "none";
|
||||
/**
|
||||
* Prints Html For Export Options Compression
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForExportOptionsOutputCompression()
|
||||
{
|
||||
global $cfg;
|
||||
if (isset($_GET['compression'])) {
|
||||
$selected_compression = $_GET['compression'];
|
||||
} elseif (isset($cfg['Export']['compression'])) {
|
||||
$selected_compression = $cfg['Export']['compression'];
|
||||
} else {
|
||||
$selected_compression = "none";
|
||||
}
|
||||
|
||||
$html = "";
|
||||
// zip, gzip and bzip2 encode features
|
||||
$is_zip = ($cfg['ZipDump'] && @function_exists('gzcompress'));
|
||||
$is_gzip = ($cfg['GZipDump'] && @function_exists('gzencode'));
|
||||
$is_bzip2 = ($cfg['BZipDump'] && @function_exists('bzcompress'));
|
||||
if ($is_zip || $is_gzip || $is_bzip2) {
|
||||
$html .= '<li>';
|
||||
$html .= '<label for="compression" class="desc">'
|
||||
. __('Compression:') . '</label>';
|
||||
$html .= '<select id="compression" name="compression">';
|
||||
$html .= '<option value="none">' . __('None') . '</option>';
|
||||
if ($is_zip) {
|
||||
$html .= '<option value="zip" ';
|
||||
if ($selected_compression == "zip") {
|
||||
$html .= 'selected="selected"';
|
||||
}
|
||||
$html .= '>' . __('zipped') . '</option>';
|
||||
}
|
||||
if ($is_gzip) {
|
||||
$html .= '<option value="gzip" ';
|
||||
if ($selected_compression == "gzip") {
|
||||
$html .= 'selected="selected"';
|
||||
}
|
||||
$html .= '>' . __('gzipped') . '</option>';
|
||||
}
|
||||
if ($is_bzip2) {
|
||||
$html .= '<option value="bzip2" ';
|
||||
if ($selected_compression == "bzip2") {
|
||||
$html .= 'selected="selected"';
|
||||
}
|
||||
$html .= '>' . __('bzipped') . '</option>';
|
||||
}
|
||||
$html .= '</select>';
|
||||
$html .= '</li>';
|
||||
} else {
|
||||
$html .= '<input type="hidden" name="compression" value="'
|
||||
. htmlspecialchars($selected_compression) . '" />';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
// zip, gzip and bzip2 encode features
|
||||
$is_zip = ($cfg['ZipDump'] && @function_exists('gzcompress'));
|
||||
$is_gzip = ($cfg['GZipDump'] && @function_exists('gzencode'));
|
||||
$is_bzip2 = ($cfg['BZipDump'] && @function_exists('bzcompress'));
|
||||
if ($is_zip || $is_gzip || $is_bzip2) {
|
||||
/**
|
||||
* Prints Html For Export Options Radio
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForExportOptionsOutputRadio()
|
||||
{
|
||||
$html = '<li>';
|
||||
$html .= '<input type="radio" id="radio_view_as_text" '
|
||||
. ' name="output_format" value="astext" ';
|
||||
if (isset($_GET['repopulate']) || $GLOBALS['cfg']['Export']['asfile'] == false) {
|
||||
$html .= 'checked="checked"';
|
||||
}
|
||||
$html .= '/>';
|
||||
$html .= '<label for="radio_view_as_text">'
|
||||
. __('View output as text') . '</label></li>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints Html For Export Options
|
||||
*
|
||||
* @param String $export_type Selected Export Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForExportOptionsOutput($export_type)
|
||||
{
|
||||
global $cfg;
|
||||
$html = '<div class="exportoptions" id="output">';
|
||||
$html .= '<h3>' . __('Output:') . '</h3>';
|
||||
$html .= '<ul id="ul_output">';
|
||||
$html .= '<li>';
|
||||
$html .= '<label for="compression" class="desc">'
|
||||
. __('Compression:') . '</label>';
|
||||
$html .= '<select id="compression" name="compression">';
|
||||
$html .= '<option value="none">' . __('None') . '</option>';
|
||||
if ($is_zip) {
|
||||
$html .= '<option value="zip" ';
|
||||
if ($selected_compression == "zip") {
|
||||
$html .= 'selected="selected"';
|
||||
}
|
||||
$html .= '>' . __('zipped') . '</option>';
|
||||
$html .= '<input type="radio" name="output_format" value="sendit" ';
|
||||
$html .= 'id="radio_dump_asfile" ';
|
||||
if (!isset($_GET['repopulate'])) {
|
||||
$html .= PMA_exportCheckboxCheck('asfile');
|
||||
}
|
||||
if ($is_gzip) {
|
||||
$html .= '<option value="gzip" ';
|
||||
if ($selected_compression == "gzip") {
|
||||
$html .= 'selected="selected"';
|
||||
}
|
||||
$html .= '>' . __('gzipped') . '</option>';
|
||||
$html .= '/>';
|
||||
$html .= '<label for="radio_dump_asfile">'
|
||||
. __('Save output to a file') . '</label>';
|
||||
$html .= '<ul id="ul_save_asfile">';
|
||||
if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) {
|
||||
$html .= PMA_getHtmlForExportOptionsOutputSaveDir();
|
||||
}
|
||||
if ($is_bzip2) {
|
||||
$html .= '<option value="bzip2" ';
|
||||
if ($selected_compression == "bzip2") {
|
||||
$html .= 'selected="selected"';
|
||||
}
|
||||
$html .= '>' . __('bzipped') . '</option>';
|
||||
}
|
||||
$html .= '</select>';
|
||||
|
||||
$html .= PMA_getHtmlForExportOptionsOutputFormat($export_type);
|
||||
|
||||
// charset of file
|
||||
if ($GLOBALS['PMA_recoding_engine'] != PMA_CHARSET_NONE) {
|
||||
$html .= PMA_getHtmlForExportOptionsOutputCharset();
|
||||
} // end if
|
||||
|
||||
$html .= PMA_getHtmlForExportOptionsOutputCompression();
|
||||
|
||||
$html .= '</ul>';
|
||||
$html .= '</li>';
|
||||
} else {
|
||||
$html .= '<input type="hidden" name="compression" value="'
|
||||
. htmlspecialchars($selected_compression) . '" />';
|
||||
}
|
||||
$html .= '</ul>';
|
||||
$html .= '</li>';
|
||||
$html .= '<li>';
|
||||
$html .= '<input type="radio" id="radio_view_as_text" '
|
||||
. ' name="output_format" value="astext" ';
|
||||
if (isset($_GET['repopulate']) || $GLOBALS['cfg']['Export']['asfile'] == false) {
|
||||
$html .= 'checked="checked"';
|
||||
}
|
||||
$html .= '/>';
|
||||
$html .= '<label for="radio_view_as_text">'
|
||||
. __('View output as text') . '</label></li>';
|
||||
$html .= '</ul>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= PMA_getHtmlForExportOptionsOutputRadio();
|
||||
|
||||
$html .= '<div class="exportoptions" id="format">';
|
||||
$html .= '<h3>' . __('Format:') . '</h3>';
|
||||
$html .= PMA_pluginGetChoice('Export', 'what', $export_list, 'format');
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div class="exportoptions" id="format_specific_opts">';
|
||||
$html .= '<h3>' . __('Format-specific options:') . '</h3>';
|
||||
$html .= '<p class="no_js_msg" id="scroll_to_options_msg">';
|
||||
$html .= __('Scroll down to fill in the options for the selected format and ignore the options for other formats.');
|
||||
$html .= '</p>';
|
||||
$html .= PMA_pluginGetOptions('Export', $export_list);
|
||||
$html .= '</div>';
|
||||
|
||||
if (function_exists('PMA_Kanji_encodingForm')) {
|
||||
// Encoding setting form appended by Y.Kawada
|
||||
// Japanese encoding setting
|
||||
$html .= '<div class="exportoptions" id="kanji_encoding">';
|
||||
$html .= '<h3>' . __('Encoding Conversion:') . '</h3>';
|
||||
$html .= PMA_Kanji_encodingForm();
|
||||
$html .= '</ul>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
$html .= '<div class="exportoptions" id="submit">';
|
||||
/**
|
||||
* Prints Html For Export Options
|
||||
*
|
||||
* @param String $export_type Selected Export Type
|
||||
* @param String $db Selected DB
|
||||
* @param String $table Selected Table
|
||||
* @param String $multi_values Export selection
|
||||
* @param String $num_tables number of tables
|
||||
* @param String $export_list Export List
|
||||
* @param String $unlim_num_rows Number of Rows
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForExportOptions(
|
||||
$export_type, $db, $table, $multi_values,
|
||||
$num_tables, $export_list, $unlim_num_rows
|
||||
) {
|
||||
global $cfg;
|
||||
$html = PMA_getHtmlForExportOptionHeader($export_type, $db, $table);
|
||||
$html .= PMA_getHtmlForExportOptionsMethod();
|
||||
$html .= PMA_getHtmlForExportOptionsSelection($export_type, $multi_values);
|
||||
|
||||
if (strlen($table) && empty($num_tables) && ! PMA_Table::isMerge($db, $table)) {
|
||||
$html .= PMA_getHtmlForExportOptionsRows($db, $table, $unlim_num_rows);
|
||||
}
|
||||
|
||||
if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) {
|
||||
$html .= PMA_getHtmlForExportOptionsQuickExport();
|
||||
}
|
||||
|
||||
$html .= PMA_Util::getExternalBug(
|
||||
__('SQL compatibility mode'), 'mysql', '50027', '14515'
|
||||
);
|
||||
|
||||
$html .= '<input type="submit" value="' . __('Go') . '" id="buttonGo" />';
|
||||
$html .= '</div>';
|
||||
$html .= '</form>';
|
||||
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addHTML($html);
|
||||
$html .= PMA_getHtmlForExportOptionsOutput($export_type);
|
||||
|
||||
$html .= PMA_getHtmlForExportOptionsFormat($export_list);
|
||||
return $html;
|
||||
}
|
||||
?>
|
||||
|
||||
@ -531,13 +531,13 @@ function PMA_getD($last_cumulative_size)
|
||||
/**
|
||||
* Obtains the decimal size of a given cell
|
||||
*
|
||||
* @param string &$cell cell content
|
||||
* @param string $cell cell content
|
||||
*
|
||||
* @return array Contains the precision, scale, and full size
|
||||
* representation of the given decimal cell
|
||||
* @access public
|
||||
*/
|
||||
function PMA_getDecimalSize(&$cell)
|
||||
function PMA_getDecimalSize($cell)
|
||||
{
|
||||
$curr_size = strlen((string)$cell);
|
||||
$decPos = strpos($cell, ".");
|
||||
@ -557,7 +557,7 @@ function PMA_getDecimalSize(&$cell)
|
||||
* (NONE or VARCHAR or DECIMAL or INT or BIGINT)
|
||||
* @param int $curr_type Type of the current cell
|
||||
* (NONE or VARCHAR or DECIMAL or INT or BIGINT)
|
||||
* @param string &$cell The current cell
|
||||
* @param string $cell The current cell
|
||||
*
|
||||
* @return string Size of the given cell in the type-appropriate format
|
||||
* @access public
|
||||
@ -565,7 +565,7 @@ function PMA_getDecimalSize(&$cell)
|
||||
* @todo Handle the error cases more elegantly
|
||||
*/
|
||||
function PMA_detectSize($last_cumulative_size, $last_cumulative_type,
|
||||
$curr_type, &$cell
|
||||
$curr_type, $cell
|
||||
) {
|
||||
$curr_size = strlen((string)$cell);
|
||||
|
||||
@ -756,14 +756,14 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type,
|
||||
*
|
||||
* @param int $last_cumulative_type Last cumulative column type
|
||||
* (VARCHAR or INT or BIGINT or DECIMAL or NONE)
|
||||
* @param string &$cell String representation of the cell for which
|
||||
* @param string $cell String representation of the cell for which
|
||||
* a best-fit type is to be determined
|
||||
*
|
||||
* @return int The MySQL type representation
|
||||
* (VARCHAR or INT or BIGINT or DECIMAL or NONE)
|
||||
* @access public
|
||||
*/
|
||||
function PMA_detectType($last_cumulative_type, &$cell)
|
||||
function PMA_detectType($last_cumulative_type, $cell)
|
||||
{
|
||||
/**
|
||||
* If numeric, determine if decimal, int or bigint
|
||||
|
||||
@ -590,11 +590,9 @@ if (!empty($submit_mult) && !empty($what)) {
|
||||
*/
|
||||
require_once 'libraries/parse_analyze.inc.php';
|
||||
|
||||
$reload = PMA_hasCurrentDbChanged($db);
|
||||
|
||||
PMA_executeQueryAndSendQueryResponse(
|
||||
$analyzed_sql_results, $sql_query, false, $db, $table, null, null, null,
|
||||
false, null, null, null, null, $goto, $pmaThemeImage, '', null, null,
|
||||
$analyzed_sql_results, false, $db, $table, null, null, null,
|
||||
false, null, null, null, null, $goto, $pmaThemeImage, null, null,
|
||||
$query_type, $sql_query, $selected, null
|
||||
);
|
||||
} elseif (!$run_parts) {
|
||||
|
||||
@ -340,6 +340,8 @@ function PMA_langDetails($lang)
|
||||
return array('uz[-_]lat|uzbek-latin', 'uz-lat', 'O‘zbekcha');
|
||||
case 'uz':
|
||||
return array('uz[-_]cyr|uzbek-cyrillic', 'uz-cyr', 'Ўзбекча');
|
||||
case 'vls':
|
||||
return array('vls|flemish', 'vls', 'West-Vlams');
|
||||
case 'zh_TW':
|
||||
return array('zh[-_](tw|hk)|chinese traditional', 'zh-TW', '中文');
|
||||
case 'zh_CN':
|
||||
|
||||
@ -1028,6 +1028,9 @@ function PMA_addBookmark($pmaAbsoluteUri, $goto)
|
||||
exit;
|
||||
} else {
|
||||
// go back to sql.php to redisplay query; do not use & in this case:
|
||||
/**
|
||||
* @todo In which scenario does this happen?
|
||||
*/
|
||||
PMA_sendHeaderLocation(
|
||||
$pmaAbsoluteUri . $goto
|
||||
. '&label=' . $_POST['bkm_fields']['bkm_label']
|
||||
@ -2013,6 +2016,7 @@ function PMA_sendQueryResponseForResultsReturned($result, $justBrowsing,
|
||||
// value of a transformed field, show it here
|
||||
if (isset($_REQUEST['grid_edit']) && $_REQUEST['grid_edit'] == true) {
|
||||
PMA_sendResponseForGridEdit($result);
|
||||
// script has exited at this point
|
||||
}
|
||||
|
||||
// Gets the list of fields properties
|
||||
@ -2217,7 +2221,6 @@ function PMA_sendQueryResponse($num_rows, $unlim_num_rows, $is_affected,
|
||||
* Function to execute the query and send the response
|
||||
*
|
||||
* @param array $analyzed_sql_results analysed sql results
|
||||
* @param string $full_sql_query full sql query
|
||||
* @param bool $is_gotofile whether goto file or not
|
||||
* @param string $db current database
|
||||
* @param string $table current table
|
||||
@ -2231,7 +2234,6 @@ function PMA_sendQueryResponse($num_rows, $unlim_num_rows, $is_affected,
|
||||
* @param array $sql_data sql data
|
||||
* @param string $goto goto page url
|
||||
* @param string $pmaThemeImage uri of the PMA theme image
|
||||
* @param string $sql_limit_to_append sql limit to append
|
||||
* @param string $disp_query display query
|
||||
* @param string $disp_message display message
|
||||
* @param string $query_type query type
|
||||
@ -2244,10 +2246,10 @@ function PMA_sendQueryResponse($num_rows, $unlim_num_rows, $is_affected,
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_executeQueryAndSendQueryResponse($analyzed_sql_results, $full_sql_query,
|
||||
function PMA_executeQueryAndSendQueryResponse($analyzed_sql_results,
|
||||
$is_gotofile, $db, $table, $find_real_end, $import_text, $extra_data,
|
||||
$is_affected, $message_to_show, $disp_mode, $message, $sql_data, $goto,
|
||||
$pmaThemeImage, $sql_limit_to_append, $disp_query, $disp_message,
|
||||
$pmaThemeImage, $disp_query, $disp_message,
|
||||
$query_type, $sql_query, $selected, $complete_query
|
||||
) {
|
||||
// Include PMA_Index class for use in PMA_DisplayResults class
|
||||
@ -2261,6 +2263,27 @@ function PMA_executeQueryAndSendQueryResponse($analyzed_sql_results, $full_sql_q
|
||||
|
||||
$displayResultsObject->setConfigParamsForDisplayTable();
|
||||
|
||||
// assign default full_sql_query
|
||||
$full_sql_query = $sql_query;
|
||||
|
||||
// Handle remembered sorting order, only for single table query
|
||||
if (PMA_isRememberSortingOrder($analyzed_sql_results)) {
|
||||
PMA_handleSortOrder($db, $table, $analyzed_sql_results, $full_sql_query);
|
||||
}
|
||||
|
||||
// Do append a "LIMIT" clause?
|
||||
if (PMA_isAppendLimitClause($analyzed_sql_results)) {
|
||||
list($sql_limit_to_append,
|
||||
$full_sql_query, $analyzed_display_query, $display_query
|
||||
) = PMA_appendLimitClause(
|
||||
$full_sql_query, $analyzed_sql_results['analyzed_sql'],
|
||||
isset($display_query)
|
||||
);
|
||||
} else {
|
||||
$sql_limit_to_append = '';
|
||||
}
|
||||
|
||||
$reload = PMA_hasCurrentDbChanged($db);
|
||||
|
||||
// Execute the query
|
||||
list($result, $num_rows, $unlim_num_rows, $profiling_results,
|
||||
|
||||
12
po/pt.po
12
po/pt.po
@ -4,8 +4,8 @@ msgstr ""
|
||||
"Project-Id-Version: phpMyAdmin 4.1-dev\n"
|
||||
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
|
||||
"POT-Creation-Date: 2013-07-12 16:06+0200\n"
|
||||
"PO-Revision-Date: 2013-07-15 11:13+0200\n"
|
||||
"Last-Translator: Michal Čihař <michal@cihar.com>\n"
|
||||
"PO-Revision-Date: 2013-07-20 08:18+0200\n"
|
||||
"Last-Translator: Telma Gonzaga <novawebproject@gmail.com>\n"
|
||||
"Language-Team: Portuguese "
|
||||
"<http://l10n.cihar.com/projects/phpmyadmin/master/pt/>\n"
|
||||
"Language: pt\n"
|
||||
@ -865,6 +865,8 @@ msgid ""
|
||||
"Login cookie store is lower than cookie validity configured in phpMyAdmin, "
|
||||
"because of this, your login will expire sooner than configured in phpMyAdmin."
|
||||
msgstr ""
|
||||
"Os parâmetros de validade do cookie de início de sessão armazenado não "
|
||||
"correspondem aos do cookie de validade configurado no phpMyAdmin."
|
||||
|
||||
#: index.php:468
|
||||
msgid "The configuration file now needs a secret passphrase (blowfish_secret)."
|
||||
@ -3076,14 +3078,12 @@ msgid "SQL query"
|
||||
msgstr "Comando SQL"
|
||||
|
||||
#: libraries/ServerStatusData.class.php:186
|
||||
#, fuzzy
|
||||
msgid "Handler"
|
||||
msgstr "Handler"
|
||||
msgstr "Manipulador (handler)"
|
||||
|
||||
#: libraries/ServerStatusData.class.php:187
|
||||
#, fuzzy
|
||||
msgid "Query cache"
|
||||
msgstr "Query cache"
|
||||
msgstr "Cache de queries"
|
||||
|
||||
#: libraries/ServerStatusData.class.php:188
|
||||
msgid "Threads"
|
||||
|
||||
10
po/sv.po
10
po/sv.po
@ -4,8 +4,8 @@ msgstr ""
|
||||
"Project-Id-Version: phpMyAdmin 4.1-dev\n"
|
||||
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
|
||||
"POT-Creation-Date: 2013-07-12 16:06+0200\n"
|
||||
"PO-Revision-Date: 2013-07-19 18:26+0200\n"
|
||||
"Last-Translator: ProUser <stefan@inkopsforum.se>\n"
|
||||
"PO-Revision-Date: 2013-07-19 20:33+0200\n"
|
||||
"Last-Translator: Anders Jonsson <anders.jonsson@norsjovallen.se>\n"
|
||||
"Language-Team: Swedish "
|
||||
"<http://l10n.cihar.com/projects/phpmyadmin/master/sv/>\n"
|
||||
"Language: sv\n"
|
||||
@ -6368,7 +6368,7 @@ msgstr "ZIP"
|
||||
|
||||
#: libraries/config/messages.inc.php:533
|
||||
msgid "Enter your public key for your domain reCaptcha service"
|
||||
msgstr "Ange din publika nyckel till reCaptcha tjänsten för din domän "
|
||||
msgstr "Ange din publika nyckel till reCaptcha-tjänsten för din domän"
|
||||
|
||||
#: libraries/config/messages.inc.php:534
|
||||
msgid "Public key for reCaptcha"
|
||||
@ -6376,7 +6376,7 @@ msgstr "Publik nyckel för reCaptcha"
|
||||
|
||||
#: libraries/config/messages.inc.php:535
|
||||
msgid "Enter your private key for your domain reCaptcha service"
|
||||
msgstr "Ange din privata nyckel för din domäns reCaptcha tjänst"
|
||||
msgstr "Ange din privata nyckel för din domäns reCaptcha-tjänst"
|
||||
|
||||
#: libraries/config/messages.inc.php:536
|
||||
msgid "Private key for reCaptcha"
|
||||
@ -11111,7 +11111,7 @@ msgid ""
|
||||
"There seems to be an error in your SQL query. The MySQL server error output "
|
||||
"below, if there is any, may also help you in diagnosing the problem."
|
||||
msgstr ""
|
||||
"Det verkar vara ett fel i din SQL fråga. Om det finns något felmeddelande "
|
||||
"Det verkar vara ett fel i din SQL-fråga. Om det finns något felmeddelande "
|
||||
"från MySQL-servern nedan, kan detta hjälpa dig analysera problemet."
|
||||
|
||||
#: libraries/sqlparser.lib.php:178
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* object the server export page
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
@ -9,65 +10,20 @@
|
||||
* Does the common work
|
||||
*/
|
||||
require_once 'libraries/common.inc.php';
|
||||
require_once 'libraries/server_common.inc.php';
|
||||
require_once 'libraries/display_export.lib.php';
|
||||
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('export.js');
|
||||
|
||||
require 'libraries/server_common.inc.php';
|
||||
|
||||
$export_page_title = __('View dump (schema) of databases') . "\n";
|
||||
|
||||
$multi_values = '<div style="text-align: left">';
|
||||
$multi_values .= '<a href="#"';
|
||||
$multi_values .= ' onclick="setSelectOptions(\'dump\', \'db_select[]\', true); return false;">';
|
||||
$multi_values .= __('Select All');
|
||||
$multi_values .= '</a>';
|
||||
$multi_values .= ' / ';
|
||||
$multi_values .= '<a href="#"';
|
||||
$multi_values .= ' onclick="setSelectOptions(\'dump\', \'db_select[]\', false); return false;">';
|
||||
$multi_values .= __('Unselect All') . '</a><br />';
|
||||
|
||||
$multi_values .= '<select name="db_select[]" id="db_select" size="10" multiple="multiple">';
|
||||
$multi_values .= "\n";
|
||||
|
||||
// Check if the selected databases are defined in $_GET (from clicking Back button on export.php)
|
||||
if (isset($_GET['db_select'])) {
|
||||
$_GET['db_select'] = urldecode($_GET['db_select']);
|
||||
$_GET['db_select'] = explode(",", $_GET['db_select']);
|
||||
}
|
||||
|
||||
foreach ($GLOBALS['pma']->databases as $current_db) {
|
||||
if ($current_db == 'information_schema'
|
||||
|| $current_db == 'performance_schema'
|
||||
|| $current_db == 'mysql'
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
if (isset($_GET['db_select'])) {
|
||||
if (in_array($current_db, $_GET['db_select'])) {
|
||||
$is_selected = ' selected="selected"';
|
||||
} else {
|
||||
$is_selected = '';
|
||||
}
|
||||
} elseif (isset($tmp_select)) {
|
||||
if (strpos(' ' . $tmp_select, '|' . $current_db . '|')) {
|
||||
$is_selected = ' selected="selected"';
|
||||
} else {
|
||||
$is_selected = '';
|
||||
}
|
||||
} else {
|
||||
$is_selected = ' selected="selected"';
|
||||
}
|
||||
$current_db = htmlspecialchars($current_db);
|
||||
$multi_values .= ' <option value="' . $current_db . '"'
|
||||
. $is_selected . '>' . $current_db . '</option>' . "\n";
|
||||
} // end while
|
||||
$multi_values .= "\n";
|
||||
$multi_values .= '</select></div>';
|
||||
$select_item = isset($tmp_select)? $tmp_select : '';
|
||||
$multi_values = PMA_getHtmlForExportSelectOptions($select_item);
|
||||
|
||||
$export_type = 'server';
|
||||
require_once 'libraries/display_export.lib.php';
|
||||
require_once 'libraries/display_export.inc.php';
|
||||
|
||||
?>
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* object the server plugin page
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
|
||||
33
sql.php
33
sql.php
@ -24,8 +24,6 @@ $header = $response->getHeader();
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('jquery/jquery-ui-timepicker-addon.js');
|
||||
$scripts->addFile('tbl_change.js');
|
||||
// the next one needed because sql.php may do a "goto" to tbl_structure.php
|
||||
$scripts->addFile('tbl_structure.js');
|
||||
$scripts->addFile('indexes.js');
|
||||
$scripts->addFile('gis_data_editor.js');
|
||||
|
||||
@ -84,17 +82,20 @@ if (isset($_REQUEST['get_relational_values'])
|
||||
&& $_REQUEST['get_relational_values'] == true
|
||||
) {
|
||||
PMA_getRelationalValues($db, $table, $display_field);
|
||||
// script has exited at this point
|
||||
}
|
||||
|
||||
// Just like above, find possible values for enum fields during grid edit.
|
||||
if (isset($_REQUEST['get_enum_values']) && $_REQUEST['get_enum_values'] == true) {
|
||||
PMA_getEnumOrSetValues($db, $table, "enum");
|
||||
// script has exited at this point
|
||||
}
|
||||
|
||||
|
||||
// Find possible values for set fields during grid edit.
|
||||
if (isset($_REQUEST['get_set_values']) && $_REQUEST['get_set_values'] == true) {
|
||||
PMA_getEnumOrSetValues($db, $table, "set");
|
||||
// script has exited at this point
|
||||
}
|
||||
|
||||
/**
|
||||
@ -102,6 +103,7 @@ if (isset($_REQUEST['get_set_values']) && $_REQUEST['get_set_values'] == true) {
|
||||
*/
|
||||
if (isset($_REQUEST['set_col_prefs']) && $_REQUEST['set_col_prefs'] == true) {
|
||||
PMA_setColumnOrderOrVisibility($table, $db);
|
||||
// script has exited at this point
|
||||
}
|
||||
|
||||
// Default to browse if no query set and we have table
|
||||
@ -153,6 +155,7 @@ if (isset($find_real_end) && $find_real_end) {
|
||||
*/
|
||||
if (isset($_POST['store_bkm'])) {
|
||||
PMA_addBookmark($cfg['PmaAbsoluteUri'], $goto);
|
||||
// script has exited at this point
|
||||
} // end if
|
||||
|
||||
|
||||
@ -167,37 +170,15 @@ if ($goto == 'sql.php') {
|
||||
} // end if
|
||||
|
||||
|
||||
// assign default full_sql_query
|
||||
$full_sql_query = $sql_query;
|
||||
|
||||
// Handle remembered sorting order, only for single table query
|
||||
if (PMA_isRememberSortingOrder($analyzed_sql_results)) {
|
||||
PMA_handleSortOrder($db, $table, $analyzed_sql_results, $full_sql_query);
|
||||
}
|
||||
|
||||
// Do append a "LIMIT" clause?
|
||||
if (PMA_isAppendLimitClause($analyzed_sql_results)) {
|
||||
list($sql_limit_to_append,
|
||||
$full_sql_query, $analyzed_display_query, $display_query
|
||||
) = PMA_appendLimitClause(
|
||||
$full_sql_query, $analyzed_sql_results['analyzed_sql'],
|
||||
isset($display_query)
|
||||
);
|
||||
} else {
|
||||
$sql_limit_to_append = '';
|
||||
}
|
||||
|
||||
$reload = PMA_hasCurrentDbChanged($db);
|
||||
|
||||
PMA_executeQueryAndSendQueryResponse(
|
||||
$analyzed_sql_results, $full_sql_query, $is_gotofile, $db, $table,
|
||||
$analyzed_sql_results, $is_gotofile, $db, $table,
|
||||
isset($find_real_end) ? $find_real_end : null,
|
||||
isset($import_text) ? $import_text : null,
|
||||
isset($extra_data) ? $extra_data : null, $is_affected,
|
||||
isset($message_to_show) ? $message_to_show : null,
|
||||
isset($disp_mode) ? $disp_mode : null, isset($message) ? $message : null,
|
||||
isset($sql_data) ? $sql_data : null, $goto, $pmaThemeImage,
|
||||
$sql_limit_to_append, isset($disp_query) ? $display_query : null,
|
||||
isset($disp_query) ? $display_query : null,
|
||||
isset($disp_message) ? $disp_message : null,
|
||||
isset($query_type) ? $query_type : null,
|
||||
$sql_query, isset($selected) ? $selected : null,
|
||||
|
||||
@ -82,5 +82,5 @@ if (! empty($sql_query)) {
|
||||
}
|
||||
|
||||
$export_type = 'table';
|
||||
require_once 'libraries/display_export.lib.php';
|
||||
require_once 'libraries/display_export.inc.php';
|
||||
?>
|
||||
|
||||
@ -11,18 +11,7 @@
|
||||
*/
|
||||
require_once 'libraries/common.inc.php';
|
||||
require_once 'libraries/mysql_charsets.inc.php';
|
||||
|
||||
/**
|
||||
* No rows were selected => show again the query and tell that user.
|
||||
*/
|
||||
if (! PMA_isValid($_REQUEST['rows_to_delete'], 'array')
|
||||
&& ! isset($_REQUEST['mult_btn'])
|
||||
) {
|
||||
$disp_message = __('No rows selected');
|
||||
$disp_query = '';
|
||||
include 'sql.php';
|
||||
exit;
|
||||
}
|
||||
require_once 'libraries/sql.lib.php';
|
||||
|
||||
if (isset($_REQUEST['submit_mult'])) {
|
||||
$submit_mult = $_REQUEST['submit_mult'];
|
||||
@ -131,13 +120,17 @@ if (!empty($submit_mult)) {
|
||||
$url_query = $original_url_query;
|
||||
}
|
||||
|
||||
// this is because sql.php could call tbl_structure
|
||||
// which would think it needs to call mult_submits.inc.php:
|
||||
unset($submit_mult, $_REQUEST['mult_btn']);
|
||||
|
||||
$active_page = 'sql.php';
|
||||
include 'sql.php';
|
||||
break;
|
||||
/**
|
||||
* Parse and analyze the query
|
||||
*/
|
||||
require_once 'libraries/parse_analyze.inc.php';
|
||||
|
||||
PMA_executeQueryAndSendQueryResponse(
|
||||
$analyzed_sql_results, false, $db, $table, null, null, null, false, null,
|
||||
null, null, null, $goto, $pmaThemeImage, null, null, null, $sql_query,
|
||||
null, null
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Handles table search tab
|
||||
*
|
||||
* display table search form, create SQL query from form data
|
||||
* and include sql.php to execute it
|
||||
* and call PMA_executeQueryAndSendQueryResponse() to execute it
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
@ -15,6 +15,7 @@
|
||||
require_once 'libraries/common.inc.php';
|
||||
require_once 'libraries/mysql_charsets.inc.php';
|
||||
require_once 'libraries/TableSearch.class.php';
|
||||
require_once 'libraries/sql.lib.php';
|
||||
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
@ -65,6 +66,16 @@ if (! isset($_POST['columnsToDisplay']) && ! isset($_POST['displayAllColumns']))
|
||||
* Selection criteria have been submitted -> do the work
|
||||
*/
|
||||
$sql_query = $table_search->buildSqlQuery();
|
||||
include 'sql.php';
|
||||
|
||||
/**
|
||||
* Parse and analyze the query
|
||||
*/
|
||||
require_once 'libraries/parse_analyze.inc.php';
|
||||
|
||||
PMA_executeQueryAndSendQueryResponse(
|
||||
$analyzed_sql_results, false, $db, $table, null, null, null, false, null,
|
||||
null, null, null, $goto, $pmaThemeImage, null, null, null, $sql_query,
|
||||
null, null
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
@ -136,7 +136,7 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetSelectionForm()
|
||||
{
|
||||
//$this->_searchType == 'zoom'
|
||||
//$this->_searchType == 'zoom'
|
||||
$tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
|
||||
$url_goto = "http://phpmyadmin.net";
|
||||
$form = $tableSearch->getSelectionForm($url_goto);
|
||||
@ -149,7 +149,7 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
$form
|
||||
);
|
||||
|
||||
//$this->_searchType == 'normal'
|
||||
//$this->_searchType == 'normal'
|
||||
$tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "normal");
|
||||
$url_goto = "http://phpmyadmin.net";
|
||||
$form = $tableSearch->getSelectionForm($url_goto);
|
||||
@ -162,7 +162,7 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
$form
|
||||
);
|
||||
|
||||
//$this->_searchType == 'replace'
|
||||
//$this->_searchType == 'replace'
|
||||
$tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "replace");
|
||||
$url_goto = "http://phpmyadmin.net";
|
||||
$form = $tableSearch->getSelectionForm($url_goto);
|
||||
@ -197,7 +197,7 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
$this->assertContains(
|
||||
__('Zoom Search'),
|
||||
$html
|
||||
);
|
||||
);
|
||||
$this->assertContains(
|
||||
__('Find and Replace'),
|
||||
$html
|
||||
@ -223,7 +223,31 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
json_encode($data),
|
||||
$html
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for replace
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testReplace()
|
||||
{
|
||||
$tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
|
||||
$columnIndex = 0;
|
||||
$find = "Field";
|
||||
$replaceWith = "Column";
|
||||
$charSet = "UTF-8";
|
||||
$tableSearch->replace($columnIndex, $find, $replaceWith, $charSet);
|
||||
|
||||
$sql_query = $GLOBALS['sql_query'];
|
||||
$result = "UPDATE `PMA`.`PMA_BookMark` SET `Field1` = "
|
||||
. "REPLACE(`Field1`, 'Field', 'Column') "
|
||||
. "WHERE `Field1` LIKE '%Field%' COLLATE UTF-8_bin";
|
||||
$this->assertEquals(
|
||||
$result,
|
||||
$sql_query
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -243,7 +267,79 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
|
||||
__('Replace with:'),
|
||||
$html
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for getReplacePreview
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetReplacePreview()
|
||||
{
|
||||
|
||||
$value = array(
|
||||
'value',
|
||||
'replace_value',
|
||||
'count'
|
||||
);
|
||||
|
||||
$dbi = $GLOBALS['dbi'];
|
||||
|
||||
$dbi->expects($this->at(3))->method('fetchRow')
|
||||
->will($this->returnValue($value));
|
||||
|
||||
$dbi->expects($this->at(4))->method('fetchRow')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
$tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
|
||||
$columnIndex = 0;
|
||||
$find = "Field";
|
||||
$replaceWith = "Column";
|
||||
$charSet = "UTF-8";
|
||||
|
||||
$html = $tableSearch->getReplacePreview(
|
||||
$columnIndex,
|
||||
$find,
|
||||
$replaceWith,
|
||||
$charSet
|
||||
);
|
||||
|
||||
$this->assertContains(
|
||||
'<form method="post" action="tbl_find_replace.php"',
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
'<input type="hidden" name="replace" value="true" />',
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
__('Find and replace - preview'),
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
__('Original string'),
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
__('Replaced string'),
|
||||
$html
|
||||
);
|
||||
|
||||
$this->assertContains(
|
||||
'<td>value</td>',
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
'<td>replace_value</td>',
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
'<td class="right">count</td>',
|
||||
$html
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -46,6 +46,12 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['pmaThemeImage'] = 'themes/dot.gif';
|
||||
$GLOBALS['is_ajax_request'] = false;
|
||||
$GLOBALS['cfgRelation'] = PMA_getRelationsParam();
|
||||
PMA_Table::$cache["PMA"]["PMA_BookMark"] = array(
|
||||
'ENGINE' => true,
|
||||
'Create_time' => true,
|
||||
'TABLE_TYPE' => true,
|
||||
'Comment' => true,
|
||||
);
|
||||
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
@ -202,11 +208,14 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
->will($this->returnValue($getUniqueColumns_sql));
|
||||
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
//RunKit, we test:
|
||||
//1. without Runkit, PMA_DRIZZLE = true;
|
||||
//2. with Runkit, PMA_DRIZZLE = false;
|
||||
|
||||
if (!defined("PMA_DRIZZLE")) {
|
||||
define("PMA_DRIZZLE", true);
|
||||
}
|
||||
|
||||
//RunKit
|
||||
if (PMA_HAS_RUNKIT) {
|
||||
runkit_constant_redefine("PMA_DRIZZLE", false);
|
||||
}
|
||||
@ -689,6 +698,37 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Tests behaviour of PMA_Table class with Runkit and PMA_Drizzle = false
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
class PMA_Table_Runkit_Test extends PMA_Table_Test
|
||||
{
|
||||
/**
|
||||
* Configures environment
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
//we test:
|
||||
//1. without Runkit, PMA_DRIZZLE = false;
|
||||
//2. with Runkit, PMA_DRIZZLE = true;
|
||||
if (!defined("PMA_DRIZZLE")) {
|
||||
define("PMA_DRIZZLE", false);
|
||||
}
|
||||
|
||||
parent::setUp();
|
||||
|
||||
//RunKit
|
||||
if (PMA_HAS_RUNKIT) {
|
||||
runkit_constant_redefine("PMA_DRIZZLE", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//mock PMA
|
||||
Class DataBasePMAMock
|
||||
{
|
||||
|
||||
@ -11,7 +11,9 @@
|
||||
require_once 'libraries/Util.class.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'libraries/url_generating.lib.php';
|
||||
require_once 'libraries/sqlparser.lib.php';
|
||||
require_once 'libraries/php-gettext/gettext.inc';
|
||||
require_once 'libraries/Index.class.php';
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/Response.class.php';
|
||||
require_once 'libraries/schema/Dia_Relation_Schema.class.php';
|
||||
@ -46,11 +48,13 @@ class PMA_Dia_Relation_Schema_Test extends PHPUnit_Framework_TestCase
|
||||
$_POST['export_type'] = 'PMA_ExportType';
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['cfg']['ServerDefault'] = 1;
|
||||
$GLOBALS['cfg']['Server']['table_coords'] = "table_name";
|
||||
$GLOBALS['cfgRelation']['db'] = "PMA";
|
||||
$GLOBALS['cfgRelation']['table_coords'] = "table_name";
|
||||
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
$dbi->expects($this->any())
|
||||
->method('numRows')
|
||||
@ -65,12 +69,43 @@ class PMA_Dia_Relation_Schema_Test extends PHPUnit_Framework_TestCase
|
||||
->will($this->returnValue("executed_1"));
|
||||
|
||||
$fetchArrayReturn = array(
|
||||
'table_name' => 'table_name'
|
||||
'table_name' => 'pma_table_name'
|
||||
);
|
||||
$dbi->expects($this->at(1))
|
||||
|
||||
$dbi->expects($this->at(2))
|
||||
->method('fetchAssoc')
|
||||
->will($this->returnValue($fetchArrayReturn));
|
||||
$dbi->expects($this->at(3))
|
||||
->method('fetchAssoc')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$getIndexesResult = array(
|
||||
array(
|
||||
'Table' => 'pma_tbl',
|
||||
'Field' => 'field1',
|
||||
'Key' => 'PRIMARY',
|
||||
'Key_name' => "Key_name",
|
||||
'Column_name' => "Column_name"
|
||||
)
|
||||
);
|
||||
$dbi->expects($this->any())->method('getTableIndexes')
|
||||
->will($this->returnValue($getIndexesResult));
|
||||
|
||||
$fetchValue = "CREATE TABLE `pma_bookmark` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`dbase` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`user` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
`query` text COLLATE utf8_bin NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Bookmarks'";
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('fetchValue')
|
||||
->will($this->returnValue($fetchValue));
|
||||
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
$this->object = new PMA_Dia_Relation_Schema();
|
||||
}
|
||||
|
||||
@ -94,7 +129,7 @@ class PMA_Dia_Relation_Schema_Test extends PHPUnit_Framework_TestCase
|
||||
* @group medium
|
||||
*/
|
||||
public function testSetProperty()
|
||||
{
|
||||
{
|
||||
$this->assertEquals(
|
||||
33,
|
||||
$this->object->pageNumber
|
||||
|
||||
@ -11,7 +11,9 @@
|
||||
require_once 'libraries/Util.class.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'libraries/url_generating.lib.php';
|
||||
require_once 'libraries/sqlparser.lib.php';
|
||||
require_once 'libraries/php-gettext/gettext.inc';
|
||||
require_once 'libraries/Index.class.php';
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/schema/Eps_Relation_Schema.class.php';
|
||||
|
||||
@ -47,11 +49,13 @@ class PMA_Eps_Relation_Schema_Test extends PHPUnit_Framework_TestCase
|
||||
$_POST['export_type'] = 'PMA_ExportType';
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['cfg']['ServerDefault'] = 1;
|
||||
$GLOBALS['cfg']['Server']['table_coords'] = "table_name";
|
||||
$GLOBALS['cfgRelation']['db'] = "PMA";
|
||||
$GLOBALS['cfgRelation']['table_coords'] = "table_name";
|
||||
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
$dbi->expects($this->any())
|
||||
->method('numRows')
|
||||
@ -66,11 +70,42 @@ class PMA_Eps_Relation_Schema_Test extends PHPUnit_Framework_TestCase
|
||||
->will($this->returnValue("executed_1"));
|
||||
|
||||
$fetchArrayReturn = array(
|
||||
'table_name' => 'table_name'
|
||||
'table_name' => 'pma_table_name'
|
||||
);
|
||||
$dbi->expects($this->at(1))
|
||||
|
||||
$dbi->expects($this->at(2))
|
||||
->method('fetchAssoc')
|
||||
->will($this->returnValue($fetchArrayReturn));
|
||||
$dbi->expects($this->at(3))
|
||||
->method('fetchAssoc')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$getIndexesResult = array(
|
||||
array(
|
||||
'Table' => 'pma_tbl',
|
||||
'Field' => 'field1',
|
||||
'Key' => 'PRIMARY',
|
||||
'Key_name' => "Key_name",
|
||||
'Column_name' => "Column_name"
|
||||
)
|
||||
);
|
||||
$dbi->expects($this->any())->method('getTableIndexes')
|
||||
->will($this->returnValue($getIndexesResult));
|
||||
|
||||
$fetchValue = "CREATE TABLE `pma_bookmark` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`dbase` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`user` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
`query` text COLLATE utf8_bin NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Bookmarks'";
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('fetchValue')
|
||||
->will($this->returnValue($fetchValue));
|
||||
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
$this->object = new PMA_Eps_Relation_Schema();
|
||||
}
|
||||
|
||||
@ -11,7 +11,10 @@
|
||||
require_once 'libraries/Util.class.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'libraries/url_generating.lib.php';
|
||||
require_once 'libraries/sqlparser.lib.php';
|
||||
require_once 'libraries/php-gettext/gettext.inc';
|
||||
require_once 'libraries/Index.class.php';
|
||||
require_once 'libraries/Table.class.php';
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/schema/Pdf_Relation_Schema.class.php';
|
||||
|
||||
@ -46,13 +49,24 @@ class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
|
||||
$_POST['paper'] = 'paper';
|
||||
$_POST['export_type'] = 'PMA_ExportType';
|
||||
$_POST['with_doc'] = 'on';
|
||||
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['cfg']['Server']['pmadb'] = "pmadb";
|
||||
$GLOBALS['cfg']['LimitChars'] = 100;
|
||||
$GLOBALS['cfg']['ServerDefault'] = 1;
|
||||
$GLOBALS['cfg']['Server']['user'] = "user";
|
||||
$GLOBALS['cfg']['Server']['table_coords'] = "table_name";
|
||||
$GLOBALS['cfg']['Server']['bookmarktable'] = "bookmarktable";
|
||||
$GLOBALS['cfg']['Server']['relation'] = "relation";
|
||||
$GLOBALS['cfg']['Server']['relation'] = "relation";
|
||||
$GLOBALS['cfg']['Server']['table_info'] = "table_info";
|
||||
|
||||
$GLOBALS['cfgRelation']['db'] = "PMA";
|
||||
$GLOBALS['cfgRelation']['table_coords'] = "table_name";
|
||||
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
$dbi->expects($this->any())
|
||||
->method('numRows')
|
||||
@ -67,11 +81,71 @@ class PMA_Pdf_Relation_Schema_Test extends PHPUnit_Framework_TestCase
|
||||
->will($this->returnValue("executed_1"));
|
||||
|
||||
$fetchArrayReturn = array(
|
||||
'table_name' => 'table_name'
|
||||
'table_name' => 'pma_table_name'
|
||||
);
|
||||
$dbi->expects($this->at(1))
|
||||
|
||||
$dbi->expects($this->at(2))
|
||||
->method('fetchAssoc')
|
||||
->will($this->returnValue($fetchArrayReturn));
|
||||
$dbi->expects($this->at(3))
|
||||
->method('fetchAssoc')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$fetchRowReturn = array(
|
||||
'table_name'
|
||||
);
|
||||
|
||||
//let fetchRow have more results
|
||||
for ($index=0; $index<10; ++$index) {
|
||||
$dbi->expects($this->at($index))
|
||||
->method('fetchRow')
|
||||
->will($this->returnValue($fetchRowReturn));
|
||||
}
|
||||
|
||||
$dbi->expects($this->at(10))
|
||||
->method('fetchRow')
|
||||
->will($this->returnValue($fetchRowReturn));
|
||||
|
||||
$fields_info = array(
|
||||
"Host" => array(
|
||||
"Field" => "host",
|
||||
"Type" => "char(60)",
|
||||
"Null" => "NO",
|
||||
'Extra' => "Extra",
|
||||
)
|
||||
);
|
||||
$dbi->expects($this->any())->method('getColumns')
|
||||
->will($this->returnValue($fields_info));
|
||||
|
||||
$dbi->expects($this->any())->method('selectDb')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$getIndexesResult = array(
|
||||
array(
|
||||
'Table' => 'pma_tbl',
|
||||
'Field' => 'field1',
|
||||
'Key' => 'PRIMARY',
|
||||
'Key_name' => "Key_name",
|
||||
'Column_name' => "Column_name"
|
||||
)
|
||||
);
|
||||
$dbi->expects($this->any())->method('getTableIndexes')
|
||||
->will($this->returnValue($getIndexesResult));
|
||||
|
||||
$fetchValue = "CREATE TABLE `pma_bookmark` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`dbase` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`user` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
`query` text COLLATE utf8_bin NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Bookmarks'";
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('fetchValue')
|
||||
->will($this->returnValue($fetchValue));
|
||||
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
$this->object = new PMA_Pdf_Relation_Schema();
|
||||
}
|
||||
|
||||
@ -11,7 +11,9 @@
|
||||
require_once 'libraries/Util.class.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'libraries/url_generating.lib.php';
|
||||
require_once 'libraries/sqlparser.lib.php';
|
||||
require_once 'libraries/php-gettext/gettext.inc';
|
||||
require_once 'libraries/Index.class.php';
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/schema/Svg_Relation_Schema.class.php';
|
||||
|
||||
@ -48,11 +50,13 @@ class PMA_Svg_Relation_Schema_Test extends PHPUnit_Framework_TestCase
|
||||
$_POST['with_doc'] = 'on';
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['cfg']['ServerDefault'] = 1;
|
||||
$GLOBALS['cfg']['Server']['table_coords'] = "table_name";
|
||||
$GLOBALS['cfgRelation']['db'] = "PMA";
|
||||
$GLOBALS['cfgRelation']['table_coords'] = "table_name";
|
||||
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
$dbi->expects($this->any())
|
||||
->method('numRows')
|
||||
@ -67,11 +71,42 @@ class PMA_Svg_Relation_Schema_Test extends PHPUnit_Framework_TestCase
|
||||
->will($this->returnValue("executed_1"));
|
||||
|
||||
$fetchArrayReturn = array(
|
||||
'table_name' => 'table_name'
|
||||
'table_name' => 'pma_table_name'
|
||||
);
|
||||
$dbi->expects($this->at(1))
|
||||
|
||||
$dbi->expects($this->at(2))
|
||||
->method('fetchAssoc')
|
||||
->will($this->returnValue($fetchArrayReturn));
|
||||
$dbi->expects($this->at(3))
|
||||
->method('fetchAssoc')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$getIndexesResult = array(
|
||||
array(
|
||||
'Table' => 'pma_tbl',
|
||||
'Field' => 'field1',
|
||||
'Key' => 'PRIMARY',
|
||||
'Key_name' => "Key_name",
|
||||
'Column_name' => "Column_name"
|
||||
)
|
||||
);
|
||||
$dbi->expects($this->any())->method('getTableIndexes')
|
||||
->will($this->returnValue($getIndexesResult));
|
||||
|
||||
$fetchValue = "CREATE TABLE `pma_bookmark` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`dbase` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`user` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
`query` text COLLATE utf8_bin NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Bookmarks'";
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('fetchValue')
|
||||
->will($this->returnValue($fetchValue));
|
||||
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
$this->object = new PMA_Svg_Relation_Schema();
|
||||
}
|
||||
|
||||
@ -25,9 +25,11 @@ class PMA_Relation_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['cfg']['Server']['pmadb'] = 'phpmyadmin';
|
||||
$_SESSION['relation'][$GLOBALS['server']] = "PMA_relation";
|
||||
$_SESSION['PMA_Theme'] = new PMA_Theme();
|
||||
$_SESSION['relation'] = array();
|
||||
|
||||
$GLOBALS['pmaThemePath'] = $_SESSION['PMA_Theme']->getPath();
|
||||
$GLOBALS['pmaThemeImage'] = 'theme/';
|
||||
$GLOBALS['cfg']['ServerDefault'] = 0;
|
||||
|
||||
include_once 'libraries/relation.lib.php';
|
||||
}
|
||||
@ -71,9 +73,6 @@ class PMA_Relation_Test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testPMA_getRelationsParam()
|
||||
{
|
||||
$GLOBALS['cfg']['ServerDefault'] = 0;
|
||||
$_SESSION['relation'] = array();
|
||||
|
||||
$relationsPara = PMA_getRelationsParam();
|
||||
$this->assertEquals(
|
||||
false,
|
||||
@ -137,5 +136,84 @@ class PMA_Relation_Test extends PHPUnit_Framework_TestCase
|
||||
$retval
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_getDisplayField
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPMA_getDisplayField()
|
||||
{
|
||||
|
||||
$db = 'information_schema';
|
||||
$table = 'CHARACTER_SETS';
|
||||
$this->assertEquals(
|
||||
'DESCRIPTION',
|
||||
PMA_getDisplayField($db, $table)
|
||||
);
|
||||
|
||||
$db = 'information_schema';
|
||||
$table = 'TABLES';
|
||||
$this->assertEquals(
|
||||
'TABLE_COMMENT',
|
||||
PMA_getDisplayField($db, $table)
|
||||
);
|
||||
|
||||
$db = 'information_schema';
|
||||
$table = 'PMA';
|
||||
$this->assertEquals(
|
||||
false,
|
||||
PMA_getDisplayField($db, $table)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_getComments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPMA_getComments()
|
||||
{
|
||||
$GLOBALS['cfg']['ServerDefault'] = 0;
|
||||
$_SESSION['relation'] = array();
|
||||
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$getColumnsResult = array(
|
||||
array(
|
||||
'Field' => 'field1',
|
||||
'Type' => 'int(11)',
|
||||
'Comment' => 'Comment1'
|
||||
),
|
||||
array(
|
||||
'Field' => 'field2',
|
||||
'Type' => 'text',
|
||||
'Comment' => 'Comment1'
|
||||
)
|
||||
);
|
||||
$dbi->expects($this->any())->method('getColumns')
|
||||
->will($this->returnValue($getColumnsResult));
|
||||
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
$db = 'information_schema';
|
||||
$this->assertEquals(
|
||||
array(''),
|
||||
PMA_getComments($db)
|
||||
);
|
||||
|
||||
$db = 'information_schema';
|
||||
$table = 'TABLES';
|
||||
$this->assertEquals(
|
||||
array(
|
||||
'field1' => 'Comment1',
|
||||
'field2' => 'Comment1'
|
||||
),
|
||||
PMA_getComments($db, $table)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user