RemObjects Software Gears
| @PDC | Home | Products | Trials | Shop | Support | About |

RemObjects AnyDAC 2.0

Universal High Performance Data Access for Delphi

     
AnyDAC Architecture Unified API

AnyDAC Facts

AnyDAC provides high-performance native database access for Delphi and Free Pascal applications to a wide range of back-end database systems.

AnyDAC 2.0 Overview

AnyDAC is a unique set of universal Data Access Components for developing cross-database applications on CodeGear Delphi, C++Builder and Free Pascal. With its powerful common architecture AnyDAC enables native high-speed access to all major database systems.

Based on 10 years of experience writing drivers for specific database back-ends, AnyDAC was built as powerful access layer that supports all that the features needed to to build real-world high-load applications. It provides a common API for accessing different database back ends, without giving up access to unique database-specific features, or compromising on performance.

Whether working with Data Abstract or building single/two-tier applications with direct database access, AnyDAC provides optimized access to your back-end data that uses the native interfaces provided by the various database engines for best possible speed and flexibility.

AnyDAC Core Features

Features provided by AnyDAC include:

  • Native access to SQL Server, Oracle, DB2, InterBase, MySQL and more.
  • Generic access to any database supported through Borland DBX and ODBC data sources.
  • Unified API for access to cross-database features. (More)
  • First-class support for many database-specific features. (More)
  • Unique ADO.NET-like data engine for Win32. (More)
  • Optimized for best possible performance. (More)
  • Advanced Data Access Options. (More)
  • Full support for international applications, including full Unicode support in Delphi 2009 and later.
  • Cross-platform support though Free Pascal (FPC).
  • Perfect integration as back-end driver for Data Abstract™ for Delphi

More detailed product features are described in our wiki.

Supported Databases

The following database types are supported natively*:

  • Enterprise – Oracle, Microsoft SQL Server, DB2
  • Workgroup – Interbase, Firebird, MySQL, SQL Anywhere
  • Desktop – MSAccess, BlackFish SQL
  • Bridges – DbExpress, ODBC
  • Currently as Tech Preview – SQLite, PostgreSQL

You can read more about supported database types on our AnyDAC Database Connectivity Wiki page.

Benefits of Choosing AnyDAC

  • AnyDAC is the fruit of 10 years experience in developing real-world database applications.
  • AnyDAC enables the developer to concentrate on developing the application – not the complexities of database interaction.
  • AnyDAC provides a feature-rich set of components to address all major RDBMS environments
  • AnyDAC uses one set of components to address all supported RDBMS types.

AnyDAC Architecture

The following picture shows the unique architecture of AnyDAC enables native high-speed access to all major database systems.

The developer will typically use the AnyDAC components provided in the higher COMP and GUIx layers. This strict layer concept does allow AnyDAC to switch the target DBMS of your application without code changes.

In contrast to than other high-level abstraction layers such as DBX, OLEDB or ADO, AnyDAC supports high performance commands as Array DML, unified SQL dialect abstraction, embedded servers and a lot more database-specific features.

Unified API for access to cross-database features

AnyDAC provides a range of features that help abstract the differences between database types, making it easy to write code that does not have to be concerned about different database system dialects or other subtle differences between database types.

Data Type Unification

AnyDAC may return a different data type for a table column depending on the data type returned by DBMS being accessed. For example, the data type for field type NUMBER(10,0) in Oracle is ftFMTBcd, and for field type INT in MSSQL it is ftInteger. So, when a single application supports databases with different DBMS’s, it must be aware of this issue.

AnyDAC allows you to set up a data mapping schema for each connection, to unify data types for the application. As a side benefit, this helps when migrating the application from other DAC's to AnyDAC.

For example, the set up for an Oracle connection to recognize all NUMBER(10,0) as ftInteger:

with ADConnection1.FormatOptions do begin OwnMapRules := True; with MapRules.Add do begin SourceDataType := dtFmtBCD; PrecMin := 10; PrecMax := 10; ScaleMin := 0; ScaleMax := 0; TargetDataType := dtInt32; end; end;

SQL dialect abstraction

If the application needs to support multiple DBMS’s, then it must be aware that their SQL dialects may be different.

AnyDAC escape sequences allow you to write SQL dialect independent SQL commands.

For example, the function to convert string to upper case is different in MySQL, Oracle and MSSQL. But the following command will work on any DBMS:

SELECT {ucase(Name)} FROM MyTable

In more complex cases, parts of the command or even the full command must be written differently. Then, the AnyDAC conditional escape sequence will help:

{if Oracle} SELECT * FROM OracleTab {fi} {if MSSQL} SELECT * FROM MSSQLTab {fi}

Support for multiple SQL script dialects

Most database applications have backend administration utilities, which must execute SQL script. These scripts are written using lines appropriate to the DBMS SQL script syntax.

TADScript is the AnyDAC SQL script processor. It has many advantages over standard utilities, like the ability to be completely integrated into the AnyDAC application and the ability to extend the set of commands by custom script commands. The TADScript component is aware of several industry standard SQL script syntaxes, including:

  • Oracle SQL*Plus
  • Microsoft ISQL
  • MySQL mysql.exe / mysqldump.exe
  • Interbase ISQL

So, AnyDAC allows the developer to implement flexible backend administration solutions using the appropriate SQL script syntax.

Efficient update command generation

When the database application calls dataset methods like Insert / Edit / Post / Delete, then the data access components must generate SQL commands updating data. This process must be aware of database identity fields, sequences, triggers, special data types (Oracle BLOB / CLOB / BFILE), pessimistic locking commands, etc.

The AnyDAC SQL commands generator is aware of these DBMS features and generates the most effective SQL command, depending on the current connection DBMS. This reduces the number of cases where the developer must use hand made SQL commands.

For example, when posting a new record to an Oracle table, where one field is filled by a trigger from a sequence and another one is of BLOB type, AnyDAC will generate the SQL command:

INSERT INTO OracleTab (NAME, DT, IMAGE) VALUES (:NEW_NAME, :NEW_DT, EMPTY_BLOB()) RETURNING :NEW_ID, :NEW_IMAGE

Unified error reporting

In general, different DBMS’s will return different errors for logically the same error. But the database application must recognize certain types of backend errors, like an unique key constraint violation. It is best if this recognition is not dependent on the DBMS kind.

AnyDAC combines unification and "personalization" of exception objects that drivers raise for errors. Personalization means that each driver has its own exception class, which contains all the information that the DBMS client software API returns. Unification means that all driver exception classes are inherited from a single base class that contains driver independent information.

For example, code for handling a unique key violation may look like this:

try ADQuery1.ExecSQL('insert into MyTab(code, name)'+ 'values (:code, :name)', [100, 'Berlin'’]); except on E: EADDBEngineException do begin if E.Kind = ekUKViolated then ShowMessage('Please enter unique value !'); raise; end; end;

Quoted Identifiers Awareness

Some database applications use national and/or special characters in the object names. Also, some object names may be case sensitive. Depending on the DBMS SQL dialect in use, such names must be quoted using special quotation characters.

AnyDAC provides complete support for quoted names, including meta information retrieval, object name parsing and object name escape sequences.

For example, the following code sample uses object name escape sequences to write an SQL command, independent of the DBMS SQL dialect's quotation rules:

SELECT * FROM {id My Table}

Unified Transaction Support

Many DBMS’s have different transaction options, behavior and control API. For example, the Interbase DBMS has a very powerful transaction control API, but other DBMS’s, like Oracle or Microsoft SQL Server have a much more compact control API. While for Interbase a transaction must be explicitly started to perform any SQL command, for MySQL it is optional.

AnyDAC offers a unified API for transaction control, allowing you to employ the full power of Interbase to execute SQL commands together with minimal explicit transaction control for other DBMS’s.

For example, the TADQuery component has Transaction and UpdateTransaction properties. The developer can set the Transaction property pointing to a read-only transaction and the UpdateTransaction property to a read-write transaction, which is the approach needed for Interbase database application development.