most of the heavy lifting for a while anyway
- FilterColumn now passes data through when transformations
are not specified rather than throwing an exception.
+ - Use DBIx::Class::Storage::Debug::PrettyPrint when the
+ environment variable DBIC_TRACE_PROFILE is set, see
+ DBIx::Class::Storage for more information
* Fixes
- Fixed rels ending with me breaking subqueried limit realiasing
'MRO::Compat' => '0.09',
'Module::Find' => '0.06',
'Path::Class' => '0.18',
- 'SQL::Abstract' => '1.67',
+ 'SQL::Abstract' => '1.68',
'Sub::Name' => '0.04',
'Data::Dumper::Concise' => '1.000',
'Scope::Guard' => '0.03',
'namespace::clean' => '0.14',
'Math::BigInt' => '1.89',
'Math::Base36' => '0.07',
+ 'Config::Any' => '0.20',
};
# this is so we can order requires alphabetically
bless $new, $self;
$new->set_schema($schema);
- $new->debugobj(new DBIx::Class::Storage::Statistics());
-
- #my $fh;
+ my $debugobj;
+ if (my $profile = $ENV{DBIC_TRACE_PROFILE}) {
+ require DBIx::Class::Storage::Debug::PrettyPrint;
+ if ($profile =~ /^\.?\//) {
+ require Config::Any;
+ my $cfg = Config::Any->load_files({ files => [$profile], use_ext => 1 });
+
+ my ($filename, $config) = %{$cfg->[0]};
+ $debugobj = DBIx::Class::Storage::Debug::PrettyPrint->new($config)
+ } else {
+ $debugobj = DBIx::Class::Storage::Debug::PrettyPrint->new({ profile => $profile })
+ }
+ } else {
+ $debugobj = DBIx::Class::Storage::Statistics->new
+ }
+ $new->debugobj($debugobj);
my $debug_env = $ENV{DBIX_CLASS_STORAGE_DBI_DEBUG}
|| $ENV{DBIC_TRACE};
to this environment variable will not take effect unless you also
re-connect on your schema.
+=head2 DBIC_TRACE_PROFILE
+
+If C<DBIC_TRACE_PROFILE> is set, L<DBIx::Class::Storage::PrettyPrint>
+will be used to format the output from C<DBIC_TRACE>. The value it
+is set to is the C<profile> that it will be used. If the value is a
+filename the file is read with L<Config::Any> and the results are
+used as the configuration for tracing. See L<SQL::Abstract::Tree/new>
+for what that structure should look like.
+
+
=head2 DBIX_CLASS_STORAGE_DBI_DEBUG
Old name for DBIC_TRACE
--- /dev/null
+{"indent_string":"frioux"}
+
--- /dev/null
+use strict;
+use warnings;
+use lib qw(t/lib);
+use DBICTest;
+use Test::More;
+
+BEGIN { delete @ENV{qw(DBIC_TRACE_PROFILE)} }
+
+{
+ my $schema = DBICTest->init_schema;
+
+ isa_ok($schema->storage->debugobj, 'DBIx::Class::Storage::Statistics');
+}
+
+{
+ local $ENV{DBIC_TRACE_PROFILE} = 'console';
+
+ my $schema = DBICTest->init_schema;
+
+ isa_ok($schema->storage->debugobj, 'DBIx::Class::Storage::Debug::PrettyPrint');;
+ is($schema->storage->debugobj->_sqlat->indent_string, ' ', 'indent string set correctly from console profile');
+}
+
+{
+ local $ENV{DBIC_TRACE_PROFILE} = './t/lib/awesome.json';
+
+ my $schema = DBICTest->init_schema;
+
+ isa_ok($schema->storage->debugobj, 'DBIx::Class::Storage::Debug::PrettyPrint');;
+ is($schema->storage->debugobj->_sqlat->indent_string, 'frioux', 'indent string set correctly from file-based profile');
+}
+
+done_testing;