Softerra LDAP Administrator Help | Show AllHide All |
The LDAP-SQL Query dialog allows you to perform various operations on LDAP servers using the SQL language.
To launch the LDAP-SQL Query dialog:
Connect to your LDAP server.
Click the LDAP-SQL Query button on the Entry toolbar.
- or -
Select LDAP-SQL Query from the Entry sub-menu of the main menu.
To execute an SQL statement, enter its text in the SQL Editor (located in the upper part of the dialog), and press the Run button on the toolbar. The results of the query execution will be displayed under the SQL Editor window.
SQL Editor is a window where you enter and edit your SQL queries. SQL Editor can contain several SQL statements separated by semicolon (;), however, only one statement can be executed at a time.
SQL Editor provides many useful features designed to help you create and edit the code of SQL statements, including:
In order to make reading and writing of LDAP-SQL statements an easy process, SQL Editor supports syntax coloring based on the LDAP-SQL dialect. All reserved words, operators, functions, constants, etc. have their own color, which simplifies the identification of elements in the code and makes the text much more readable.
To accelerate the process of LDAP-SQL programming, SQL Editor provides autocompletion capabilities. IntelliSense detects what part of SQL statement is editing and, based on the SQL format, suggests you with a list of possible SQL keywords, attribute names, functions, operators and other strings that can be inserted into the statement. The IntelliSense window opens automatically, when you type first characters of the keyword that can occur in the current context. You can force the IntelliSense window to show by using the Ctrl+Enter shortcut or selecting the IntelliSense command from the SQL Editor’s context menu.
When writing SQL statements, often you may need to insert the DN of the entry that must be modified or from which the search must be started. To do so, from the SQL Editor's context menu, select Browse for DN... to call up a dialog that allows you to find the entry you need. This dialog can be opened by using the Ctrl+B shortcut. You can also find the required entry in the Scope Pane or ListView Pane and insert it's DN by dragging and dropping this entry to the proper place in the SQL Editor.
These functions allow you to easily correct mistakes, as well as free you to experiment with different text editing options. Undo reverses the last action you performed, and Redo undoes the last Undo action. You can call Undo/Redo using the SQL Editor's context menu or using the keyboard shortcuts inside SQL Editor (Ctrl+Z for Undo and Ctrl+Y for Redo).
SQL Editor provides you with Find and Replace dialogs, making it easy to find the string you need in the SQL Editor or replace a string with another one. These dialogs allow you to specify several options that can be used to customize your search or replacement operations. Find/Replace dialogs also support regular expressions that allow you to search for text using patterns. See Regular Expressions for Find and Replace for more details.
The SQL Output window collects messages generated during the execution of SQL statements. There are three types of messages that can be produced: Error, Warning and Information. With the help of the corresponding buttons on the SQL Output toolbar, you can select what message types shall be displayed in the SQL Output window.
If an LDAP-SQL statement contains a syntax error, then an attempt to run this statement will produce an error message containing information about the type and location of the error in the code. To quickly move to the error location, double-click the error message or select this message and choose the Locate in source command from the context menu.
Some SQL Output messages may contain additional information associated with them. To display this information, double-click the corresponding message or select this message and either press the View Details button on the SQL Output toolbar or choose this command from the context menu.
After the execution of an LDAP-SQL statement (except for the SELECT statement), a message with the detailed information about the statement execution is added to the SQL Output window. By double-clicking this message, you can view detailed information about all modified or deleted entries as well as about errors encountered during the processing of the statement.
The execution of the SELECT statement performs a search for entries in accordance with the criteria specified. In this case, all found entries are displayed in the Search Results window that becomes active if the SELECT statement is executed. After the search is over, you can work with your search results in the same way as you work with entries in the List View pane: they can be renamed, deleted, modified, exported, added to the Basket, etc.
You can switch between the Search Results and SQL Output windows by clicking the Search Results/SQL Output button located in the bottom of the dialog. |
In some cases, when you need to execute an UPDATE or DELETE statement, you may want to make sure that the execution of this statement entails the modification or removal of the appropriate LDAP entries. To avoid the creation of the certain SELECT statement for finding entries that will be updated or deleted, put cursor on the current UPDATE or DELTE statement and select the Run Search Query command from the SQL Editor's context menu. The execution of this command will show you all LDAP entries that will be updated or deleted.
The LDAP-SQL Query dialog allows you to view the history of all executed SQL statements. To view the history, click the Show History... button on the LDAP-SQL Query toolbar. In the dialog that appears, you can see the list of all executed SQL statements with the information about the time and the server this statement has been executed on. If you select an item in the list, you will see the whole SQL statement in the preview window below the history list. To insert the SQL statement stored in the history into the LDAP-SQL Query dialog, select it in the list and click OK or double-click it.
Any item in the history dialog can be pinned. If a history item is pinned, then this item is shown in the beginning of the list each time the dialog opens. |
The toolbar contains basic commands needed to work with LDAP-SQL Query.
Run
Starts the execution of the current SQL statement.
Stop
Stops the execution of the current SQL statement.
Open...
Opens a file and loads its content to the SQL Editor.
Save As...
Saves the entire SQL Editor code to a file.
Find...
Displays a dialog box that allows you to specify a string to search for.
Replace...
Displays a dialog box that lets you specify a string to search for and a replacement string.
Show History...
Displays a dialog box that lets you see all previously executed SQL
statements and easily insert them into the SQL Editor.