Consolidate last_insert_id handling with a fallback-attempt on DBI::last_insert_id
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Componentised.pm
CommitLineData
75d07914 1package # hide from PAUSE
c0e7b4e5 2 DBIx::Class::Componentised;
227d4dee 3
bf5ecff9 4use strict;
5use warnings;
6
48a76fcf 7use base 'Class::C3::Componentised';
d38cd95c 8use Carp::Clan qw/^DBIx::Class|^Class::C3::Componentised/;
9use mro 'c3';
10
11# this warns of subtle bugs introduced by UTF8Columns hacky handling of store_column
12sub inject_base {
13 my $class = shift;
14 my $target = shift;
15
16 my @present_components = (@{mro::get_linear_isa ($target)||[]});
17
18 no strict 'refs';
19 for my $comp (reverse @_) {
7146f619 20
21 if ($comp->isa ('DBIx::Class::UTF8Columns') ) {
22 require B;
23 my @broken;
24
25 for (@present_components) {
26 my $cref = $_->can ('store_column')
27 or next;
28 push @broken, $_ if B::svref_2object($cref)->STASH->NAME ne 'DBIx::Class::Row';
29 }
30
d38cd95c 31 carp "Incorrect loading order of $comp by ${target} will affect other components overriding store_column ("
32 . join (', ', @broken)
7146f619 33 .'). Refer to the documentation of DBIx::Class::UTF8Columns for more info'
34 if @broken;
d38cd95c 35 }
7146f619 36
37 unshift @present_components, $comp;
d38cd95c 38 }
39
40 $class->next::method($target, @_);
41}
efe6365b 42
227d4dee 431;