The OQL Query Browser provides you with a graphical interface to easily execute your OQL queries. It provides an interface where you can parse and execute your OQL queries and get its corresponding SQL statements and results. This enables you to easily see the exact SQL statements, which are being executed against the project's database.
The OQL Query Browser dialog can be opened via the OpenAccess -> OQL Query Browser menu command. The dialog is shown on the image below:
||Before using the OQL Query Browser dialog, the project needs to be compiled.|
The following operations can be done in the OQL Query Browser:
- Open Query File (Ctrl+O) () - it is possible for you to write frequently used queries in a file, generally a text (.txt) file or a query (.qry) file, and then open that file by clicking on the "open" icon. All the queries written in the file will be displayed in the top/first section of the dialog, as it is shown on the image above.
- Save Query in File (Ctrl+S) () - it is also possible to write queries directly in the top/first section of the dialog, and then save these queries to a file for future use. The queries are saved generally into a text (.txt) file or a query (.qry) file by clicking on the "save" icon.
- Parse Query and show SQL (F5) () - if you just want to parse the OQL query and generate the corresponding SQL string, without executing it against the project's database, click on this icon. The SQL string generated will be shown in the middle/second section of the dialog, as it is shown on the image above.
- Execute Query and show result (Ctrl+F5) () - if you want to execute the query against the project's database, and see the result, click on this icon. In this case, the OQL string is parsed, its corresponding SQL is generated in the middle/second section of the dialog and the result is shown in the bottom/third section of the dialog, as it is shown on the image above.
- Display Persistent Model () - by clicking on this icon, a tree-view of the persistent model used in your project will be displayed, i.e. all the persistent classes along with their fields are displayed. The field name along with its type is displayed, as shown on the image below:
||It is possible to drag a class/field name from the persistent model into the query string builder. For e.g., if you need to query for all the Customers, you can just drag the Customers class from the persistent model, which appears on the right-side of the dialog, as shown on the image above, and place it before Extent to complete the query string.|
- Open Help Window (F1) () - by clicking on this icon, this help file will be displayed.