DBIx::C...BICompat(3)
๐ NAME ๐
okay so the module is DBIx::Class::CDBICompat โ Class::DBI Compatibility layer. This is the DBIx::C...BICompat(3) page from User Contributed Perl Documentation, and it's literally your lil' bridge from CDBI to DBIC. ๐ซถ
โจ SYNOPSIS โจ
package My::CDBI;
use base qw/DBIx::Class::CDBICompat/;
...continue as Class::DBI...
๐ธ DESCRIPTION ๐ธ
DBIx::Class features a fully featured compatibility layer with Class::DBI and some common plugins to ease transition for existing CDBI users. ๐
This is not a wrapper or subclass of DBIx::Class but rather a series of plugins. The result being that even though you're using the Class::DBI emulation layer you are still getting DBIx::Class objects. You can use all DBIx::Class features and methods via CDBICompat. This allows you to take advantage of DBIx::Class features without having to rewrite your CDBI code. ๐
๐ฆ Plugins ๐ฆ
CDBICompat is good enough that many CDBI plugins will work with CDBICompat, but many of the plugin features are better done with DBIx::Class methods. ๐
Class::DBI::AbstractSearchโsearch_where()is fully emulated using DBIC'ssearch. Aside from emulation there's no reason to usesearch_where(). โจClass::DBI::Plugin::NoCacheโ"nocache"is fully emulated. ๐Class::DBI::Sweetโ The features ofCDBI::Sweetare better done using DBIC methods which are almost exactly the same. ๐ฅClass::DBI::Plugin::DeepAbstractSearchโ This plugin will work, but it is more efficiently done using DBIC's native search facilities. The major difference is that DBIC will not infer the join for you, you have to tell it the join tables. ๐
๐ Choosing Features ๐
In fact, this class is just a recipe containing all the features emulated. If you like, you can choose which features to emulate by building your own class and loading it like this: ๐ง
package My::DB;
__PACKAGE__->load_own_components(qw/CDBICompat/);
this will automatically load the features included in My::DB::CDBICompat, provided it looks something like this: ๐
package My::DB::CDBICompat;
__PACKAGE__->load_components(qw/
CDBICompat::ColumnGroups
CDBICompat::Retrieve
CDBICompat::HasA
CDBICompat::HasMany
CDBICompat::MightHave
/);
๐ LIMITATIONS ๐
๐ Unimplemented ๐
The following methods and classes are not emulated, maybe in the future. ๐ญ
Class::DBI::Queryโ Deprecated inClass::DBI. ๐Class::DBI::Columnโ Not documented inClass::DBI. CDBICompat'scolumns()returns a plain string, not an object. ๐ซdata_type()โ Undocumented CDBI method. ๐
๐ Limited Support ๐
The following elements of Class::DBI have limited support. ๐
Class::DBI::Relationshipโ The semi-documentedClass::DBI::Relationshipobjects returned bymeta_info($type, $col)are mostly emulated except for theirargsmethod. ๐ธ- Relationships โ Relationships between tables (
has_a,has_many...) must be declared after all tables in the relationship have been declared. Thus the usual CDBI idiom of declaring columns and relationships for each class together will not work. They must instead be done like so: ๐จ
package Foo;
use base qw(Class::DBI);
Foo->table("foo");
Foo->columns( All => qw(this that bar) );
package Bar;
use base qw(Class::DBI);
Bar->table("bar");
Bar->columns( All => qw(up down) );
# Now that Foo and Bar are declared it is safe to declare a
# relationship between them
Foo->has_a( bar => "Bar" );
๐ฎ FURTHER QUESTIONS? ๐ฎ
Check the list of additional DBIC resources. ๐
๐ COPYRIGHT AND LICENSE ๐
This module is free software copyright by the DBIx::Class (DBIC) authors. You can redistribute it and/or modify it under the same terms as the DBIx::Class library. ๐โจ
mwah ๐ โ that's the whole page, bestie. You just read DBIx::C...BICompat(3), brought to you by perl v5.42.0 and dated 2025-01-22. periodt. ๐
๐ฆ where this page comes from
- opensuse-leap 16.0: perl-DBIx-Class 0.082844-bp160.1.10 ยท Artistic-1.0 OR GPL-1.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms