PhpStorm 2021.3 Help

Database

The Database section contains database and SQL settings.

The settings in this section relate to showing various information in database consoles.

Item

Description

When inside statement execute

If the cursor is inside a statement, perform the following actions:

  • Ask what to execute: display a popup where you can select what part of a statement or statements to execute.

    Ask what to execute
  • Smallest statement: execute the smallest statement from the script. For example, when the cursor is inside a subquery, the subquery is executed.

  • Largest statement: execute the largest statement from the script. For example, when the cursor is inside a subquery, an outer statement is executed.

  • Largest statement or batch: execute the largest statement or a batch of statements from the script. For Transact-SQL (SQL Server and Sybase), the current batch of statements is executed. For all other dialects, the same as the previous option.

  • Whole script: execute the whole script.

  • Everything from caret: execute everything below the caret.

otherwise execute

If the cursor is outside of a statement (for example, on a blank line or within a comment), perform one of the following actions:

  • Nothing: stop execution.

  • Whole script: execute the whole script.

  • Everything below caret: execute everything below the caret.

for selection execute

If the code is selected (highlighted), perform one of the following options:

  • Exactly as one statement: execute exactly what is selected as a single statement.

  • Exactly as separate statements: execute exactly what is selected. If the selection contains more than one statement, the statements are executed as separate statements.

  • Smart expand to script: expand a selection to form a sequence of valid statements. For example, if there is at least one statement border within the selection, the selection is expanded to form a sequence of valid statements. This sequence is then executed. Otherwise, execute what is selected.

Open results in new tab

You can select to view query results on individual tabs, or on one and the same tab. For the single tab, the tab is updated for each query.

Select the checkbox to create a new tab with query results each time you run the SELECT query. Using this approach, you can keep results of all the queries that you have run.

Show results on individual tabs

If the checkbox is cleared, the same tab is used to show query results. Information on the tab is updated to show the result.

Update tab for query results

In this case, when you get the result that you want to keep, you can pin the tab to the tool window (Pin button) on the toolbar or Pin Tab in the context menu for the tab).

Pin the result tab

Split a script for execution in Generic and ANSI SQL dialects

Set the query parsing for unsupported databases that use SQL:2016 or Generic dialects. The Generic dialect differs from SQL:2016 in error highlighting. In the Generic dialect, all found errors are not highlighted.

  • Into valid ANSI SQL statements or by separator: PhpStorm analyzes a script and splits it on valid statements or by separators. This setting is default.

  • Into ANSI SQL statements: split scripts according to the SQL:2016 grammar.

  • By statement separator: extract and run statements by separators. For the Generic dialect, the separator is a semicolon.

Show Services tool window for query console output

Define in what situations to display the Services tool window.

  • For all output: any output that is generated appear in the Services tool window. That is result sets, errors in the log, query output (for example, DBMS_OUTPUT), and other log texts generated by the IDE. The IDE log texts might look as follows:

    ex: [2021-06-03 14:55:34] 1 row retrieved starting from 1 in 131 ms (execution: 8 ms, fetching: 123 ms)
  • For query output, errors, and result sets: when the result set is received, when there are errors in the log, and for the output that users generate by issuing queries. For example, this query output may be Errors and Messages in PostgreSQL or DBMS_OUTPUT in Oracle.

  • For errors and result sets: when the result set is received or when there are errors in the log. Errors are usually displayed as red notifications at the bottom of the IDE.

  • For result sets: when the result set is received. For example, when you run SELECT * from table_name.

  • Never: never display the Services tool window.

Show output results in editor

Display results of the query that you run under the query in the editor, not in the results pane of the Services tool window.

The following screenshot shows the results when the checkbox is selected.

When the checkbox is cleared, the results are in the Services tool window.

Open new Services tab for sessions

Create a new tab for a data source sessions and output results.

Enabled

Disabled

Activate Services output pane for selected query console only

Stay on the output pane of the selected query console in the Services tool window.

If this checkbox is cleared, the focus will switch to the node of the query console in the Services tool window that finished processing of a query.

For example, you have two query consoles: console_1 and console_2. In console_1, you have a large list of INSERT statements that is running. But you also issue some queries in the console_2. If the checkbox is cleared, each time PhpStorm finishes the INSERT statement from console_1, the IDE displays the output pane of console_1 in the Services tool window. If the checkbox is selected, the output pane of console_2 is shown.

Consider the following videos with pg_sleep.

Enabled

Disabled

In the Services tool window, the focus stays on console though console_1 finished query execution earlier.

In the Services tool window, the focus shifts from console to console_1 as console_1 finished query execution earlier. And then again to console because now the query is finished in this query console.

Review parameters before execution

When you run a statement with parameters, PhpStorm saves parameter values in memory. Select this checkbox and next time you execute the statement, PhpStorm will show you the last used parameter values. You can change them before running the statement.

Clear this checkbox and PhpStorm will execute the statement immediately without showing you the parameter values.

Track databases/schemas creation and deletion

When you create, delete, or rename a schema, PhpStorm updates the list of available schemas in the introspection scope window. To see the introspection scope, click the button near the data source name in the Database tool window.

Track databases/schemas creation and deletion

Show warning before running potentially unsafe queries

Select to display warnings for potentially unsafe queries.

If you forgot to put the WHERE clause in DELETE and UPDATE statements, PhpStorm displays a notification to remind you about that. If you omitted the WHERE clause intentionally, you can execute current statements as you planned.

Notification when you run DELETE and UPDATE without WHERE

Show timestamp for query output

Show timestamps for query output. By default, timestamps are hidden.

Enabled

Disabled

timestamps for query output
timestamps for query output

Create title for results from comment before query

You can define a tab title in the comment section before the query. In the Treat text as title after field, you can reserve a combination of symbols or characters, and any text after this combination will be treated as a tab title. By default, no combination is used, so any text after -- or /* is treated as a tab title.

To disable this feature, open settings Ctrl+Alt+S, navigate to Tools | Database | General, and clear the Create title for results from comment before query checkbox.

Open settings by pressing Ctrl+Alt+S, navigate to Tools | Database | General.

In the Treat text as title after field, define a combination for tab titles.

Use custom titles for tabs with results

Other

Item

Description

Show first N data rows in preview

Limit number of rows for a quick documentation popup. To see quick documenation, press Ctrl+Q.

Always show qualified names for database objects in tab titles

Adds a schema name to the table name for the tab. If the checkbox is selected, double-click the table in the Database tool window to see a qualified tab name.

On

Off

On
Off

Confirm cancellation for dialogs that modify schema

Show a confirmation dialog when you close Add Database, Add Schema, Create New Table, or Modify Table dialogs. Close means clicking Cancel or pressing Escape. If the checkbox is cleared, the dialog closes instantly.

Confirm cancellation for dialogs that modify a schema

Skip database refactoring preview

Skip the Object Migration dialog if changes in the object's source code are valid.

By default, the Object Migration dialog is displayed to confirm changes that you make to source code in objects. For example, if you modify code in a routine or a view and press Submit, you will see the Object Migration dialog with your changes highlighted.

Skip database refactoring preview
Last modified: 08 November 2021