diff --git a/js/functions.js b/js/functions.js
index b662e53963..3552979d3a 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -3194,6 +3194,11 @@ AJAX.registerOnload('functions.js', function() {
var params = $(this).closest("form").serialize() + '&ajax_request=true';
if (isDbSelector) {
params += '&full=true';
+ } else {
+ var $input = $this.closest('.list_container').find('.fast_filter input.searchClause');
+ if ($input.length && $input.val() != $input[0].defaultValue) {
+ params += "&searchClause=" + $input.val();
+ }
}
$.get('navigation.php', params, function (data) {
if (data.success) {
@@ -3202,9 +3207,15 @@ AJAX.registerOnload('functions.js', function() {
$('#pma_navigation_tree').html(data.message).children('div').show();
} else {
var $parent = $this.closest('.list_container').parent();
- $this.closest('.list_container').remove();
- $parent.append(data.message).children('div').show();
+ var $input = $this.closest('.list_container').find('.fast_filter input.searchClause');
+ var val = '';
+ if ($input.length) {
+ val = $input.val();
+ }
+ $this.closest('.list_container').html($(data.message).children().show());
+ $parent.find('.fast_filter input.searchClause').val(val);
$parent.find('span.pos2_value:first').text($parent.find('span.pos2_value:last').text());
+ $parent.find('span.pos3_value:first').text($parent.find('span.pos3_value:last').text());
}
} else {
PMA_ajaxShowMessage(data.error);
diff --git a/js/navigation.js b/js/navigation.js
index bbb750710d..7ed8d7d030 100644
--- a/js/navigation.js
+++ b/js/navigation.js
@@ -36,12 +36,30 @@ $(document).ready(function() {
.css('visibility', 'visible');
$icon.hide();
$throbber.insertBefore($icon);
+
+ var $filterContainer = $(this).closest('.list_container');
+ var $filterInput = $([]);
+ while (1) {
+ if ($filterContainer.find('.fast_filter input.searchClause').length != 0) {
+ $filterInput = $filterContainer.find('.fast_filter input.searchClause');
+ break;
+ } else if (! $filterContainer.is('.list_container')) {
+ break;
+ }
+ $filterContainer = $filterContainer.parent().closest('.list_container');
+ }
+ var searchClause = '';
+ if ($filterInput.length != 0 && $filterInput.val() != $filterInput[0].defaultValue) {
+ searchClause = $filterInput.val();
+ }
+
var params = {
a_path: $(this).find('span.a_path').text(),
v_path: $(this).find('span.v_path').text(),
pos: $(this).find('span.pos').text(),
pos2_name: $(this).find('span.pos2_name').text(),
- pos2_value: $(this).find('span.pos2_value').text()
+ pos2_value: $(this).find('span.pos2_value').text(),
+ searchClause: searchClause
};
var url = $('#pma_navigation').find('a.navigation_url').attr('href');
$.get(url, params, function (data) {
@@ -406,9 +424,12 @@ $(function(){
var params = {ajax_request: true};
if (isDbSelector) {
params['full'] = true;
+ } else {
+ var $input = $this.closest('.list_container').find('.fast_filter input.searchClause');
+ if ($input.length && $input.val() != $input[0].defaultValue) {
+ params['searchClause'] = $input.val();
+ }
}
-
-
$.get($this.attr('href'), params, function (data) {
PMA_ajaxRemoveMessage($msgbox);
if (data.success) {
@@ -416,8 +437,13 @@ $(function(){
$('#pma_navigation_tree').html(data.message).children('div').show();
} else {
var $parent = $this.closest('.list_container').parent();
- $this.closest('.list_container').remove();
- $parent.append(data.message).children('div').show();
+ var $input = $this.closest('.list_container').find('.fast_filter input.searchClause');
+ var val = '';
+ if ($input.length) {
+ val = $input.val();
+ }
+ $this.closest('.list_container').html($(data.message).children().show());
+ $parent.find('.fast_filter input.searchClause').val(val);
$parent.find('span.pos2_value:first').text($parent.find('span.pos2_value:last').text());
$parent.find('span.pos3_value:first').text($parent.find('span.pos3_value:last').text());
}
@@ -437,32 +463,43 @@ $(function(){
$(this).css('background', '');
});
- // FIXME: reintegrate ajax table filtering
- // when the table pagination is implemented
-
// Bind "clear fast filter"
- $('#pma_navigation_tree li.fast_filter > span').live('click', function () {
+ $('#pma_navigation_tree li.fast_filter span').live('click', function (event) {
+ event.stopPropagation();
// Clear the input and apply the fast filter with empty input
+ var filter = $(this).closest('.list_container').data('fastFilter');
+ if (filter) {
+ filter.restore();
+ }
var value = $(this).prev()[0].defaultValue;
$(this).prev().val(value).trigger('keyup');
});
// Bind "fast filter"
- $('#pma_navigation_tree li.fast_filter > input').live('focus', function () {
+ $('#pma_navigation_tree li.fast_filter input.searchClause').live('focus', function () {
+ var $obj = $(this).closest('.list_container');
+ if (! $obj.data('fastFilter')) {
+ $obj.data('fastFilter', new fastFilter($obj, $(this).val()));
+ }
if ($(this).val() == this.defaultValue) {
$(this).val('');
} else {
$(this).select();
}
});
- $('#pma_navigation_tree li.fast_filter > input').live('blur', function () {
+ $('#pma_navigation_tree li.fast_filter input.searchClause').live('blur', function () {
if ($(this).val() == '') {
$(this).val(this.defaultValue);
}
+ var $obj = $(this).closest('.list_container');
+ if ($(this).val() == this.defaultValue && $obj.data('fastFilter')) {
+ $obj.data('fastFilter').restore();
+ }
});
- $('#pma_navigation_tree li.fast_filter > input').live('keyup', function () {
- var $obj = $(this).parent().parent();
+ $('#pma_navigation_tree li.fast_filter input.searchClause').live('keyup', function () {
+ var $obj = $(this).closest('.list_container');
var str = '';
- if ($(this).val() != this.defaultValue) {
+ if ($(this).val() != this.defaultValue && $(this).val() != '') {
+ $obj.find('div.pageselector').hide();
str = $(this).val().toLowerCase();
}
$obj.find('li > a').not('.container').each(function () {
@@ -486,6 +523,15 @@ $(function(){
};
container_filter($obj, str);
ScrollHandler.displayScrollbar();
+ if ($(this).val() != this.defaultValue && $(this).val() != '') {
+ if (! $obj.data('fastFilter')) {
+ $obj.data('fastFilter', new fastFilter($obj, $(this).val()));
+ } else {
+ $obj.data('fastFilter').update($(this).val());
+ }
+ } else if ($obj.data('fastFilter')) {
+ $obj.data('fastFilter').restore(true);
+ }
});
// Jump to recent table
@@ -500,3 +546,91 @@ $(function(){
});
});//end of document get ready
+var fastFilter = function ($this, query)
+{
+ this.update = function (query) {
+ if (this.query != query) {
+ this.query = query;
+ this.$this.find('.moreResults').remove();
+ this.request();
+ }
+ };
+
+ this.request = function () {
+ var that = this;
+ clearTimeout(this.timeout);
+ this.timeout = setTimeout(function () {
+ if (that.xhr) {
+ that.xhr.abort();
+ }
+ var url = $('#pma_navigation').find('a.navigation_url').attr('href');
+ var results = that.$this.find('li:visible:not(.fast_filter)').length;
+ var params = that.$this.find('form').serialize() + "&results=" + results;
+ that.xhr = $.ajax({
+ url: url,
+ type: 'post',
+ dataType: 'json',
+ data: params,
+ complete: function (jqXHR) {
+ var data = $.parseJSON(jqXHR.responseText);
+ if (data && data.results) {
+ var $listItem = $('
', {'class':'moreResults'})
+ .appendTo(that.$this.find('.fast_filter'));
+ var $link = $('', {href:'#'})
+ .text(data.results)
+ .appendTo($listItem)
+ .click(function (event) {
+ event.preventDefault();
+ that.swap.apply(that, [data.message]);
+ });
+ }
+ }
+ });
+ }, 500);
+ };
+
+ this.swap = function (list)
+ {
+ this.swapped = true;
+ this.$this
+ .html($(list).html())
+ .children()
+ .show()
+ .end()
+ .find('.fast_filter input.searchClause')
+ .val(this.query);
+ this.$this.data('fastFilter', this);
+ ScrollHandler.displayScrollbar();
+ };
+
+ this.restore = function (focus)
+ {
+ if (this.swapped) {
+ this.swapped = false;
+ this.$this.html(this.$clone.html()).children().show();
+ this.$this.data('fastFilter', this);
+ if (focus) {
+ this.$this.find('.fast_filter input.searchClause').focus();
+ }
+ }
+ this.query = '';
+ this.$this.find('.moreResults').remove();
+ this.$this.find('div.pageselector').show();
+ ScrollHandler.displayScrollbar();
+ };
+
+ this.$this = $this;
+ this.query = query;
+ this.$clone = $this.clone();
+ this.swapped = false;
+ this.xhr = null;
+ this.timeout = null;
+
+ var $filterInput = $this.find('.fast_filter input.searchClause');
+ if ( $filterInput.length != 0
+ && $filterInput.val() != ''
+ && $filterInput.val() != $filterInput[0].defaultValue
+ ) {
+ this.request();
+ }
+};
diff --git a/libraries/navigation/NavigationTree.class.php b/libraries/navigation/NavigationTree.class.php
index a2a83804b2..da47af3127 100644
--- a/libraries/navigation/NavigationTree.class.php
+++ b/libraries/navigation/NavigationTree.class.php
@@ -59,6 +59,12 @@ class PMA_NavigationTree {
*/
private $pos3_value = array();
+ /**
+ * @var string The search clause to use in SQL queries for fetching nodes
+ * Used by the asynchronous fast filter
+ */
+ private $searchClause = '';
+
/**
* @var object A reference to the common functions object
*/
@@ -113,6 +119,9 @@ class PMA_NavigationTree {
$count++;
}
}
+ if (isset($_REQUEST['searchClause'])) {
+ $this->searchClause = $_REQUEST['searchClause'];
+ }
// Initialise the tree by creating a root node
$node = new Node('root', Node::CONTAINER);
$this->tree = $node;
@@ -210,7 +219,7 @@ class PMA_NavigationTree {
$retval = $container;
if (count($container->children) <= 1) {
- foreach ($db->getData($container->real_name, $pos2) as $item) {
+ foreach ($db->getData($container->real_name, $pos2, $this->searchClause) as $item) {
switch ($container->real_name) {
case 'events':
$node = new Node_Event($item);
@@ -540,6 +549,30 @@ class PMA_NavigationTree {
$retval .= "";
$retval .= "";
}
+ if (! empty($this->searchClause)) {
+ $results = $node->realParent()->getPresence(
+ $node->real_name,
+ $this->searchClause
+ );
+ $clientResults = ! empty($_REQUEST['results']) ? (int)$_REQUEST['results'] : 0;
+ $otherResults = $results - $clientResults;
+ if ($otherResults < 1) {
+ $otherResults = '';
+ } else {
+ $otherResults = sprintf(
+ _ngettext(
+ '%s other result found',
+ '%s other results found',
+ $otherResults
+ ),
+ $otherResults
+ );
+ }
+ PMA_Response::getInstance()->addJSON(
+ 'results',
+ $otherResults
+ );
+ }
return $retval;
}
@@ -759,12 +792,29 @@ class PMA_NavigationTree {
private function fastFilterHtml($node)
{
$retval = '';
- if (($node->real_name == 'tables' || $node->real_name == 'views')
+ if (($node->type == Node::CONTAINER
+ && ( $node->real_name == 'tables'
+ || $node->real_name == 'views'
+ || $node->real_name == 'functions'
+ || $node->real_name == 'procedures'
+ || $node->real_name == 'events')
+ )
&& $node->realParent()->getPresence($node->real_name) >= (int)$GLOBALS['cfg']['LeftDisplayTableFilterMinimum']
) {
+ $paths = $node->getPaths();
+ $url_params = array(
+ 'pos' => $this->pos,
+ 'a_path' => $paths['a_path'],
+ 'v_path' => $paths['v_path'],
+ 'pos2_name' => $node->real_name,
+ 'pos2_value' => 0
+ );
$retval .= "";
- $retval .= "";
+ $retval .= "";
$retval .= "";
}
return $retval;
@@ -799,7 +849,7 @@ class PMA_NavigationTree {
} else {
$pos = $node->pos2;
}
- $num = $node->realParent()->getPresence($node->real_name);
+ $num = $node->realParent()->getPresence($node->real_name, $this->searchClause);
$retval = $this->_commonFunctions->getListNavigator(
$num,
$pos,
diff --git a/libraries/navigation/Nodes/Node.class.php b/libraries/navigation/Nodes/Node.class.php
index cc4e5fe7f9..53a6db66df 100644
--- a/libraries/navigation/Nodes/Node.class.php
+++ b/libraries/navigation/Nodes/Node.class.php
@@ -377,7 +377,7 @@ class Node {
/**
* TODO: comment
*/
- public function getData($type, $pos)
+ public function getData($type, $pos, $searchClause = '')
{
$query = "SELECT `SCHEMA_NAME` ";
$query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
@@ -389,7 +389,7 @@ class Node {
/**
* TODO: comment
*/
- public function getPresence($type)
+ public function getPresence($type, $searchClause = '')
{
return 0;
}
diff --git a/libraries/navigation/Nodes/Node_Database.class.php b/libraries/navigation/Nodes/Node_Database.class.php
index 1c180a9539..2787f49725 100644
--- a/libraries/navigation/Nodes/Node_Database.class.php
+++ b/libraries/navigation/Nodes/Node_Database.class.php
@@ -13,7 +13,7 @@ class Node_Database extends Node {
. '&db=%1$s&token=' . $GLOBALS['token']
);
}
- public function getPresence($type)
+ public function getPresence($type, $searchClause = '')
{
$retval = 0;
$db = $this->real_name;
@@ -24,27 +24,39 @@ class Node_Database extends Node {
$query = "SELECT COUNT(*) ";
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
$query .= "WHERE `TABLE_SCHEMA`='$db' ";
- $query .= "AND `TABLE_TYPE`='BASE TABLE'";
+ $query .= "AND `TABLE_TYPE`='BASE TABLE' ";
+ if (! empty($searchClause)) {
+ $query .= "AND `TABLE_NAME` LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%' ";
+ }
$retval = (int)PMA_DBI_fetch_value($query);
} else {
- $db = $this->_commonFunctions->backquote($db);
- $query = "SHOW FULL TABLES FROM $db ";
- $query .= "WHERE `Table_type`='BASE TABLE'";
+ $query = "SHOW FULL TABLES FROM " . $this->_commonFunctions->backquote($db) . " ";
+ $query .= "WHERE `Table_type`='BASE TABLE' ";
+ if (! empty($searchClause)) {
+ $query .= "AND " . $this->_commonFunctions->backquote("Tables_in_" . $db);
+ $query .= " LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%' ";
+ }
$retval = PMA_DBI_num_rows(PMA_DBI_try_query($query));
}
break;
case 'views':
- if (! $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) {
+ if (! $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS'] || ! empty($searchClause)) {
$db = $this->_commonFunctions->sqlAddSlashes($db);
$query = "SELECT COUNT(*) ";
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
$query .= "WHERE `TABLE_SCHEMA`='$db' ";
- $query .= "AND `TABLE_TYPE`!='BASE TABLE'";
+ $query .= "AND `TABLE_TYPE`!='BASE TABLE' ";
+ if (! empty($searchClause)) {
+ $query .= "AND `TABLE_NAME` LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%' ";
+ }
$retval = (int)PMA_DBI_fetch_value($query);
} else {
- $db = $this->_commonFunctions->backquote($db);
- $query = "SHOW FULL TABLES FROM $db ";
- $query .= "WHERE `Table_type`!='BASE TABLE'";
+ $query = "SHOW FULL TABLES FROM " . $this->_commonFunctions->backquote($db) . " ";
+ $query .= "WHERE `Table_type`!='BASE TABLE' ";
+ if (! empty($searchClause)) {
+ $query .= "AND " . $this->_commonFunctions->backquote("Tables_in_" . $db);
+ $query .= " LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%' ";
+ }
$retval = PMA_DBI_num_rows(PMA_DBI_try_query($query));
}
break;
@@ -54,11 +66,17 @@ class Node_Database extends Node {
$query = "SELECT COUNT(*) ";
$query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
$query .= "WHERE `ROUTINE_SCHEMA`='$db'";
- $query .= "AND `ROUTINE_TYPE`='PROCEDURE'";
+ $query .= "AND `ROUTINE_TYPE`='PROCEDURE' ";
+ if (! empty($searchClause)) {
+ $query .= "AND `ROUTINE_NAME` LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%' ";
+ }
$retval = (int)PMA_DBI_fetch_value($query);
} else {
$db = $this->_commonFunctions->sqlAddSlashes($db);
- $query = "SHOW PROCEDURE STATUS WHERE `Db`='$db'";
+ $query = "SHOW PROCEDURE STATUS WHERE `Db`='$db' ";
+ if (! empty($searchClause)) {
+ $query .= "WHERE `Name` LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%'";
+ }
$retval = PMA_DBI_num_rows(PMA_DBI_try_query($query));
}
break;
@@ -68,11 +86,17 @@ class Node_Database extends Node {
$query = "SELECT COUNT(*) ";
$query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
$query .= "WHERE `ROUTINE_SCHEMA`='$db' ";
- $query .= "AND `ROUTINE_TYPE`='FUNCTION'";
+ $query .= "AND `ROUTINE_TYPE`='FUNCTION' ";
+ if (! empty($searchClause)) {
+ $query .= "AND `ROUTINE_NAME` LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%' ";
+ }
$retval = (int)PMA_DBI_fetch_value($query);
} else {
$db = $this->_commonFunctions->sqlAddSlashes($db);
- $query = "SHOW FUNCTION STATUS WHERE `Db`='$db'";
+ $query = "SHOW FUNCTION STATUS WHERE `Db`='$db' ";
+ if (! empty($searchClause)) {
+ $query .= "WHERE `Name` LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%'";
+ }
$retval = PMA_DBI_num_rows(PMA_DBI_try_query($query));
}
break;
@@ -81,11 +105,17 @@ class Node_Database extends Node {
$db = $this->_commonFunctions->sqlAddSlashes($db);
$query = "SELECT COUNT(*) ";
$query .= "FROM `INFORMATION_SCHEMA`.`EVENTS` ";
- $query .= "WHERE `EVENT_SCHEMA`='$db'";
+ $query .= "WHERE `EVENT_SCHEMA`='$db' ";
+ if (! empty($searchClause)) {
+ $query .= "AND `EVENT_NAME` LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%' ";
+ }
$retval = (int)PMA_DBI_fetch_value($query);
} else {
$db = $this->_commonFunctions->backquote($db);
- $query = "SHOW EVENTS FROM $db";
+ $query = "SHOW EVENTS FROM $db ";
+ if (! empty($searchClause)) {
+ $query .= "WHERE `Name` LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%'";
+ }
$retval = PMA_DBI_num_rows(PMA_DBI_try_query($query));
}
break;
@@ -95,7 +125,7 @@ class Node_Database extends Node {
return $retval;
}
- public function getData($type, $pos)
+ public function getData($type, $pos, $searchClause = '')
{
$retval = array();
$db = $this->real_name;
@@ -107,13 +137,19 @@ class Node_Database extends Node {
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
$query .= "WHERE `TABLE_SCHEMA`='$db' ";
$query .= "AND `TABLE_TYPE`='BASE TABLE' ";
+ if (! empty($searchClause)) {
+ $query .= "AND `TABLE_NAME` LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%' ";
+ }
$query .= "ORDER BY `TABLE_NAME` ASC ";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxTableList']}";
$retval = PMA_DBI_fetch_result($query);
} else {
- $db = $this->_commonFunctions->backquote($db);
- $query = "SHOW FULL TABLES FROM $db ";
- $query .= "WHERE `Table_type`='BASE TABLE'";
+ $query = "SHOW FULL TABLES FROM " . $this->_commonFunctions->backquote($db) . " ";
+ $query .= "WHERE `Table_type`='BASE TABLE' ";
+ if (! empty($searchClause)) {
+ $query .= "AND " . $this->_commonFunctions->backquote("Tables_in_" . $db);
+ $query .= " LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%' ";
+ }
$handle = PMA_DBI_try_query($query);
if ($handle !== false) {
$count = 0;
@@ -134,13 +170,19 @@ class Node_Database extends Node {
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
$query .= "WHERE `TABLE_SCHEMA`='$db' ";
$query .= "AND `TABLE_TYPE`!='BASE TABLE' ";
+ if (! empty($searchClause)) {
+ $query .= "AND `TABLE_NAME` LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%' ";
+ }
$query .= "ORDER BY `TABLE_NAME` ASC ";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxTableList']}";
$retval = PMA_DBI_fetch_result($query);
} else {
- $db = $this->_commonFunctions->backquote($db);
- $query = "SHOW FULL TABLES FROM $db ";
- $query .= "WHERE `Table_type`!='BASE TABLE'";
+ $query = "SHOW FULL TABLES FROM " . $this->_commonFunctions->backquote($db) . " ";
+ $query .= "WHERE `Table_type`!='BASE TABLE' ";
+ if (! empty($searchClause)) {
+ $query .= "AND " . $this->_commonFunctions->backquote("Tables_in_" . $db);
+ $query .= " LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%' ";
+ }
$handle = PMA_DBI_try_query($query);
if ($handle !== false) {
$count = 0;
@@ -161,12 +203,18 @@ class Node_Database extends Node {
$query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
$query .= "WHERE `ROUTINE_SCHEMA`='$db'";
$query .= "AND `ROUTINE_TYPE`='PROCEDURE' ";
+ if (! empty($searchClause)) {
+ $query .= "AND `ROUTINE_NAME` LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%' ";
+ }
$query .= "ORDER BY `ROUTINE_NAME` ASC ";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxTableList']}";
$retval = PMA_DBI_fetch_result($query);
} else {
$db = $this->_commonFunctions->sqlAddSlashes($db);
- $query = "SHOW PROCEDURE STATUS WHERE `Db`='$db'";
+ $query = "SHOW PROCEDURE STATUS WHERE `Db`='$db' ";
+ if (! empty($searchClause)) {
+ $query .= "WHERE `Name` LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%'";
+ }
$handle = PMA_DBI_try_query($query);
if ($handle !== false) {
$count = 0;
@@ -187,12 +235,18 @@ class Node_Database extends Node {
$query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
$query .= "WHERE `ROUTINE_SCHEMA`='$db' ";
$query .= "AND `ROUTINE_TYPE`='FUNCTION' ";
+ if (! empty($searchClause)) {
+ $query .= "AND `ROUTINE_NAME` LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%' ";
+ }
$query .= "ORDER BY `ROUTINE_NAME` ASC ";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxTableList']}";
$retval = PMA_DBI_fetch_result($query);
} else {
$db = $this->_commonFunctions->sqlAddSlashes($db);
- $query = "SHOW FUNCTION STATUS WHERE `Db`='$db'";
+ $query = "SHOW FUNCTION STATUS WHERE `Db`='$db' ";
+ if (! empty($searchClause)) {
+ $query .= "WHERE `Name` LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%'";
+ }
$handle = PMA_DBI_try_query($query);
if ($handle !== false) {
$count = 0;
@@ -212,12 +266,18 @@ class Node_Database extends Node {
$query = "SELECT `EVENT_NAME` AS `name` ";
$query .= "FROM `INFORMATION_SCHEMA`.`EVENTS` ";
$query .= "WHERE `EVENT_SCHEMA`='$db' ";
+ if (! empty($searchClause)) {
+ $query .= "AND `EVENT_NAME` LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%' ";
+ }
$query .= "ORDER BY `EVENT_NAME` ASC ";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxTableList']}";
$retval = PMA_DBI_fetch_result($query);
} else {
$db = $this->_commonFunctions->backquote($db);
- $query = "SHOW EVENTS FROM $db";
+ $query = "SHOW EVENTS FROM $db ";
+ if (! empty($searchClause)) {
+ $query .= "WHERE `Name` LIKE '%" . $this->_commonFunctions->sqlAddSlashes($searchClause, true) . "%'";
+ }
$handle = PMA_DBI_try_query($query);
if ($handle !== false) {
$count = 0;
diff --git a/libraries/navigation/Nodes/Node_Table.class.php b/libraries/navigation/Nodes/Node_Table.class.php
index ec4cbe6139..17475322f0 100644
--- a/libraries/navigation/Nodes/Node_Table.class.php
+++ b/libraries/navigation/Nodes/Node_Table.class.php
@@ -16,7 +16,7 @@ class Node_Table extends Node {
);
}
- public function getPresence($type)
+ public function getPresence($type, $searchClause = '')
{
$retval = 0;
$db = $this->realParent()->real_name;
@@ -66,7 +66,7 @@ class Node_Table extends Node {
return $retval;
}
- public function getData($type, $pos)
+ public function getData($type, $pos, $searchClause = '')
{
$retval = array();
$db = $this->realParent()->real_name;