Matthew Simon Cavalletto


DBIx::DBO2::Docs::Comparison - Entry for poop-comparison


Numerous modules on CPAN provide some type of system to map objects to and from SQL databases, including Class::DBI, Alzabo, and Tangram.

Dave Rolsky and the Poop-Group discussion list have assembled a very useful comparison of several such CPAN modules at

For comparison purposes, this document reviews some of the points of comparison used by the Poop-Group summary and their answers for this module.


  • DBIx::DBO2

     Author:         M. Simon Cavalletto <>
     Latest Version: 0.005 - March 24th, 2002
     First Release:  25th January 2002

Supported databases

Any database supported by one of the following: DBD::AnyData, DBD::CSV, DBD::MySQL, and DBD::Pg.

Providing support for other drivers involves creating a DBD-specific subclass of DBIx::SQLEngine (which will be loaded via DBIx::AnyDBD when appropriate), and should only require a limited amount of coding.

SQL Abstraction

This module supports moderately complex selects, inserts, updates, and deletes, based on the DBIx::SQLEngine abstraction layer. It is possible to apply order by and group by clauses to operations, as well as limits.

Inserts with sequences are supported, with DBIX::SQLEngine providing a workaround using its own sequence table logic for DBDs which don't have native sequence/auto_increment equivalents.

The base Record class does not support joins, although the underlying DBIx::SQLEngine does, and it is possible to provide your own query logic in a subclass.

Invalid SQL

The automated SQL generation should produce valid SQL, but if you pass in incorrect information, such as explicitly requesting a column name which does not exist in the database, or if you pass in a SQL snippet as part of a query, there is no way to validate this prior to actually executing the query and receiving an error from the DBMS.

Deferred/Preloaded data retrieval

There is not yet any way to defer the loading of given columns for a select. However, it always possible to easily specify only those columns which are needed at a given point in your code. (Deferred loading of additional columns is expected in an upcoming release.)

Table Relationships

DBIx::DBO2 supports both many-to-one (foreign key) and one-to-many (reverse foreign key) relationships. Support for one-to-many relationships includes your choice of cascading delete, nullify after delete, and restrict delete rules. You can establish relationships between classes regardless of whether their data is actually stored in the same underlying SQL database.

Multiple rows and cursors

DBIx::DBO2 currently returns multiple rows all at once. A RecordSet object similar to a cursor is used but it does not yet handle incremental retrieval. (Support for cursors and automatic iteration with closures is expected in an upcoming release.)


There is no built in caching support. (Support for LRU caching and ensuring that there is only a single instance of a given object in memory at any time are both expected in an upcoming release.)


DBIx::DBO2 does not support transactions. (Basic transactions for DBDs which support them are expected in an upcoming release.)

Auto-generated methods

The included DBIx::DBO2::Fields package can generate a wide variety of methods, including customized accessors for each type of field or relationship. (These currently require explicit declarations, but support for automatic detection of database columns and subsequent method generation is expected in an upcoming release.)


The documentation for this module is still fairly rough, although efforts are continuing to improve this.


GPL/Artistic disjunction. The same as Perl itself.


Support for this module is available from the author ( (The author is also available for support contracts or consulting engagements.)


Actively developed and supported by the author. Recently released to CPAN after several years of in-house use, including current use on several e-commerce sites.


A callback mechanism allows you to specify method names or arbitrary subroutines to be called immediately before or after each record is retrieved, inserted, updated, or deleted. You can add these callbacks to all record classes, to a particular class, or even to a particular object instance.

The method-generator code leverages this capability; for example, declaring a one-to-many relationship using the "line_items --cascade_delete" option both declares a delete_items method, and adds that method to the "post_delete" callback so that it will be called when the main record is deleted.


See DBIx::DBO2 for an overview of this framework.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 62:

'=item' outside of any '=over'

Around line 66:

You forgot a '=back' before '=head2'