-尊龙登录

.. _bookmarks: bookmarks ========= .. note:: you need to have configured the :ref:`linked-tables` for using bookmarks feature. storing bookmarks ----------------- any query that is executed can be marked as a bookmark on the page where the results are displayed. you will find a button labeled :guilabel:`bookmark this query` just at the end of the page. as soon as you have stored a bookmark, that query is linked to the database. you can now access a bookmark dropdown on each page where the query box appears on for that database. variables inside bookmarks -------------------------- inside a query, you can also add placeholders for variables. this is done by inserting into the query sql comments between ``/*`` and ``*/``. the special string ``[variable{variable-number}]`` is used inside the comments. be aware that the whole query minus the sql comments must be valid by itself, otherwise you won't be able to store it as a bookmark. also, note that the text 'variable' is case-sensitive. when you execute the bookmark, everything typed into the *variables* input boxes on the query box page will replace the strings ``/*[variable{variable-number}]*/`` in your stored query. also remember, that everything else inside the ``/*[variable{variable-number}]*/`` string for your query will remain the way it is, but will be stripped of the ``/**/`` chars. so you can use: .. code-block:: mysql /*, [variable1] as myname */ which will be expanded to .. code-block:: mysql , variable1 as myname in your query, where variable1 is the string you entered in the variable 1 input box. a more complex example, say you have stored this query: .. code-block:: mysql select name, address from addresses where 1 /* and name like '%[variable1]%' */ if you wish to enter "phpmyadmin" as the variable for the stored query, the full query will be: .. code-block:: mysql select name, address from addresses where 1 and name like '%phpmyadmin%' **note the absence of spaces** inside the ``/**/`` construct. any spaces inserted there will be later also inserted as spaces in your query and may lead to unexpected results especially when using the variable expansion inside of a "like ''" expression. browsing a table using a bookmark --------------------------------- when a bookmark has the same name as the table, it will be used as the query when browsing this table. .. seealso:: :ref:`faqbookmark`, :ref:`faq6_22`
网站地图