1 package DBIx::Class::Storage::DBI::Replicated::WithDSN;
6 requires qw/_query_start/;
10 DBIx::Class::Storage::DBI::Replicated::WithDSN - A DBI Storage Role with DSN
11 information in trace output
15 This class is used internally by L<DBIx::Class::Storage::DBI::Replicated>.
19 This role adds C<DSN: > info to storage debugging output.
23 This class defines the following methods.
25 =head2 around: _query_start
27 Add C<DSN: > to debugging output.
31 around '_query_start' => sub {
32 my ($method, $self, $sql, @bind) = @_;
34 my $dsn = (try { $self->dsn }) || $self->_dbi_connect_info->[0];
36 my($op, $rest) = (($sql=~m/^(\w+)(.+)$/),'NOP', 'NO SQL');
37 my $storage_type = $self->can('active') ? 'REPLICANT' : 'MASTER';
40 if ((Scalar::Util::reftype($dsn)||'') ne 'CODE') {
41 "$op [DSN_$storage_type=$dsn]$rest";
43 elsif (my $id = try { $self->id }) {
44 "$op [$storage_type=$id]$rest";
47 "$op [$storage_type]$rest";
51 $self->$method($query, @bind);
56 L<DBIx::Class::Storage::DBI>
60 John Napiorkowski <jjnapiork@cpan.org>
64 You may distribute this code under the same terms as Perl itself.