SQLScout >

SQL Editor

SQLScout's SQL editor provides a complete set of features that you need from an IDE: syntax highlighting, code completion, navigation to schema and alias definition, and much more.

  1. Editor types
  2. Code completion
  3. Executing SQL statements
  4. Navigation to tables and columns in the SQLite Explorer
  5. Function documentation

1. Editor types

SQLScout provides 2 types of SQL editors: in-memory and file-based.

In-memory SQL Editors

The contents of an in-memory SQL editor are not in a physical file, but in-memory. The main benefit of in-memory editors is they can be opened quickly: just click the "Open SQL Editor" action ( ) in the SQLite Explorer's toolbar or context menu. Editor functions like code completion and SQL statement execution will work based on the Data Source selected in the SQLite Explorer.

Figure 1. In-memory SQL Editor

Please note that the contents of in-memory SQL editors are not preserved between IDE sessions. You can save the editor's contents to disk by clicking the "Save" action ( ) on the editor's toolbar (see figure 1).

File-based SQL Editors

This type of SQL editor handles files with extension sql.

Figure 2. File-based SQL Editor

By default, file-based SQL editors are not associated with any Data Source from the SQLite Explorer.

Editor functions like code completion and SQL statement execution will work based on the selected Data Source. You can select a Data Source from the drop-down on the editor's toolbar (see figure 2).

If the editor does not have a selected Data Source, editor functions will work based on all Data Sources in the SQLite Explorer.

2. Code Completion

SQLScout's SQL editor offers different types of context-aware code completion: keyword completion, database object completion and function name completion.

Keyword Completion

SQLScout's keyword completion is based on how SQLite understands SQL. The editor only suggests keywords based on the type of SQL statement and the cursor position within a SQL statement. In the example below (figure 3), SQLScout only suggests the keywords that can go after the tables names in a FROM clause, in a SELECT statement.

Figure 3. 'Keyword' Completion

Keyword completion supports INSERT, UPDATE, DELETE and SELECT statements.

Database Object Completion

The SQL editor suggests names of columns and tables based on the editor's Data Source and the the cursor position within a SQL statement. In the example below (figure 4), SQLScout only suggests the columns in the table specified in the INSERT statement.

Figure 4. 'Column' Completion

Code completion also understands table aliases. In the example below (figure 5), SQLScout only suggests the columns in the table with alias "alias".

Figure 5. Table alias-aware 'Column' Completion
Function Completion

The SQL editor suggest SQLite-specific function names where appropriate (e.g. where expressions are allowed in a SQL statement). Code completion supports SQLite's core functions, date & time functions, and aggregate functions.

Figure 6. 'Function' Completion

3. Executing SQL Statements

Executing a SQL statement is as easy as selecting the statement in the editor (or placing the caret at the end of the statement) and clicking the "Execute statement" action ( ) on the editor's toolbar. To execute multiple SQL statements, simply select them in the editor and click "Execute statement".

Figure 7. Executing a SQL Statement

The result of the statement execution will appear in the Data Console.

4. Navigating

When writing a SQL statement, it can be handy to navigate to the definition of a table or column, and see its structure. SQLScout supports navigation to the database schema from the SQL editor to the SQLite Explorer.

To perform navigation, you can do one of the following:

  1. Place the cursor within the name of a table or column and select the action "Go To | Declaration" from the context menu
  2. Press and hold the Ctrl (Windows/Linux) or Command (MacOS) keys, and point to a table or column, then click on the hyperlink.

Figure 8. Navigating to Table Definition

5. Function Documentation

The SQL editor provides "quick documentation" for SQLite functions (core, date & time, and aggregate).

The "quick documentation" pop-up includes a hyperlink to the online documentation.

Figure 9. Function Documentation