Merge branch 'master' of https://github.com/phpmyadmin/phpmyadmin
This commit is contained in:
commit
ba487bb26c
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);
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -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