Yet Another Database Abstraction Layer with PHP and DBALTraditionally, all database vendors provide their own interface tailored to dbal java products, which leaves it to the application programmer to implement code for all database interfaces he or she would like to support. Database abstraction layers reduce the amount of work by providing a consistent API to the developer and hide dbal java database specifics behind this interface as much as possible. There exist dbal java abstraction layers with different interfaces in numerous programming languages. If an application has such a layer built in, it is called database-agnostic. The lowest level connects to the database and performs the actual operations required by the users.
Database Abstraction Layer - Doctrine - PHP Database Tools
Traditionally, all database vendors provide their own interface tailored to their products, which leaves it to the application programmer to implement code for all database interfaces he or she would like to support. Database abstraction layers reduce the amount of work by providing a consistent API to the developer and hide the database specifics behind this interface as much as possible. There exist many abstraction layers with different interfaces in numerous programming languages.
If an application has such a layer built in, it is called database-agnostic. The lowest level connects to the database and performs the actual operations required by the users. At this level the conceptual instruction has been translated into multiple instructions that the database understands. Executing the instructions in the correct order allows the DAL to perform the conceptual instruction.
Implementation of the physical layer may use database specific APIs or use the underlying language standard database access technology and the database's version SQL. The conceptual level consolidates external concepts and instructions into an intermediate data structure that can be devolved into physical instructions. This layer is the most complex as it spans the external and physical levels. Additionally it needs to span all the supported databases and their quirks, APIs, and problems.
This level is aware of the differences between the databases and able to construct an execution path of operations in all cases. However the conceptual layer defers to the physical layer for the actual implementation of each individual operation. The external level is exposed to users and developers and supplies a consistent pattern for performing database operations.
Every database should be treated equally at this level with no apparent difference despite varying physical data types and operations. Libraries unify access to databases by providing a single low-level programming interface to the application developer. Their advantages are most often speed and flexibility because they are not tied to a specific query language subset and only have to implement a thin layer to reach their goal. As all SQL dialects are similar to one another, application developers can use all the language features, possibly providing configurable elements for a database-specific cases, such as, typically, user-IDs and credentials.
A thin-layer allows the same queries and statements to run on a variety of database products with a negligible overhead. Popular use for database abstraction layers are among object-oriented programming languages, which are similar to API-level abstraction layers. They also share advantages and disadvantages with API-level interfaces. An example of a database abstraction layer on the language level would be ODBC. ODBC is a platform-independent implementation of a database abstraction layer.
The user installs specific driver-software, through which ODBC can communicate with a database or set of databases. The user then has the ability to have programs communicate with ODBC, which then relays the results back and forth between the user programs and the database.
The downside of this abstraction level is the increased overhead to transform statements into constructs understood by the target database. Software developers only have to know the database abstraction layer's API instead of all APIs of the databases their application should support. The more databases should be supported the bigger is the time saving. Using a database abstraction layer means that there is no requirement for new installations to utilise a specific database, i.
A production database may be replaced with a desktop-level implementation of the data for developer-level unit tests. A DAL may use database programming facilities or other methods to create standard but unsupported functionality, or completely new functionality. For instance the DBvolution DAL implements the standard deviation function for several databases that do not support it.
Any abstraction layer will reduce the overall speed more or less depending on the amount of additional code that has to be executed. The more a database layer abstracts from the native database interface and tries to emulate features not present on all database backends, the slower the overall performance. This is especially true for database abstraction layers that try to unify the query language as well like ODBC. A database abstraction layer provides yet another functional dependency for a software system, i.
Database abstraction layers may limit the number of available database operations to a subset of those supported by the supported database backends. In particular, database abstraction layers may not fully support database backend-specific optimizations or debugging features. These problems magnify significantly with database size, scale, and complexity. From Wikipedia, the free encyclopedia. This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources.
Unsourced material may be challenged and removed. September Learn how and when to remove this template message. Data definition Data manipulation Query information retrieval.
Activity monitoring Audit Forensics Negative database. Entities and relationships and Enhanced notation Normalization Refactoring. Abstraction layer Object-relational mapping. Virtualization Tuning caching Migration Preservation Integrity. Retrieved from " https: Uses authors parameter Articles needing additional references from September All articles needing additional references. Views Read Edit View history.