1DBIx::Class::CDBICompatU(s3e)r Contributed Perl DocumentaDtBiIoxn::Class::CDBICompat(3)
2
3
4
6 DBIx::Class::CDBICompat - Class::DBI Compatibility layer.
7
9 package My::CDBI;
10 use base qw/DBIx::Class::CDBICompat/;
11
12 ...continue as Class::DBI...
13
15 DBIx::Class features a fully featured compatibility layer with
16 Class::DBI and some common plugins to ease transition for existing CDBI
17 users.
18
19 This is not a wrapper or subclass of DBIx::Class but rather a series of
20 plugins. The result being that even though you're using the Class::DBI
21 emulation layer you are still getting DBIx::Class objects. You can use
22 all DBIx::Class features and methods via CDBICompat. This allows you
23 to take advantage of DBIx::Class features without having to rewrite
24 your CDBI code.
25
26 Plugins
27 CDBICompat is good enough that many CDBI plugins will work with
28 CDBICompat, but many of the plugin features are better done with
29 DBIx::Class methods.
30
31 Class::DBI::AbstractSearch
32
33 "search_where()" is fully emulated using DBIC's search. Aside from
34 emulation there's no reason to use "search_where()".
35
36 Class::DBI::Plugin::NoCache
37
38 "nocache" is fully emulated.
39
40 Class::DBI::Sweet
41
42 The features of CDBI::Sweet are better done using DBIC methods which
43 are almost exactly the same.
44
45 Class::DBI::Plugin::DeepAbstractSearch
46
47 This plugin will work, but it is more efficiently done using DBIC's
48 native search facilities. The major difference is that DBIC will not
49 infer the join for you, you have to tell it the join tables.
50
51 Choosing Features
52 In fact, this class is just a recipe containing all the features
53 emulated. If you like, you can choose which features to emulate by
54 building your own class and loading it like this:
55
56 package My::DB;
57 __PACKAGE__->load_own_components(qw/CDBICompat/);
58
59 this will automatically load the features included in
60 My::DB::CDBICompat, provided it looks something like this:
61
62 package My::DB::CDBICompat;
63 __PACKAGE__->load_components(qw/
64 CDBICompat::ColumnGroups
65 CDBICompat::Retrieve
66 CDBICompat::HasA
67 CDBICompat::HasMany
68 CDBICompat::MightHave
69 /);
70
72 Unimplemented
73 The following methods and classes are not emulated, maybe in the
74 future.
75
76 Class::DBI::Query
77 Deprecated in Class::DBI.
78
79 Class::DBI::Column
80 Not documented in Class::DBI. CDBICompat's columns() returns a
81 plain string, not an object.
82
83 data_type()
84 Undocumented CDBI method.
85
86 Limited Support
87 The following elements of Class::DBI have limited support.
88
89 Class::DBI::Relationship
90 The semi-documented Class::DBI::Relationship objects returned by
91 "meta_info($type, $col)" are mostly emulated except for their
92 "args" method.
93
94 Relationships
95 Relationships between tables (has_a, has_many...) must be declared
96 after all tables in the relationship have been declared. Thus the
97 usual CDBI idiom of declaring columns and relationships for each
98 class together will not work. They must instead be done like so:
99
100 package Foo;
101 use base qw(Class::DBI);
102
103 Foo->table("foo");
104 Foo->columns( All => qw(this that bar) );
105
106 package Bar;
107 use base qw(Class::DBI);
108
109 Bar->table("bar");
110 Bar->columns( All => qw(up down) );
111
112 # Now that Foo and Bar are declared it is safe to declare a
113 # relationship between them
114 Foo->has_a( bar => "Bar" );
115
117 Check the list of additional DBIC resources.
118
120 This module is free software copyright by the DBIx::Class (DBIC)
121 authors. You can redistribute it and/or modify it under the same terms
122 as the DBIx::Class library.
123
124
125
126perl v5.34.0 2021-07-22 DBIx::Class::CDBICompat(3)