The 3rd generation of
DBIx::DataModel
has just
been
published to CPAN.
DBIx::DataModel
is an object-relational mapping (ORM) framework for building Perl abstractions
(classes, objects and methods) that interact with relational database
management systems. It provides facilities for generating SQL queries, joining
tables automatically, navigating through the results, converting values, assembling
complex datastructures and packaging the results in various formats.Some of its
strong points are :
- centralized, UML-style declaration of tables and relationships
(instead of many files with declarations such as 'has_many', 'belongs_to',
etc.)
- limited coupling with the database schema : there is no need to
declare every column of every table; DBIx::DataModel only needs to know about
tables, associations, primary keys and foreign keys
- exposure of database operations like joins, bulk updates, subqueries,
etc. The database is not hidden behind object-oriented programming concepts, as
some other ORMs try to do, but rather made to explicitly collaborate with the
object-oriented layer.
- efficiency through a very lightweight infrastructure and through fine tuning of
interaction with the DBI layer (prepare/execute, fetch into reusable memory
location, etc.)
- usage of SQL::Abstract::More
for an improved API over SQL::Abstract
(named parameters, additional clauses, simplified 'order_by', support for
values with associated datatypes, etc.)
- clear conceptual distinction between:
- data sources (tables and joins),
- database statements (stateful objects representing stepwise
building of an SQL query and stepwise retrieval of results),
- data rows (lightweight hashrefs containing nothing but column
names and values)
- simple syntax for joins, with the possibility to override default
INNER JOIN/LEFT JOIN properties, and with clever usage of Perl multiple
inheritance for simultaneous access to the methods of all tables that
participate in that join
- nested, cross-database transactions
- choice between 'single-schema' mode (default, more economical)
and 'multi-schema' mode (optional, more flexible, but a little more costly in
memory)
- detailed documentation exposing not only the surface API but also the internal architecture and design principles
Initially published in 2005,
DBIx::DataModel
had a 1
st refactoring
in 2008 and a 2
nd refactoring in 2011. Novelties brought by this 3
rd
refactoring of 2018 are :
- architectural simplification : suppression of the ConnectedSource class
- new extensible
architecture for result kinds produced by calls to select().
Builtin result kinds include various datastructure and file formats ; applications
can easily plug additional result kinds.
- facilities for
switching between several database schemas within the same database connection
- method do_after_commit()
for registering coderefs to be executed after the end of the outermost
transaction.
- option join_with_USING
for generating joins of shape « Table1 JOIN Table 2 USING (common_key) »
- restructuring
of the update()
method for easier extension by application subclasses
- complete revision of the documentation
WOW just what I was looking for. Came here by searching for %meta_keyword%
ReplyDelete