Active Query Builder  »  Blog

March 14, 2018

Domain-specific language API to define SQL queries

We are working on the possibility to define SQL queries in a domain-specific language. This will allow for typesafe SQL construction, database object referencing through the generated database schema classes like the following:

sql = DSL.query
      , SqlExpression.Count(Orders.OrderId)
            .On(Orders.OrderId == Customers.CustomerId)
        .And("1 < 2")

So, when the database schema will be changed, the programmer can re-generate the code of your database schema classes and get compilation errors in case invalid objects or fields are used in queries defined via DSL API.

Consider a situation when programmers have to define lots of SQL queries for reports, analytics and similar tasks an save them as string resources. Changing the schema may lead to a situation when some queries become invalid, and the only way to check for this is to run that report. If they were defined via such DSL API, the programmer will be notified about the problem at compile time.

Would you be really interested in using such API in your projects?

We'll be grateful for your feedback.

at ActiveDBSoft.
» All Active Query Builder news

Comments by Disqus:




Join Types

Automatic Joins Creation
Active Query Builder automatically determines relationships between tables and creates appropriate joins for them.

Different Join Types
Active Query Builder allows to define different join types and various server-specific query options visually.

Unions and Sub-queries

Unions and Sub-Queries
Unions, sub queries and derived tables can be accessed and built visually in Active Query Builder as easy as the main query.

Grouping, Sorting and Criteria
Active Query Builder allows to define grouping, sorting, and constructing criteria in a simple and direct way.

Active Query Builder Screenshots

Social networks