The Query window

In Chapter 3, we discussed the purpose of this window, and the procedure for changing some parameters (such as dimensions). This window can easily be opened from the navigation panel using the SQL icon or the Query window link, as shown in the following screenshot, and is very convenient for entering a query and testing it:

The Query window

The following screenshot shows the Query window that appears over the main panel:

The Query window

The window seen in the screenshot contains the same Columns selector and<< button as that used in a Table view context. This distinct Query window is a feature supported only on JavaScript-enabled browsers.

Query window options

The SQL tab is the default active tab in this window. This comes from the configuration directive $cfg['QueryWindowDefTab'], which contains sql by default.

If we want another tab to be the default active tab, we can replace sql with files or history. Another value, full, shows the contents of all the three tabs at once.

In the Query window, we see a checkbox for the Do not overwrite this query from outside the window choice. Normally, this checkbox is selected. If we deselect it, the changes we make while generating queries are reflected in the Query window. This is called synchronization. For example, choosing a different database or table from the navigation or main panel would update the Query window accordingly. However, if we start to type a query directly in this window, the checkbox will get checked in order to protect its contents and remove synchronization. This way, the query composed here will be locked and protected.

Session-based SQL history

This feature collects all the successful SQL queries we execute as PHP session data, and modifies the Query window to make them available. This default type of history is temporary, as $cfg['QueryHistoryDB'] is set to FALSE by default.

Database-based SQL history (permanent)

As we installed the phpMyAdmin configuration storage (refer to Chapter 1), a more powerful history mechanism is available. We should now enable this mechanism by setting $cfg['QueryHistoryDB'] to TRUE.

After we try some queries from one of the query boxes, a history is built, visible only from the Query window as shown in the following screenshot:

Database-based SQL history (permanent)

We see (in the reverse order) the last successful queries and the database on which they were made. Queries typed only from the query box are kept in this history, along with queries generated by phpMyAdmin (such as those generated by clicking on Browse).

They are clickable for immediate execution, and the Change icon is available to insert a recorded query into the query box for editing.

The number of queries that will be kept is controlled by $cfg['QueryHistoryMax'], which is set to 25 by default. This limit is not kept for performance reasons, but as a practical limit in order to achieve a visually unencumbered view. Extra queries are eliminated at login time in a process traditionally called garbage collection. The queries are stored in the table configured in $cfg['Servers'][$i]['history'].

Editing queries

On the results page of a successful query, a header containing the executed query appears as shown in the following screenshot:

Editing queries

Clicking on Edit opens the Query window's SQL tab, with this query ready to be modified. This happens because of the following default setting for this parameter:

$cfg['EditInWindow'] = TRUE;

When it is set to FALSE, a click on Edit will not open the Query window; instead, the query will appear inside the query box of the SQL page.

Clicking on Inline replaces the displayed query by a text area where it's possible to edit and submit this query, without leaving the current results page.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.146.221.144