A query is a precise request for information retrieval from an information storage system of some type. When working with Morfik we will be primarily referring to database queries which are generally expressed in the form of a SQL language expression. A query specifies exactly what information the user wants to retrieve from the database in order to fulfill the intended purpose of the application being built. This is done by specifying which fields from which tables the user needs to retrieve and under which set of conditions (Parameters).

In Morfik queries are first class citizens within your project and are independently displayed in the Project View. Within the Morfik development environment we use the Query Designer to create queries either visually or through the pass-through SQL editor which allows you to directly enter any valid SQL statements.


Query Designer

The Query Designer is a specialized part of the Morfik development environment which allows you to define queries for usage in your application, either visually or by writing SQL language statements.

In its Design View, the Query Designer strives to provide as easy an interface for the creation of queries as possible. In Code View, the Query Designer allows you to directly enter any SQL language statement which is valid for the target database. Read More...


Query List in Project View

Once you have created Queries within your project you will be able to see them directly in the Project View of the Morfik development environment. All Queries appear as icons in the Project View, as there wouldn't be much benefit from showing a thumbnail for them and are grouped in a section.

queries-list.png
Figure 1: List of Queries section of the Project View within the Morfik development environment.

Stored Queries

Once the queries are created they can be used to link interface elements to actual data in the database without the developer having to insert SQL command strings in the applications interface code. In this respect, Morfik treats the stored queries in just the same way it does tables.

Having Queries as independent elements within the project is significant as it makes it much easier to reuse the same query in more than on situation. Most development tools only treat actual database elements in this manner, making you type in SQL code while you are designing your interface. By putting Queries in the same category as Tables Morfik treats all your possible data sources in a single consistent manner.

Flexibility

Queries provide a lot of flexibility to your interface design work as they allow you to receive in one data source information that has been gathered from several different Tables. For advanced database users Queries can be even more powerful as they can be combined with Stored Procedures giving them even more flexibility in regards to what data they can aggregate for you to display through the application's interface.