OQL.Delphi Introduction

OQL.Delphi is a strong-typed database object query language. The difference between OQL.Delphi and SQL or other OQL lies in OQL.Delphi is based on native Delphi language instead of on strings.

OQL.Delphi is well designed. Without installing a plug-in, you can get precise and proper context tip while writing OQL through IDE. OQL.Delphi can guide user to write out correct and compatible database query statements step by step.

OQL.Delphi is complete object-oriented and strong-typed database query language. The OQL query statements you write will be compiled together with your program. Thus, during compiling OQL.Delphi can help you find the errors in the query statements, instead of picking them up with great difficulty at the runtime. If the schema of a database is changed, you can regenerate the query classes with Macrobject CodeAuto (a code generator) etc., and as you compile the program again, the compile-time errors will tell you which OQL statements need to be altered.

OQL.Delphi supports many kinds of databases. While switching between databases, it is not necessary to change the source code or recompile it.

OQL.Delphi can help reduce over 80% of the working time spent in writing query statements, and 95% of the time in debugging them. Further more, it will lose nothing of the performance.

With OQL.Delphi, you can divide a database schema into several sub-schemas, which will help you to assign tasks and applications. The mapping mechanism offered by OQL.Delphi also allows developers to rename the data objects and their properties with much more simple and understandable names, which makes the codes more legible.

OQL.Delphi is based on the style of cascading statements in native language. It is so legible that it is as good as the original SQL statement. OQL.Delphi supports dividing long query statements into small parts and extracting the common parts, which is similar to the refactoring function (e.g. Extracting subfunction). Thereby it is much easier to read and maintain.

OQL.Delphi is compatible with SQL-92 standard. It supports all the major elements of SQL DML, including select, insert, update and delete statements, and select, from, join, on, where, group by, having, order by and case clauses.

The SQL statements generated by OQL.Delphi are precise and well formatted. All SQL statements in this tutorial are generated through OQL.Delphi at the runtime, without any manual work.

More information will be given in the following chapters. A simple sample is as below:

var

  qryCustomerId : ISelectQuery;

  criteria : IQueryCondition;

  customer : ICustomer;

begin

  qryCustomerId := TSelectQuery.Create;

  qryCustomerId

    .Select(NW.Order.CustomerID)

    .From(NW.Order)

    .Where( OQL.Criteria(NW.Order.ShipCity).EQ('Macrobject City') );

 

  criteria := OQL.Criteria(NW.Customer.CustomerID).In_( qryCustomerId );

 

  customer := TCustomer.GetByCriteria(ObjectManager, criteria)

end;

Related Topics

OQL.Delphi Tutorial