Merge branch 'master' of https://github.com/phpmyadmin/phpmyadmin into UT_plu_table
This commit is contained in:
commit
331aa58ec2
@ -25,7 +25,7 @@ phpMyAdmin - ChangeLog
|
||||
- [core] Dropped support for PHP 5.2.
|
||||
+ rfe #487 and rfe #1405 Find and Replacing column wise
|
||||
+ rfe #1373 Use same create view dialog for editing a view
|
||||
+ rfe #316 Configurable menus; allow user groups with customized menus per group
|
||||
+ rfe #316 Configurable menus; allow user groups with customized menus per group- bug #4024 Editing field a record is selected by makes pma load forever
|
||||
|
||||
4.0.5.0 (not yet released)
|
||||
- bug #3977 Not detected configuration storage
|
||||
|
||||
14
db_qbe.php
14
db_qbe.php
@ -11,6 +11,9 @@
|
||||
*/
|
||||
require_once 'libraries/common.inc.php';
|
||||
require_once 'libraries/DBQbe.class.php';
|
||||
require_once 'libraries/bookmark.lib.php';
|
||||
require_once 'libraries/sql.lib.php';
|
||||
|
||||
$response = PMA_Response::getInstance();
|
||||
|
||||
// Gets the relation settings
|
||||
@ -25,8 +28,15 @@ if (isset($_REQUEST['submit_sql']) && ! empty($sql_query)) {
|
||||
$message_to_display = true;
|
||||
} else {
|
||||
$goto = 'db_sql.php';
|
||||
include 'sql.php';
|
||||
exit;
|
||||
|
||||
// Parse and analyze the query
|
||||
require_once 'libraries/parse_analyze.inc.php';
|
||||
|
||||
PMA_executeQueryAndSendQueryResponse(
|
||||
$analyzed_sql_results, false, $_REQUEST['db'], null, null, null, null,
|
||||
false, null, null, null, null, $goto, $pmaThemeImage, null, null, null,
|
||||
$sql_query, null, null
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -63,24 +63,11 @@ if (defined('SESSIONUPLOAD')) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets globals from $_GET
|
||||
*/
|
||||
$get_params = array(
|
||||
'message',
|
||||
'id'
|
||||
);
|
||||
foreach ($get_params as $one_get_param) {
|
||||
if (isset($_GET[$one_get_param])) {
|
||||
$GLOBALS[$one_get_param] = $_GET[$one_get_param];
|
||||
}
|
||||
}
|
||||
|
||||
// AJAX requests can't be cached!
|
||||
PMA_noCacheHeader();
|
||||
|
||||
// $GLOBALS["message"] is used for asking for an import message
|
||||
if (isset($GLOBALS["message"]) && $GLOBALS["message"]) {
|
||||
// $_GET["message"] is used for asking for an import message
|
||||
if (isset($_GET["message"]) && $_GET["message"]) {
|
||||
|
||||
header('Content-type: text/html');
|
||||
|
||||
@ -100,6 +87,6 @@ if (isset($GLOBALS["message"]) && $GLOBALS["message"]) {
|
||||
echo '</fieldset>'."\n";
|
||||
|
||||
} else {
|
||||
PMA_importAjaxStatus($GLOBALS["id"]);
|
||||
PMA_importAjaxStatus($_GET["id"]);
|
||||
}
|
||||
?>
|
||||
|
||||
@ -170,7 +170,7 @@ var ColumnType = {
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
* JQPlot specifc code
|
||||
* JQPlot specific code
|
||||
******************************************************************************/
|
||||
|
||||
/**
|
||||
|
||||
@ -1201,6 +1201,19 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
settings.axes.yaxis.tickOptions = {
|
||||
formatter: $.jqplot.byteFormatter(1) // KiB
|
||||
};
|
||||
} else if (settings.title === PMA_messages.strQuestions
|
||||
|| settings.title === PMA_messages.strConnections
|
||||
) {
|
||||
settings.axes.yaxis.tickOptions = {
|
||||
formatter: function(format, val) {
|
||||
if (Math.abs(val) >= 1000000)
|
||||
return $.jqplot.sprintf("%.3g M", val/1000000);
|
||||
else if (Math.abs(val) >= 1000)
|
||||
return $.jqplot.sprintf("%.3g k", val/1000);
|
||||
else
|
||||
return $.jqplot.sprintf("%d", val);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
settings.series = chartObj.series;
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@ -304,11 +304,14 @@ class Advisor
|
||||
*/
|
||||
private function _ruleExprEvaluateVariable($matches)
|
||||
{
|
||||
return isset($this->variables[$matches[1]])
|
||||
? (is_numeric($this->variables[$matches[1]])
|
||||
? $this->variables[$matches[1]]
|
||||
: '"'.$this->variables[$matches[1]].'"')
|
||||
: $matches[1];
|
||||
if (! isset($this->variables[$matches[1]])) {
|
||||
return $matches[1];
|
||||
}
|
||||
if (is_numeric($this->variables[$matches[1]])) {
|
||||
return $this->variables[$matches[1]];
|
||||
} else {
|
||||
return '\'' . addslashes($this->variables[$matches[1]]) . '\'';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -200,8 +200,8 @@ rule 'Query cache max size' [!fired('Query cache disabled')]
|
||||
Current query cache size: %s | implode(' ',ADVISOR_formatByteDown(value, 2, 2))
|
||||
|
||||
rule 'Query cache min result size' [!fired('Query cache disabled')]
|
||||
value == 1024*1024
|
||||
query_cache_limit
|
||||
value == 1024*1024
|
||||
The max size of the result set in the query cache is the default of 1 MiB.
|
||||
Changing {query_cache_limit} (usually by increasing) may increase efficiency. This variable determines the maximum size a query result may have to be inserted into the query cache. If there are many query results above 1 MiB that are well cacheable (many reads, little writes) then increasing {query_cache_limit} will increase efficiency. Whereas in the case of many query results being above 1 MiB that are not very well cacheable (often invalidated due to table updates) increasing {query_cache_limit} might reduce efficiency.
|
||||
query_cache_limit is set to 1 MiB
|
||||
|
||||
@ -55,7 +55,7 @@ function PMA_ifSetOr(&$var, $default = null, $type = 'similar')
|
||||
* $type can be:
|
||||
* - false : no type checking
|
||||
* - 'scalar' : whether type of $var is integer, float, string or boolean
|
||||
* - 'numeric' : whether type of $var is any number repesentation
|
||||
* - 'numeric' : whether type of $var is any number representation
|
||||
* - 'length' : whether type of $var is scalar with a string length > 0
|
||||
* - 'similar' : whether type of $var is similar to type of $compare
|
||||
* - 'equal' : whether type of $var is identical to type of $compare
|
||||
|
||||
@ -380,7 +380,7 @@ function PMA_getSqlQueryAndCreateDbBeforeCopy()
|
||||
// Set the SQL mode to NO_AUTO_VALUE_ON_ZERO to prevent MySQL from creating
|
||||
// export statements it cannot import
|
||||
$sql_set_mode = "SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO'";
|
||||
PMA_DBI_query($sql_set_mode);
|
||||
$GLOBALS['dbi']->query($sql_set_mode);
|
||||
|
||||
// rebuild the database list because PMA_Table::moveCopy
|
||||
// checks in this list if the target db exists
|
||||
@ -428,7 +428,7 @@ function PMA_getSqlConstraintsQueryForFullDb(
|
||||
*
|
||||
* @param array $tables_full array of all tables in given db or dbs
|
||||
* @param object $export_sql_plugin export plugin instance
|
||||
* @param strin $db database name
|
||||
* @param string $db database name
|
||||
*
|
||||
* @return array $views
|
||||
*/
|
||||
|
||||
@ -15,7 +15,7 @@ if (!defined('PHPMYADMIN')) {
|
||||
* @param string $sql SQL query
|
||||
* @param array $databases array with all databases
|
||||
*
|
||||
* @return strin $db new database name
|
||||
* @return string $db new database name
|
||||
*/
|
||||
function PMA_getNewDatabase($sql, $databases)
|
||||
{
|
||||
@ -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
|
||||
@ -2249,7 +2253,7 @@ function PMA_executeQueryAndSendQueryResponse($analyzed_sql_results,
|
||||
$query_type, $sql_query, $selected, $complete_query
|
||||
) {
|
||||
// Include PMA_Index class for use in PMA_DisplayResults class
|
||||
include './libraries/Index.class.php';
|
||||
include_once './libraries/Index.class.php';
|
||||
|
||||
include 'libraries/DisplayResults.class.php';
|
||||
|
||||
|
||||
@ -3041,5 +3041,18 @@ function PMA_SQP_getParserDataMap()
|
||||
'PMA_SQPdata_column_type' => $PMA_SQPdata_column_type,
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Get Parser analyze Map from parse_analyze_inc.php
|
||||
*
|
||||
* @param array $sql_query The SQL string
|
||||
* @param array $db Current DB
|
||||
*
|
||||
* @return Array analyze Map from parse_analyze_inc.php
|
||||
*/
|
||||
function PMA_SQP_getParserAnalyzeMap($sql_query, $db)
|
||||
{
|
||||
include 'libraries/parse_analyze.inc.php';
|
||||
return $analyzed_sql_results;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -176,14 +176,10 @@ class PMA_SysInfoWinnt extends PMA_SysInfo
|
||||
}
|
||||
$arrInstance = array();
|
||||
foreach ($arrProp as $propItem) {
|
||||
if ( empty($strValue)) {
|
||||
eval("\$value = \$objItem->" . $propItem->Name . ";");
|
||||
$arrInstance[$propItem->Name] = trim($value);
|
||||
} else {
|
||||
if (in_array($propItem->Name, $strValue)) {
|
||||
eval("\$value = \$objItem->" . $propItem->Name . ";");
|
||||
$arrInstance[$propItem->Name] = trim($value);
|
||||
}
|
||||
$name = $propItem->Name;
|
||||
if ( empty($strValue) || in_array($name, $strValue)) {
|
||||
$value = $objItem->$name;
|
||||
$arrInstance[$name] = trim($value);
|
||||
}
|
||||
}
|
||||
$arrData[] = $arrInstance;
|
||||
|
||||
18
po/vls.po
18
po/vls.po
@ -8,14 +8,16 @@ 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-12 16:06+0200\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
"Language-Team: none\n"
|
||||
"PO-Revision-Date: 2013-07-25 14:40+0200\n"
|
||||
"Last-Translator: saurabh chikate <chikate.saurabh@gmail.com>\n"
|
||||
"Language-Team: West Flemish "
|
||||
"<http://l10n.cihar.com/projects/phpmyadmin/master/vls/>\n"
|
||||
"Language: vls\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: Weblate 1.6-dev\n"
|
||||
|
||||
#: browse_foreigners.php:51 browse_foreigners.php:75 js/messages.php:339
|
||||
#: libraries/DisplayResults.class.php:813
|
||||
@ -2099,13 +2101,13 @@ msgstr ""
|
||||
#. l10n: Month-year order for calendar, use either "calendar-month-year" or "calendar-year-month".
|
||||
#: js/messages.php:509
|
||||
msgid "calendar-month-year"
|
||||
msgstr ""
|
||||
msgstr "calendar-month-year"
|
||||
|
||||
#. l10n: Year suffix for calendar, "none" is empty.
|
||||
#: js/messages.php:511
|
||||
msgctxt "Year suffix"
|
||||
msgid "none"
|
||||
msgstr ""
|
||||
msgstr "none"
|
||||
|
||||
#: js/messages.php:520
|
||||
msgid "Hour"
|
||||
@ -2122,12 +2124,12 @@ msgstr ""
|
||||
#: libraries/Advisor.class.php:78
|
||||
#, php-format
|
||||
msgid "PHP threw following error: %s"
|
||||
msgstr ""
|
||||
msgstr "पी एच पी ने ये त्रुटी दिखाई है:%s"
|
||||
|
||||
#: libraries/Advisor.class.php:107
|
||||
#, php-format
|
||||
msgid "Failed evaluating precondition for rule '%s'."
|
||||
msgstr ""
|
||||
msgstr "पूर्व शर्त कि वजाह से नियम सुलाझाने मे विफलता'%s'."
|
||||
|
||||
#: libraries/Advisor.class.php:124
|
||||
#, php-format
|
||||
|
||||
7
sql.php
7
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
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* handle row specifc actions like edit, delete, export
|
||||
* handle row specific actions like edit, delete, export
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -27,16 +27,6 @@ $scripts->addFile('tbl_change.js');
|
||||
$scripts->addFile('jquery/jquery-ui-timepicker-addon.js');
|
||||
$scripts->addFile('gis_data_editor.js');
|
||||
|
||||
$post_params = array(
|
||||
'ajax_request',
|
||||
'session_max_rows'
|
||||
);
|
||||
foreach ($post_params as $one_post_param) {
|
||||
if (isset($_POST[$one_post_param])) {
|
||||
$GLOBALS[$one_post_param] = $_POST[$one_post_param];
|
||||
}
|
||||
}
|
||||
|
||||
$table_search = new PMA_TableSearch($db, $table, "normal");
|
||||
|
||||
/**
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Displays table structure infos like fields/columns, indexes, size, rows
|
||||
* and allows manipulation of indexes and columns/fields
|
||||
* Displays table structure infos like columns, indexes, size, rows
|
||||
* and allows manipulation of indexes and columns
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
@ -18,6 +18,8 @@ require_once 'libraries/mysql_charsets.inc.php';
|
||||
*/
|
||||
require_once 'libraries/structure.lib.php';
|
||||
require_once 'libraries/index.lib.php';
|
||||
require_once 'libraries/sql.lib.php';
|
||||
require_once 'libraries/bookmark.lib.php';
|
||||
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
@ -91,7 +93,7 @@ if (! empty($submit_mult)) {
|
||||
if (isset($_REQUEST['selected_fld'])) {
|
||||
$err_url = 'tbl_structure.php?' . PMA_generate_common_url($db, $table);
|
||||
if ($submit_mult == 'browse') {
|
||||
// browsing the table displaying only selected fields/columns
|
||||
// browsing the table displaying only selected columns
|
||||
$GLOBALS['active_page'] = 'sql.php';
|
||||
$sql_query = '';
|
||||
foreach ($_REQUEST['selected_fld'] as $idx => $sval) {
|
||||
@ -103,11 +105,18 @@ if (! empty($submit_mult)) {
|
||||
}
|
||||
$sql_query .= ' FROM ' . PMA_Util::backquote($db)
|
||||
. '.' . PMA_Util::backquote($table);
|
||||
include 'sql.php';
|
||||
exit;
|
||||
|
||||
// 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
|
||||
);
|
||||
} else {
|
||||
// handle multiple field commands
|
||||
// handle confirmation of deleting multiple fields/columns
|
||||
// handle confirmation of deleting multiple columns
|
||||
$action = 'tbl_structure.php';
|
||||
include 'libraries/mult_submits.inc.php';
|
||||
/**
|
||||
|
||||
67
test/libraries/PMA_SQL_parse_analyze_test.php
Normal file
67
test/libraries/PMA_SQL_parse_analyze_test.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* tests for correctness of SQL parser analyze data
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include to test.
|
||||
*/
|
||||
require_once 'libraries/Util.class.php';
|
||||
require_once 'libraries/sqlparser.lib.php';
|
||||
|
||||
class PMA_SQLParserAnalyze_Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testPMA_SQP_getParserAnalyzeMa()
|
||||
{
|
||||
//select statement
|
||||
$sql_query = "select * from PMA.PMAParse";
|
||||
$db = "PMA";
|
||||
$data = PMA_SQP_getParserAnalyzeMap($sql_query, $db);
|
||||
|
||||
$this->assertEquals(
|
||||
array(
|
||||
'type' => 'alpha_reservedWord',
|
||||
'data' => 'select',
|
||||
'pos' => 6,
|
||||
'forbidden' => true,
|
||||
),
|
||||
$data['parsed_sql'][0]
|
||||
);
|
||||
$this->assertEquals(
|
||||
'select * from PMA.PMAParse',
|
||||
$data['analyzed_sql'][0]['unsorted_query']
|
||||
);
|
||||
|
||||
$this->assertTrue($data['is_select']);
|
||||
$this->assertFalse($data['is_group']);
|
||||
$this->assertFalse($data['is_show']);
|
||||
|
||||
//update statement
|
||||
$sql_query = "UPDATE `11`.`pma_bookmark` SET `id` = '2' WHERE `pma_bookmark`.`id` = 1;";
|
||||
$db = "PMA";
|
||||
$data = PMA_SQP_getParserAnalyzeMap($sql_query, $db);
|
||||
|
||||
$this->assertEquals(
|
||||
array(
|
||||
'type' => 'alpha_reservedWord',
|
||||
'data' => 'UPDATE',
|
||||
'pos' => 6,
|
||||
'forbidden' => true,
|
||||
),
|
||||
$data['parsed_sql'][0]
|
||||
);
|
||||
$this->assertEquals(
|
||||
$sql_query,
|
||||
$data['analyzed_sql'][0]['unsorted_query']
|
||||
);
|
||||
$this->assertFalse($data['is_group']);
|
||||
$this->assertFalse($data['is_show']);
|
||||
$this->assertTrue($data['is_affected']);
|
||||
$this->assertFalse($data['is_select']);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
239
test/libraries/PMA_display_export_test.php
Normal file
239
test/libraries/PMA_display_export_test.php
Normal file
@ -0,0 +1,239 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* tests for display_export.lib.php
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include to test.
|
||||
*/
|
||||
require_once 'libraries/Util.class.php';
|
||||
require_once 'libraries/Table.class.php';
|
||||
require_once 'libraries/Advisor.class.php';
|
||||
require_once 'libraries/php-gettext/gettext.inc';
|
||||
require_once 'libraries/url_generating.lib.php';
|
||||
require_once 'libraries/ServerStatusData.class.php';
|
||||
require_once 'libraries/display_export.lib.php';
|
||||
require_once 'libraries/Theme.class.php';
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/charset_conversion.lib.php';
|
||||
require_once 'libraries/Message.class.php';
|
||||
require_once 'libraries/plugin_interface.lib.php';
|
||||
require_once 'libraries/sanitizing.lib.php';
|
||||
require_once 'libraries/sqlparser.lib.php';
|
||||
require_once 'libraries/js_escape.lib.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
|
||||
/**
|
||||
* class PMA_DisplayExport_Test
|
||||
*
|
||||
* this class is for testing display_export.lib.php functions
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
class PMA_DisplayExport_Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test for setUp
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
//$GLOBALS
|
||||
$GLOBALS['cfg']['MaxRows'] = 10;
|
||||
$GLOBALS['cfg']['ServerDefault'] = "PMA_server";
|
||||
$GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
|
||||
$GLOBALS['cfg']['LimitChars'] = 100;
|
||||
$GLOBALS['cfg']['ActionLinksMode'] = 'icons';
|
||||
$GLOBALS['cfg']['Server']['host'] = "localhost";
|
||||
$GLOBALS['cfg']['MySQLManualType'] = 'viewable';
|
||||
$GLOBALS['cfg']['Server']['user'] = "pma_user";
|
||||
$GLOBALS['cfg']['ShowHint'] = true;
|
||||
$GLOBALS['cfg']['ActionLinksMode'] = 'icons';
|
||||
$GLOBALS['cfg']['ZipDump'] = true;
|
||||
$GLOBALS['cfg']['GZipDump'] = false;
|
||||
$GLOBALS['cfg']['BZipDump'] = false;
|
||||
$GLOBALS['cfg']['Export']['asfile'] = true;
|
||||
$GLOBALS['cfg']['Export']['file_template_server'] = "file_template_server";
|
||||
$GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
|
||||
$GLOBALS['PMA_recoding_engine'] = "InnerDB";
|
||||
$GLOBALS['server'] = 0;
|
||||
|
||||
$GLOBALS['table'] = "table";
|
||||
$GLOBALS['pmaThemeImage'] = 'image';
|
||||
$GLOBALS['db'] = "PMA";
|
||||
|
||||
//$_SESSION
|
||||
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
|
||||
$_SESSION['PMA_Theme'] = new PMA_Theme();
|
||||
$_SESSION['relation'][$GLOBALS['server']] = "";
|
||||
|
||||
$pmaconfig = $this->getMockBuilder('PMA_Config')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$pmaconfig->expects($this->any())
|
||||
->method('getUserValue')
|
||||
->will($this->returnValue('user value for test'));
|
||||
|
||||
$GLOBALS['PMA_Config'] = $pmaconfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_getHtmlForHiddenInput
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPMAGetHtmlForHiddenInput()
|
||||
{
|
||||
$export_type = "server";
|
||||
$db = "PMA";
|
||||
$table = "PMA_test";
|
||||
$single_table_str = "PMA_single_str";
|
||||
$sql_query_str = "sql_query_str";
|
||||
|
||||
//Call the test function
|
||||
$html = PMA_getHtmlForHiddenInput(
|
||||
$export_type,
|
||||
$db,
|
||||
$table,
|
||||
$single_table_str,
|
||||
$sql_query_str
|
||||
);
|
||||
|
||||
//validate 1: PMA_generate_common_hidden_inputs
|
||||
//$single_table
|
||||
$this->assertContains(
|
||||
'<input type="hidden" name="single_table" value="TRUE"',
|
||||
$html
|
||||
);
|
||||
//$export_type
|
||||
$this->assertContains(
|
||||
'<input type="hidden" name="export_type" value="server"',
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
'<input type="hidden" name="export_method" value="quick"',
|
||||
$html
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_getHtmlForExportOptions
|
||||
*
|
||||
* @return vgetUserValue
|
||||
*/
|
||||
public function testPMAGetHtmlForExportOptions()
|
||||
{
|
||||
global $cfg;
|
||||
$cfg['Export']['method'] = "XML";
|
||||
$cfg['SaveDir'] = "/tmp";
|
||||
|
||||
$export_type = "server";
|
||||
$db = "PMA";
|
||||
$table = "PMA_test";
|
||||
$multi_values_str = "multi_values_str";
|
||||
$num_tables_str = "10";
|
||||
$export_list = null;
|
||||
$unlim_num_rows_str = "unlim_num_rows_str";
|
||||
$single_table = "single_table";
|
||||
PMA_Table::$cache[$db][$table]['ENGINE'] = "MERGE";
|
||||
|
||||
/* Scan for plugins */
|
||||
$export_list = PMA_getPlugins(
|
||||
"export",
|
||||
'libraries/plugins/export/',
|
||||
array(
|
||||
'export_type' => $export_type,
|
||||
'single_table' => isset($single_table)
|
||||
)
|
||||
);
|
||||
|
||||
//Call the test function
|
||||
$html = PMA_getHtmlForExportOptions(
|
||||
$export_type,
|
||||
$db,
|
||||
$table,
|
||||
$multi_values_str,
|
||||
$num_tables_str,
|
||||
$export_list,
|
||||
$unlim_num_rows_str
|
||||
);
|
||||
|
||||
//validate 1: PMA_getHtmlForExportOptionHeader
|
||||
$this->assertContains(
|
||||
'<div class="exportoptions" id="header">',
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
__('Exporting databases from the current server'),
|
||||
$html
|
||||
);
|
||||
|
||||
//validate 2: PMA_getHtmlForExportOptionsMethod
|
||||
$this->assertContains(
|
||||
$cfg['Export']['method'],
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
'<div class="exportoptions" id="quick_or_custom">',
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
__('Export Method:'),
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
__('Custom - display all possible options'),
|
||||
$html
|
||||
);
|
||||
|
||||
//validate 3: PMA_getHtmlForExportOptionsSelection
|
||||
$this->assertContains(
|
||||
'<div class="exportoptions" id="databases_and_tables">',
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
'<h3>' . __('Database(s):') . '</h3>',
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
$multi_values_str,
|
||||
$html
|
||||
);
|
||||
|
||||
//validate 4: PMA_getHtmlForExportOptionsQuickExport
|
||||
$this->assertContains(
|
||||
'<input type="checkbox" name="onserver" value="saveit" ',
|
||||
$html
|
||||
);
|
||||
$dir = htmlspecialchars(PMA_Util::userDir($cfg['SaveDir']));
|
||||
$this->assertContains(
|
||||
'Save on server in the directory <b>' . $dir . '</b>',
|
||||
$html
|
||||
);
|
||||
|
||||
//validate 5: PMA_getHtmlForExportOptionsOutput
|
||||
$this->assertContains(
|
||||
'<div class="exportoptions" id="output">',
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
'user value for test',
|
||||
$html
|
||||
);
|
||||
|
||||
//validate 6: PMA_getHtmlForExportOptionsFormat
|
||||
$this->assertContains(
|
||||
'<div class="exportoptions" id="format">',
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
'<h3>' . __('Format:') . '</h3>',
|
||||
$html
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -2811,3 +2811,9 @@ body .ui-widget {
|
||||
color: #235A81;
|
||||
}
|
||||
|
||||
/* over-riding jqplot-yaxis class */
|
||||
.jqplot-yaxis {
|
||||
left:0px !important;
|
||||
min-width:25px;
|
||||
width:auto;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user