diff --git a/libraries/db_search.lib.php b/libraries/db_search.lib.php
deleted file mode 100644
index 5720246dc1..0000000000
--- a/libraries/db_search.lib.php
+++ /dev/null
@@ -1,389 +0,0 @@
- 1 word at least, 2 -> all words,
- * 3 -> exact string, 4 -> regexp)
- *
- * @return array 3 SQL querys (for count, display and delete results)
- *
- * @todo can we make use of fulltextsearch IN BOOLEAN MODE for this?
- * PMA_backquote
- * PMA_DBI_free_result
- * PMA_DBI_fetch_assoc
- * $GLOBALS['db']
- * explode
- * count
- * strlen
- */
-function PMA_getSearchSqls($table, $criteriaColumnName, $criteriaSearchString,
- $criteriaSearchType
-) {
- $common_functions = PMA_CommonFunctions::getInstance();
- // Statement types
- $sqlstr_select = 'SELECT';
- $sqlstr_delete = 'DELETE';
- // Table to use
- $sqlstr_from = ' FROM '
- . $common_functions->backquote($GLOBALS['db']) . '.'
- . $common_functions->backquote($table);
- // Gets where clause for the query
- $where_clause = PMA_dbSearchGetWhereClause(
- $table, $criteriaSearchString, $criteriaSearchType, $criteriaColumnName
- );
- // Builds complete queries
- $sql['select_columns'] = $sqlstr_select . ' * ' . $sqlstr_from . $where_clause;
- // here, I think we need to still use the COUNT clause, even for
- // VIEWs, anyway we have a WHERE clause that should limit results
- $sql['select_count'] = $sqlstr_select . ' COUNT(*) AS `count`'
- . $sqlstr_from . $where_clause;
- $sql['delete'] = $sqlstr_delete . $sqlstr_from . $where_clause;
-
- return $sql;
-}
-
-/**
- * Provides where clause for bulding SQL query
- *
- * @param string $table The table name
- * @param integer $criteriaSearchString The search word/phrase/regexp to be searched
- * @param integer $criteriaSearchType Type of search
- * (1 -> 1 word at least, 2 -> all words,
- * 3 -> exact string, 4 -> regexp)
- * @param string $criteriaColumnName Restrict the search to this column
- *
- * @return string The generated where clause
- */
-function PMA_dbSearchGetWhereClause($table, $criteriaSearchString,
- $criteriaSearchType, $criteriaColumnName
-) {
- $common_functions = PMA_CommonFunctions::getInstance();
- $where_clause = '';
- // Columns to select
- $allColumns = PMA_DBI_get_columns($GLOBALS['db'], $table);
- $likeClauses = array();
- // Based on search type, decide like/regex & '%'/''
- $like_or_regex = (($criteriaSearchType == 4) ? 'REGEXP' : 'LIKE');
- $automatic_wildcard = (($criteriaSearchType < 3) ? '%' : '');
- // For "as regular expression" (search option 4), LIKE won't be used
- // Usage example: If user is seaching for a literal $ in a regexp search,
- // he should enter \$ as the value.
- $criteriaSearchString = $common_functions->sqlAddSlashes(
- $criteriaSearchString, ($criteriaSearchType == 4 ? false : true)
- );
- // Extract search words or pattern
- $search_words = (($criteriaSearchType > 2)
- ? array($criteriaSearchString) : explode(' ', $criteriaSearchString));
-
- foreach ($search_words as $search_word) {
- // Eliminates empty values
- if (strlen($search_word) === 0) {
- continue;
- }
- $likeClausesPerColumn = array();
- // for each column in the table
- foreach ($allColumns as $column) {
- if (! isset($criteriaColumnName)
- || strlen($criteriaColumnName) == 0
- || $column['Field'] == $criteriaColumnName
- ) {
- // Drizzle has no CONVERT and all text columns are UTF-8
- $column = ((PMA_DRIZZLE)
- ? $common_functions->backquote($column['Field'])
- : 'CONVERT(' . $common_functions->backquote($column['Field'])
- . ' USING utf8)');
- $likeClausesPerColumn[] = $column . ' ' . $like_or_regex . ' '
- . "'"
- . $automatic_wildcard . $search_word . $automatic_wildcard
- . "'";
- }
- } // end for
- if (count($likeClausesPerColumn) > 0) {
- $likeClauses[] = implode(' OR ', $likeClausesPerColumn);
- }
- } // end for
- // Use 'OR' if 'at least one word' is to be searched, else use 'AND'
- $implode_str = ($criteriaSearchType == 1 ? ' OR ' : ' AND ');
- if ( empty($likeClauses)) {
- // this could happen when the "inside column" does not exist
- // in any selected tables
- $where_clause = ' WHERE FALSE';
- } else {
- $where_clause = ' WHERE ('
- . implode(') ' . $implode_str . ' (', $likeClauses)
- . ')';
- }
- return $where_clause;
-}
-
-/**
- * Displays database search results
- *
- * @param array $criteriaTables Tables on which search is to be performed
- * @param string $searchTypeDescription Description for search type
- * @param string $criteriaSearchString The search word/phrase/regexp to be searched
- * @param integer $criteriaSearchType Type of search
- * (1 -> 1 word at least, 2 -> all words,
- * 3 -> exact string, 4 -> regexp)
- * @param string $criteriaColumnName Restrict the search to this column
- *
- * @return string HTML for search results
- */
-function PMA_dbSearchGetSearchResults($criteriaTables, $searchTypeDescription,
- $criteriaSearchString, $criteriaSearchType, $criteriaColumnName = null
-) {
- $html_output = '';
- // Displays search string
- $html_output .= '
'
- . '
'; - $html_output .= sprintf( - _ngettext( - 'Total: %s match', - 'Total: %s matches', - $num_search_result_total - ), - $num_search_result_total - ); - $html_output .= '
'; - } - return $html_output; -} - -/** - * Provides search results row with browse/delete links. - * (for a table) - * - * @param string $each_table Tables on which search is to be performed - * @param array $newsearchsqls Contains SQL queries - * @param bool $odd_row For displaying contrasting table rows - * - * @return string HTML row - */ -function PMA_dbSearchGetResultsRow($each_table, $newsearchsqls, $odd_row) -{ - $this_url_params = array( - 'db' => $GLOBALS['db'], - 'goto' => 'db_sql.php', - 'pos' => 0, - 'is_js_confirmed' => 0, - ); - $res_cnt = PMA_DBI_fetch_value($newsearchsqls['select_count']); - // Start forming search results row - $html_output = '