diff --git a/ChangeLog b/ChangeLog index cfc843c24..1b99f20ff 100755 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,9 @@ $Id$ $Source$ 2003-03-12 Garvin Hicking + * db_details_structure.php, left.php3, tbl_properties_links.php3, libraries/bookmark.lib.php3: + RFE #550552: Change default initial query for browse mode, if a bookmark with the same + label as the tablename is found. * tbl_properties_options.php3, tbl_properties_table_info.php3: Support changing auto_increment value. (RFE #639655) * db_printview.php3, tbl_printview.php3, db_datadict.php3, pdf_schema.php3: diff --git a/db_details_structure.php3 b/db_details_structure.php3 index fc2f43109..4e6e575bb 100644 --- a/db_details_structure.php3 +++ b/db_details_structure.php3 @@ -129,9 +129,12 @@ else if (PMA_MYSQL_INT_VERSION >= 32303) { ' . $strBrowse . ''; } else { echo $strBrowse; diff --git a/left.php3 b/left.php3 index 1f046cab4..58f6ee336 100755 --- a/left.php3 +++ b/left.php3 @@ -25,6 +25,7 @@ if ($cfg['OBGzip']) { } } +include('./libraries/bookmark.lib.php3'); require('./libraries/relation.lib.php3'); $cfgRelation = PMA_getRelationsParam(); @@ -247,9 +248,11 @@ if ($num_dbs > 1) { : ''; echo "\n"; + + $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label'); ?> - + <?php echo $strBrowse . ': ' . $url_title; ?> 
@@ -280,7 +283,9 @@ if ($num_dbs > 1) { ? str_replace('"', '"', $tooltip_name[$table]) : ''; - $table_list .= ' ' . "\n"; + $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label'); + + $table_list .= ' ' . "\n"; $table_list .= ' ' . $strBrowse . ': ' . $url_title . ' ' . "\n"; if (PMA_USR_BROWSER_AGENT == 'IE') { $table_list .= ' ' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '
' . "\n"; @@ -408,9 +413,11 @@ else if ($num_dbs == 1) { $url_title = (!empty($tooltip) && isset($tooltip[$table])) ? str_replace('"', '"', $tooltip[$table]) : ''; + $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label'); + echo "\n"; ?> - + <?php echo $strBrowse . ': ' . htmlspecialchars($table); ?> 
diff --git a/libraries/bookmark.lib.php3 b/libraries/bookmark.lib.php3 index 914d5db4c..a071c5e67 100644 --- a/libraries/bookmark.lib.php3 +++ b/libraries/bookmark.lib.php3 @@ -81,24 +81,25 @@ if (!defined('PMA_BOOKMARK_LIB_INCLUDED')) { * * @param string the current database name * @param array the bookmark parameters for the current user - * @param integer the id of the bookmark to get + * @param mixed the id of the bookmark to get + * @param string which field to look up the $id * * @return string the sql query * * @access public */ - function PMA_queryBookmarks($db, $cfgBookmark, $id) + function PMA_queryBookmarks($db, $cfgBookmark, $id, $id_field = 'id') { $query = 'SELECT query FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table']) . ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\'' - . ' AND id = ' . $id; + . ' AND ' . PMA_backquote($id_field) . ' = ' . $id; if (isset($GLOBALS['dbh'])) { $result = PMA_mysql_query($query, $GLOBALS['dbh']); } else { $result = PMA_mysql_query($query); } - $bookmark_query = PMA_mysql_result($result, 0, 'query'); + $bookmark_query = @PMA_mysql_result($result, 0, 'query') OR FALSE; return $bookmark_query; } // end of the 'PMA_queryBookmarks()' function diff --git a/tbl_properties_links.php3 b/tbl_properties_links.php3 index 35bd2d9a0..419df0bd6 100755 --- a/tbl_properties_links.php3 +++ b/tbl_properties_links.php3 @@ -18,10 +18,13 @@ $db_details_links_count_tabs = 0; /** * Prepares links */ +include('./libraries/bookmark.lib.php3'); +$book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label'); + if ($table_info_num_rows > 0) { $lnk2 = 'sql.php3'; $arg2 = $url_query - . '&sql_query=' . urlencode('SELECT * FROM ' . PMA_backquote($table)) + . '&sql_query=' . (isset($book_sql_query) && $book_sql_query != FALSE ? urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table))) . '&pos=0'; $lnk4 = 'tbl_select.php3'; $arg4 = $url_query;