SQLite Maestro online Help
Prev | Return to chapter overview | Next |
SQL Editor
SQL Editor is a tool for creating and executing SELECT queries. It allows you to create and edit SQL text for the query, prepare and execute queries, and view the results of execution. To open SQL Editor, select the Tools | SQL Editor main menu item. The most popular query management actions (creating, editing, deleting) are covered by the corresponding topic.
To use the editor for working with several queries, open new query tab with the Create new query link on the Navigation bar. With the tabs’ popup menu you can create a new query, close existing one, save the query to profile, etc even if editor's navigation bar is closed. Queries' tabs can been displayed at the all sides of the editor (bottom, top, left or right).
For more information about query executing and working with query result see the corresponding topic.
The popup menu of the editing area provides you with standard operations for working with text such as Cut (Ctrl+X), Copy (Ctrl+C), Paste (Ctrl +V), Undo (Ctrl+Z), Redo (Shift+Ctrl+Z) along with a possibility to convert selected text to different cases (lower, UPPER, and NameCase).
You can also comment/uncomment selected text (Shift+Ctrl+. and Shift+Ctrl+, shortcuts respectively). If no text is selected, the whole line will be commented. By the way, it is not necessary to select commented text to uncomment it, just press Shift+Ctrl+, having the cursor inside the commented text. Both kinds of comments (single-line and multi-line) are supported. SQL Formatter is also at your disposal.
SQL Editor allows you to use Visual Query Builder modal instance to design query visually and load the result query text directly in the editor area. For this purpose use the Design query link of the editor area's popup menu. |
SQLite Maestro provides you with code completion (as on the screen below) to select from a list of tables, columns, views, or other objects without having to manually enter the object's name in the editor. You can activate the completion list by pressing the Ctrl+Space key combination. |
Database objects are highlighted in the text. You can open the proper object editor by clicking the object name in the text with the Ctrl key pressed or with the Find Object link on the Navigation bar. To adjust the highlighting settings, use SQL highlight options. |
Lines of code that have been edited during the current session are indicated with a yellow line in the left margin of the editor. When you save the file, the yellow markers turn green. Thus at any time, yellow markers show changed but unsaved lines of code, and green markers show changes in this session that have been saved. |
Use find and replace to search for, and optionally, replace text in the SQL Editor. To open Find text/Replace text window, use Edit | Find/Replace main menu item, corresponding link of popup menu, or Ctrl+F/Ctrl+H shortcut. You can also use the Search again link to apply recent Find text dialog. |
SQL Editor supports the explicit transaction management. You can execute queries either in autocommit mode (default behavior) or manage transactions manually. In the second case you have to issue the BEGIN TRANSACTION statement to start a transaction and explicitly end the transaction by COMMIT or ROLLBACK statements (it is also possible to use the corresponding links at the editor's navigation bar). |
Using SQL Editor you can execute the PRAGMA command, that is not a part of SQL standard. The PRAGMA command is a special command used to modify the operation of the SQLite library or to query the library for internal (non-table) data. Using the PRAGMA command you can set the auto-vacuum flag in the database, change the maximum number of database disk pages that SQLite will hold in memory simultaneously, change the count-changes flag, etc. |
To load query from .sql file, use the corresponding link on the Navigation bar. You can also find there links allowing you to save query text to file, export the contents of the editor to RTF and HTML formats (to file or to clipboard), copy the selected text from to clipboard as a ready-to-use string written in one of the following programming languages: C#, C++, Delphi (Object Pascal), and Java, and also print/preview the contents of the editor. |
See also: Visual Query Builder, SQL Script Editor, SQL Editor Options