Wonderful Relation Queries:

In Wonderful Relations, a query is similar to an SQL query, but with some special features. Queries are a key part of the system and can become complex as the number of entities linked together increases.

In traditional development contexts, coding and creating queries can be time-consuming and can involve a workload that increases exponentially with the number of links. The Wonderful Relations concept uses this layer to allow users to query data from tables and present it as tables, making it easier to organize and access data.

How does it differ from a SQL Query?

One way in which Wonderful Relations differs from SQL is that it allows for the creation of subqueries, which can be reused in different contexts.

For example, you could create a query for projects and separate queries for managers and developers, and then use the person queries as subqueries in the project query. This allows for greater reusability of queries and makes it easier to join different queries based on the functionality of their links.

Cached queries are created only once and stored in the query table for future use, while base queries allow for the original table names to be used without any rewriting. This can be useful when you want to access a basic table without any modifications.

Parameters:

  • Project
  • Entity
  • Identifier
  • Cache Query
  • Base Query
  • Subtable Search
  • Description
  • Database Table
  • Where
  • Union
  • Fields
  • Subqueries
  • Joins
  • GroupBy
  • OrderBy
  • Having

Project:

Table:

Special cases: DUAL, VIEWS…

 

Entity:

To have a clear “view” we have to define what entity does a query return. This information is used for joins, etc…

Identifier:

This identifier is used to access query from php code.

 

Examples:

QueryExecutor::execute_query_by_identifier( 'identifier', $parameter );
QueryExecutor::execute_query_by_identifier_get_row( 'identifier', $parameter );

For deeper information, how to use Worderful Relations queries in your plugins, see the QueryBuilder / Executer documentation.

Cache Query

If you enable this option, the query will be build only once, and stored in the database. If a query is loaded, since we use a singlton pattern, it is also stored in ram, so it is only loaded once from database in a instance. 

 

DataTable Query:

The default in wonderful relation is to rename the field in every select like (v1,v2,v3,…). This allows us to join queries without thinking about uniquity of field names. In some cases, expecially when we use queries in code like in the example above, we want to have a “base” result, so column names should not change. So the most underlying queries are “base” queries. 

When enabled, subtables will be included in search. This forces the database to do all joins and perform search on the full result. If any subtable entry matches, the entry and all subtable entries will be shown. 

0
    0
    Your Cart
    Your cart is emptyReturn to Shop