When selecting from navigation, show only the procedures of corresponding type

This commit is contained in:
Madhura Jayaratne 2013-10-20 16:13:32 +05:30
parent 3465535883
commit 673e503d7c
4 changed files with 21 additions and 6 deletions

View File

@ -27,9 +27,11 @@ class Node_Function_Container extends Node
$this->icon = PMA_Util::getImage('b_routines.png');
$this->links = array(
'text' => 'db_routines.php?server=' . $GLOBALS['server']
. '&db=%1$s&token=' . $GLOBALS['token'],
. '&db=%1$s&token=' . $GLOBALS['token']
. '&type=FUNCTION',
'icon' => 'db_routines.php?server=' . $GLOBALS['server']
. '&db=%1$s&token=' . $GLOBALS['token'],
. '&db=%1$s&token=' . $GLOBALS['token']
. '&type=FUNCTION',
);
$this->real_name = 'functions';

View File

@ -27,9 +27,11 @@ class Node_Procedure_Container extends Node
$this->icon = PMA_Util::getImage('b_routines.png');
$this->links = array(
'text' => 'db_routines.php?server=' . $GLOBALS['server']
. '&db=%1$s&token=' . $GLOBALS['token'],
. '&db=%1$s&token=' . $GLOBALS['token']
. '&type=PROCEDURE',
'icon' => 'db_routines.php?server=' . $GLOBALS['server']
. '&db=%1$s&token=' . $GLOBALS['token'],
. '&db=%1$s&token=' . $GLOBALS['token']
. '&type=PROCEDURE',
);
$this->real_name = 'procedures';

View File

@ -79,7 +79,11 @@ $errors = array();
*/
switch ($_PMA_RTE) {
case 'RTN':
PMA_RTN_main();
$type = null;
if (isset($_REQUEST['type'])) {
$type = $_REQUEST['type'];
}
PMA_RTN_main($type);
break;
case 'TRI':
PMA_TRI_main();

View File

@ -33,9 +33,13 @@ function PMA_RTN_setGlobals()
/**
* Main function for the routines functionality
*
* @param string $type 'FUNCTION' for functions,
* 'PROCEDURE' for procedures,
* null for both
*
* @return nothing
*/
function PMA_RTN_main()
function PMA_RTN_main($type)
{
global $db;
@ -52,6 +56,9 @@ function PMA_RTN_main()
$columns = "`SPECIFIC_NAME`, `ROUTINE_NAME`, `ROUTINE_TYPE`, ";
$columns .= "`DTD_IDENTIFIER`, `ROUTINE_DEFINITION`";
$where = "ROUTINE_SCHEMA='" . PMA_Util::sqlAddSlashes($db) . "'";
if (PMA_isValid($type, array('FUNCTION','PROCEDURE'))) {
$where .= " AND `ROUTINE_TYPE`='" . $type . "'";
}
$items = $GLOBALS['dbi']->fetchResult(
"SELECT $columns FROM `INFORMATION_SCHEMA`.`ROUTINES` WHERE $where;"
);