@@ -1,5 +1,24 @@
Revision history for DBIx-Class-Helpers
+2.023005 2014-08-10 11:05:27-05:00 America/Chicago
+ - Fix ::Row::SelfResultSet to correctly include CSA (Thanks Steve Kleiman!)
+
+2.023004 2014-08-01 18:27:54-05:00 America/Chicago
+ - Fix implementation of ::Row::SelfResultSet (fixes GH#34, thanks ribasushi for
+ the heads up!)
+
+2.023003 2014-07-21 21:22:27-05:00 America/Chicago
+ - Fix ToJSON to use accessors if it needs to (Thanks Kevin Benson!)
+ - Fix silly typo in ::Explain (Good catch Jonathan W. Taylor!)
+
+2.023002 2014-06-28 15:04:15-05:00 America/Chicago
+ - Remove silly layer of subtesting (thanks to new features in Test::Roo)
+ - Remove silly sub wrapper in Explain internals (should moderately increase
+ performance)
+
+2.023001 2014-06-14 12:39:08-05:00 America/Chicago
+ - Add handy SYNOPSIS to ::DateMethods1 (thanks for asking rjbs!)
+
2.023000 2014-05-26 19:33:01-05:00 America/Chicago
- Add ::Shortcut::Explain RS helper
@@ -1,4 +1,4 @@
-# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.017.
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.019.
CONTRIBUTING
Changes
LICENSE
@@ -86,12 +86,14 @@ t/lib/TestSchema/Result/Foo.pm
t/lib/TestSchema/Result/Foo_Bar.pm
t/lib/TestSchema/Result/Gnarly.pm
t/lib/TestSchema/Result/Gnarly_Station.pm
+t/lib/TestSchema/Result/HasAccessor.pm
t/lib/TestSchema/Result/HasDateOps.pm
t/lib/TestSchema/Result/Station.pm
t/lib/TestSchema/ResultSet.pm
t/lib/TestSchema/ResultSet/Bloaty.pm
t/lib/TestSchema/ResultSet/Foo.pm
t/lib/TestSchema/ResultSet/Gnarly.pm
+t/lib/TestSchema/ResultSet/HasAccessor.pm
t/lib/TestSchema/ResultSet/HasDateOps.pm
t/lib/TestSchema/ResultSet/Station.pm
t/release-pod-syntax.t
@@ -4,7 +4,7 @@
"Arthur Axel \"fREW\" Schmidt <frioux+cpan@gmail.com>"
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Zilla version 5.017, CPAN::Meta::Converter version 2.140640",
+ "generated_by" : "Dist::Zilla version 5.019, CPAN::Meta::Converter version 2.141170",
"license" : [
"perl_5"
],
@@ -48,7 +48,7 @@
"Test::Deep" : "0",
"Test::Exception" : "0",
"Test::More" : "0.94",
- "Test::Roo" : "0"
+ "Test::Roo" : "1.003"
}
}
},
@@ -64,6 +64,6 @@
"web" : "https://github.com/frioux/DBIx-Class-Helpers"
}
},
- "version" : "2.023000"
+ "version" : "2.023005"
}
@@ -8,11 +8,11 @@ build_requires:
Test::Deep: '0'
Test::Exception: '0'
Test::More: '0.94'
- Test::Roo: '0'
+ Test::Roo: '1.003'
configure_requires:
ExtUtils::MakeMaker: '6.30'
dynamic_config: 0
-generated_by: 'Dist::Zilla version 5.017, CPAN::Meta::Converter version 2.140640'
+generated_by: 'Dist::Zilla version 5.019, CPAN::Meta::Converter version 2.141170'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -36,4 +36,4 @@ resources:
bugtracker: https://github.com/frioux/DBIx-Class-Helpers/issues
homepage: https://github.com/frioux/DBIx-Class-Helpers
repository: https://github.com/frioux/DBIx-Class-Helpers.git
-version: '2.023000'
+version: '2.023005'
@@ -1,5 +1,5 @@
-# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.017.
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.019.
use strict;
use warnings;
@@ -40,9 +40,9 @@ my %WriteMakefileArgs = (
"Test::Deep" => 0,
"Test::Exception" => 0,
"Test::More" => "0.94",
- "Test::Roo" => 0
+ "Test::Roo" => "1.003"
},
- "VERSION" => "2.023000",
+ "VERSION" => "2.023005",
"test" => {
"TESTS" => "t/*.t t/resultset/*.t t/resultset/date-methods-1/*.t t/resultset/shortcut/*.t t/row/*.t t/schema/*.t"
}
@@ -65,7 +65,7 @@ my %FallbackPrereqs = (
"Test::Deep" => 0,
"Test::Exception" => 0,
"Test::More" => "0.94",
- "Test::Roo" => 0,
+ "Test::Roo" => "1.003",
"Try::Tiny" => 0,
"namespace::clean" => "0.23",
"parent" => 0
@@ -15,7 +15,7 @@ requires 'Safe::Isa';
on test => sub {
requires 'Test::More' => 0.94;
requires 'Test::Deep' => 0;
- requires 'Test::Roo' => 0;
+ requires 'Test::Roo' => 1.003;
requires 'DBD::SQLite' => 0;
requires 'Test::Exception' => 0;
requires 'DateTime::Format::SQLite' => 0;
@@ -2,7 +2,9 @@ name = DBIx-Class-Helpers
author = Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
license = Perl_5
copyright_holder = Arthur Axel "fREW" Schmidt
-version = 2.023000
+version = 2.023005
+
+; authordep Pod::Weaver::Plugin::Exec
[NextRelease]
[@Git]
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::IgnoreWantarray;
-$DBIx::Class::Helper::IgnoreWantarray::VERSION = '2.023000';
+$DBIx::Class::Helper::IgnoreWantarray::VERSION = '2.023005';
use parent 'DBIx::Class::Helper::ResultSet::IgnoreWantarray';
use Carp::Clan;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::JoinTable;
-$DBIx::Class::Helper::JoinTable::VERSION = '2.023000';
+$DBIx::Class::Helper::JoinTable::VERSION = '2.023005';
use parent 'DBIx::Class::Helper::Row::JoinTable';
use Carp::Clan;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::Random;
-$DBIx::Class::Helper::Random::VERSION = '2.023000';
+$DBIx::Class::Helper::Random::VERSION = '2.023005';
use parent 'DBIx::Class::Helper::ResultSet::Random';
use Carp::Clan;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::AutoRemoveColumns;
-$DBIx::Class::Helper::ResultSet::AutoRemoveColumns::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::AutoRemoveColumns::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::CorrelateRelationship;
-$DBIx::Class::Helper::ResultSet::CorrelateRelationship::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::CorrelateRelationship::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::DateMethods1;
-$DBIx::Class::Helper::ResultSet::DateMethods1::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::DateMethods1::VERSION = '2.023005';
# ABSTRACT: Work with dates in your RDBMS nicely
use strict;
@@ -429,6 +429,35 @@ __END__
DBIx::Class::Helper::ResultSet::DateMethods1 - Work with dates in your RDBMS nicely
+=head1 SYNOPSIS
+
+ package MySchema::ResultSet::Bar;
+
+ use strict;
+ use warnings;
+
+ use parent 'DBIx::Class::ResultSet';
+
+ __PACKAGE__->load_components('Helper::ResultSet::DateMethods1');
+
+ # in code using resultset
+
+ # get count per year/month
+ $rs->search(undef, {
+ columns => {
+ count => '*',
+ year => $rs->dt_SQL_pluck({ -ident => '.start' }, 'year'),
+ month => $rs->dt_SQL_pluck({ -ident => '.start' }, 'month'),
+ },
+ group_by => [
+ $rs->dt_SQL_pluck({ -ident => '.start' }, 'year'),
+ $rs->dt_SQL_pluck({ -ident => '.start' }, 'month'),
+ ],
+ });
+
+ # SQLite
+ (SELECT "me".*, STRFTIME('%m', "me"."start"), STRFTIME('%Y', "me"."start") FROM "HasDateOps" "me" GROUP BY STRFTIME('%Y', "me"."start"), STRFTIME('%m', "me"."start"))
+
=head1 DESCRIPTION
See L<DBIx::Class::Helper::ResultSet/NOTE> for a nice way to apply it
@@ -965,7 +994,7 @@ for what units are accepted.
year => $rs->dt_SQL_pluck({ -ident => '.start' }, 'year'),
},
group_by => [$rs->dt_SQL_pluck({ -ident => '.start' }, 'year')],
- )->hri->all
+ })->hri->all
Takes two arguments: a date conforming to L</TYPES> and a unit. The idea
is to pluck a given unit from the datetime. See your L</IMPLEMENTATION>
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::Explain;
-$DBIx::Class::Helper::ResultSet::Explain::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::Explain::VERSION = '2.023005';
use strict;
use warnings;
@@ -76,7 +76,7 @@ DBIx::Class::Helper::ResultSet::Explain - Get query plan for a ResultSet
This module mostly makes sense to be used without setting as a component:
- ues Devel::Dwarn;
+ use Devel::Dwarn;
Dwarn DBIx::Class::ResultSet::Explain::explain($rs)
But as usual, if you prefer to use it as a component here's how:
@@ -223,7 +223,7 @@ to your entire schema.
"Transaction",
0,
0,
- 14,
+ 15,
0,
"01",
undef
@@ -254,31 +254,15 @@ to your entire schema.
[
[
- "Seq Scan on \"Gnarly\" me (cost=0.00..16.20 rows=620 width=100) (actual time=0.003..0.003 rows=0 loops=1)"
+ "Seq Scan on \"Gnarly\" me (cost=0.00..16.20 rows=620 width=100) (actual time=0.001..0.001 rows=0 loops=1)"
],
[
- "Total runtime: 0.056 ms"
+ "Total runtime: 0.021 ms"
]
]
=head2 mysql
- [
- [
- 1,
- "SIMPLE",
- "me",
- "ALL",
- undef,
- undef,
- undef,
- undef,
- 1,
- "100.00",
- ""
- ]
- ]
-
=head1 AUTHOR
Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::IgnoreWantarray;
-$DBIx::Class::Helper::ResultSet::IgnoreWantarray::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::IgnoreWantarray::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::Me;
-$DBIx::Class::Helper::ResultSet::Me::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::Me::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::NoColumns;
-$DBIx::Class::Helper::ResultSet::NoColumns::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::NoColumns::VERSION = '2.023005';
# ABSTRACT: Look ma, no columns!
use strict;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::Random;
-$DBIx::Class::Helper::ResultSet::Random::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::Random::VERSION = '2.023005';
use strict;
use warnings;
@@ -12,11 +12,11 @@ sub _introspector {
my $d = use_module('DBIx::Introspector')
->new(drivers => '2013-12.01');
- $d->decorate_driver_unconnected(ACCESS => rand_sql => sub { 'RND()' });
- $d->decorate_driver_unconnected(Oracle => rand_sql => sub { 'dbms_random.value' });
- $d->decorate_driver_unconnected(Pg => rand_sql => sub { 'RANDOM()' });
- $d->decorate_driver_unconnected(MSSQL => rand_sql => sub { 'NEWID()' });
- $d->decorate_driver_unconnected(SQLite => rand_sql => sub { 'RANDOM()' });
+ $d->decorate_driver_unconnected(ACCESS => rand_sql => 'RND()' );
+ $d->decorate_driver_unconnected(Oracle => rand_sql => 'dbms_random.value' );
+ $d->decorate_driver_unconnected(Pg => rand_sql => 'RANDOM()' );
+ $d->decorate_driver_unconnected(MSSQL => rand_sql => 'NEWID()' );
+ $d->decorate_driver_unconnected(SQLite => rand_sql => 'RANDOM()' );
$d
}
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::RemoveColumns;
-$DBIx::Class::Helper::ResultSet::RemoveColumns::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::RemoveColumns::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::ResultClassDWIM;
-$DBIx::Class::Helper::ResultSet::ResultClassDWIM::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::ResultClassDWIM::VERSION = '2.023005';
# ABSTRACT: result_class => '::HRI' == WIN
use strict;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::SearchOr;
-$DBIx::Class::Helper::ResultSet::SearchOr::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::SearchOr::VERSION = '2.023005';
# ABSTRACT: Combine ResultSet searches with OR's
use strict;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::SetOperations;
-$DBIx::Class::Helper::ResultSet::SetOperations::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::SetOperations::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::Shortcut::AddColumns;
-$DBIx::Class::Helper::ResultSet::Shortcut::AddColumns::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::Shortcut::AddColumns::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::Shortcut::Columns;
-$DBIx::Class::Helper::ResultSet::Shortcut::Columns::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::Shortcut::Columns::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::Shortcut::Distinct;
-$DBIx::Class::Helper::ResultSet::Shortcut::Distinct::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::Shortcut::Distinct::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::Shortcut::GroupBy;
-$DBIx::Class::Helper::ResultSet::Shortcut::GroupBy::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::Shortcut::GroupBy::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::Shortcut::HRI;
-$DBIx::Class::Helper::ResultSet::Shortcut::HRI::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::Shortcut::HRI::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::Shortcut::HasRows;
-$DBIx::Class::Helper::ResultSet::Shortcut::HasRows::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::Shortcut::HasRows::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::Shortcut::Limit;
-$DBIx::Class::Helper::ResultSet::Shortcut::Limit::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::Shortcut::Limit::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::Shortcut::LimitedPage;
-$DBIx::Class::Helper::ResultSet::Shortcut::LimitedPage::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::Shortcut::LimitedPage::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::Shortcut::OrderBy;
-$DBIx::Class::Helper::ResultSet::Shortcut::OrderBy::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::Shortcut::OrderBy::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::Shortcut::OrderByMagic;
-$DBIx::Class::Helper::ResultSet::Shortcut::OrderByMagic::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::Shortcut::OrderByMagic::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::Shortcut::Page;
-$DBIx::Class::Helper::ResultSet::Shortcut::Page::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::Shortcut::Page::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::Shortcut::Prefetch;
-$DBIx::Class::Helper::ResultSet::Shortcut::Prefetch::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::Shortcut::Prefetch::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::Shortcut::ResultsExist;
-$DBIx::Class::Helper::ResultSet::Shortcut::ResultsExist::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::Shortcut::ResultsExist::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::Shortcut::Rows;
-$DBIx::Class::Helper::ResultSet::Shortcut::Rows::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::Shortcut::Rows::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::Shortcut;
-$DBIx::Class::Helper::ResultSet::Shortcut::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::Shortcut::VERSION = '2.023005';
# ABSTRACT: Shortcuts to common searches (->order_by, etc)
use strict;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::Union;
-$DBIx::Class::Helper::ResultSet::Union::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::Union::VERSION = '2.023005';
use parent 'DBIx::Class::Helper::ResultSet::SetOperations';
use Carp::Clan;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet::VirtualView;
-$DBIx::Class::Helper::ResultSet::VirtualView::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::VirtualView::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::ResultSet;
-$DBIx::Class::Helper::ResultSet::VERSION = '2.023000';
+$DBIx::Class::Helper::ResultSet::VERSION = '2.023005';
use parent qw{
DBIx::Class::Helper::ResultSet::AutoRemoveColumns
DBIx::Class::Helper::ResultSet::CorrelateRelationship
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::Row::CleanResultSet;
-$DBIx::Class::Helper::Row::CleanResultSet::VERSION = '2.023000';
+$DBIx::Class::Helper::Row::CleanResultSet::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::Row::JoinTable;
-$DBIx::Class::Helper::Row::JoinTable::VERSION = '2.023000';
+$DBIx::Class::Helper::Row::JoinTable::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::Row::NumifyGet;
-$DBIx::Class::Helper::Row::NumifyGet::VERSION = '2.023000';
+$DBIx::Class::Helper::Row::NumifyGet::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::Row::OnColumnChange;
-$DBIx::Class::Helper::Row::OnColumnChange::VERSION = '2.023000';
+$DBIx::Class::Helper::Row::OnColumnChange::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::Row::ProxyResultSetMethod;
-$DBIx::Class::Helper::Row::ProxyResultSetMethod::VERSION = '2.023000';
+$DBIx::Class::Helper::Row::ProxyResultSetMethod::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::Row::ProxyResultSetUpdate;
-$DBIx::Class::Helper::Row::ProxyResultSetUpdate::VERSION = '2.023000';
+$DBIx::Class::Helper::Row::ProxyResultSetUpdate::VERSION = '2.023005';
# ABSTRACT: Efficiently reuse ResultSet updates from results
use base 'DBIx::Class::Helper::Row::SelfResultSet';
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::Row::RelationshipDWIM;
-$DBIx::Class::Helper::Row::RelationshipDWIM::VERSION = '2.023000';
+$DBIx::Class::Helper::Row::RelationshipDWIM::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::Row::SelfResultSet;
-$DBIx::Class::Helper::Row::SelfResultSet::VERSION = '2.023000';
+$DBIx::Class::Helper::Row::SelfResultSet::VERSION = '2.023005';
use strict;
use warnings;
@@ -8,13 +8,8 @@ use warnings;
sub self_rs {
my ($self) = @_;
- my $src = $self->result_source;
- my $rs = $src->resultset;
- my $me = $rs->current_source_alias;
- return $rs->search({
- # perl, sometimes I hate your guts
- map +( "$me.$_" => $self->get_column($_) ), $src->primary_columns
- })
+ my $rs = $self->result_source->resultset;
+ return $rs->search( $self->ident_condition( $rs->current_source_alias ) );
}
1;
@@ -44,6 +39,12 @@ row. A good reason to do that would be if you had a ResultSet method that adds
in some calculated data, like counts of a relationship. You could use this to
get at that counted data without duplicating the logic for the counting.
+Due to primitives provided by L<DBIx::Class::PK> this references the current
+values, or in C<DBIx::Class> terms, the dirty values. So if you modify the
+primary columns it will be temporarily incorrect. For what it's worth I'm not
+married to this behavior and I'd rather you get in touch with me before you
+depend on it.
+
=head1 METHODS
=head2 self_rs
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::Row::StorageValues;
-$DBIx::Class::Helper::Row::StorageValues::VERSION = '2.023000';
+$DBIx::Class::Helper::Row::StorageValues::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::Row::SubClass;
-$DBIx::Class::Helper::Row::SubClass::VERSION = '2.023000';
+$DBIx::Class::Helper::Row::SubClass::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::Row::ToJSON;
-$DBIx::Class::Helper::Row::ToJSON::VERSION = '2.023000';
+$DBIx::Class::Helper::Row::ToJSON::VERSION = '2.023005';
use strict;
use warnings;
@@ -47,9 +47,12 @@ sub serializable_columns {
sub TO_JSON {
my $self = shift;
+ my $columns_info = $self->columns_info($self->serializable_columns);
+
return {
map +($_ => $self->$_),
- @{$self->serializable_columns}
+ map +($columns_info->{$_}{accessor} || $_),
+ keys %$columns_info
};
}
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::Schema::DateTime;
-$DBIx::Class::Helper::Schema::DateTime::VERSION = '2.023000';
+$DBIx::Class::Helper::Schema::DateTime::VERSION = '2.023005';
# ABSTRACT: DateTime helper
use strict;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::Schema::GenerateSource;
-$DBIx::Class::Helper::Schema::GenerateSource::VERSION = '2.023000';
+$DBIx::Class::Helper::Schema::GenerateSource::VERSION = '2.023005';
# ABSTRACT: Generate sources directly from your Schema
use strict;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::Schema::LintContents;
-$DBIx::Class::Helper::Schema::LintContents::VERSION = '2.023000';
+$DBIx::Class::Helper::Schema::LintContents::VERSION = '2.023005';
# ABSTRACT: suite of methods to find violated "constraints"
use strict;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::Schema::QuoteNames;
-$DBIx::Class::Helper::Schema::QuoteNames::VERSION = '2.023000';
+$DBIx::Class::Helper::Schema::QuoteNames::VERSION = '2.023005';
# ABSTRACT: force C<quote_names> on
use strict;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::SubClass;
-$DBIx::Class::Helper::SubClass::VERSION = '2.023000';
+$DBIx::Class::Helper::SubClass::VERSION = '2.023005';
use parent 'DBIx::Class::Helper::Row::SubClass';
use Carp::Clan;
@@ -1,5 +1,5 @@
package DBIx::Class::Helper::VirtualView;
-$DBIx::Class::Helper::VirtualView::VERSION = '2.023000';
+$DBIx::Class::Helper::VirtualView::VERSION = '2.023005';
use parent 'DBIx::Class::Helper::ResultSet::VirtualView';
use Carp::Clan;
@@ -1,5 +1,5 @@
package DBIx::Class::Helpers::Util;
-$DBIx::Class::Helpers::Util::VERSION = '2.023000';
+$DBIx::Class::Helpers::Util::VERSION = '2.023005';
use strict;
use warnings;
@@ -1,5 +1,5 @@
package DBIx::Class::Helpers;
-$DBIx::Class::Helpers::VERSION = '2.023000';
+$DBIx::Class::Helpers::VERSION = '2.023005';
use strict;
use warnings;
@@ -0,0 +1,18 @@
+package TestSchema::Result::HasAccessor;
+
+use DBIx::Class::Candy
+ -components => [qw(
+ Helper::Row::ToJSON
+ )];
+
+
+table 'HasAccessor';
+
+primary_column id => { data_type => 'int' };;
+column usable_column => { data_type => 'varchar' };
+column unusable_column => {
+ data_type => 'varchar',
+ accessor => 'alternate_name',
+};
+
+1;
@@ -0,0 +1,9 @@
+package TestSchema::ResultSet::HasAccessor;
+use strict;
+use warnings;
+
+use parent 'TestSchema::ResultSet';
+
+__PACKAGE__->load_components();
+
+1;
@@ -1,6 +1,6 @@
--
-- Created by SQL::Translator::Producer::MySQL
--- Created on Mon May 26 19:33:03 2014
+-- Created on Sun Aug 10 11:05:29 2014
--
SET foreign_key_checks=0;
@@ -1,6 +1,6 @@
--
-- Created by SQL::Translator::Producer::Oracle
--- Created on Mon May 26 19:33:03 2014
+-- Created on Sun Aug 10 11:05:29 2014
--
--
-- Table: Gnarly
@@ -1,6 +1,6 @@
--
-- Created by SQL::Translator::Producer::PostgreSQL
--- Created on Mon May 26 19:33:03 2014
+-- Created on Sun Aug 10 11:05:29 2014
--
--
-- Table: Gnarly.
@@ -1,6 +1,6 @@
--
-- Created by SQL::Translator::Generator::Role::DDL
--- Created on Mon May 26 19:33:03 2014
+-- Created on Sun Aug 10 11:05:29 2014
--
@@ -1,6 +1,6 @@
--
-- Created by SQL::Translator::Producer::SQLite
--- Created on Mon May 26 19:33:03 2014
+-- Created on Sun Aug 10 11:05:29 2014
--
BEGIN TRANSACTION;
@@ -26,6 +26,15 @@ CREATE TABLE Gnarly (
);
--
+-- Table: HasAccessor
+--
+CREATE TABLE HasAccessor (
+ id INTEGER PRIMARY KEY NOT NULL,
+ usable_column varchar NOT NULL,
+ unusable_column varchar NOT NULL
+);
+
+--
-- Table: HasDateOps
--
CREATE TABLE HasDateOps (
@@ -65,7 +65,7 @@ sub generate_ddl {
sub prepopulate {
my $self = shift;
- $self->resultset($_)->delete for qw{Bar Foo Gnarly_Station Bloaty Gnarly Station};
+ $self->resultset($_)->delete for qw{Bar Foo Gnarly_Station Bloaty Gnarly Station HasAccessor};
$self->populate( Gnarly => [
[qw{id name}],
@@ -115,6 +115,13 @@ sub prepopulate {
[4,4],
[5,5],
]);
+
+ $self->populate( HasAccessor => [
+ [qw{id usable_column unusable_column}],
+ [1,'aa','bb'],
+ [2,'cc','dd'],
+ [3,'ee','ff'],
+ ]);
}
'kitten eater';
@@ -10,7 +10,7 @@ with 'A::Role::TestConnect';
sub rs { shift->schema->resultset('Gnarly') }
-test basic => sub {
+top_test basic => sub {
my $self = shift;
my $rs = $self->rs;
SKIP: {
@@ -56,4 +56,25 @@ MORE_COMPLEX_JSON: {
}], 'complex TO_JSON works');
}
+ACCESSOR_CLASS: {
+ my $datas = [
+ map $_->TO_JSON,
+ $schema->resultset('HasAccessor')->search(undef, { order_by => 'id' })->all
+ ];
+
+ cmp_deeply($datas, [{
+ id => 1,
+ usable_column => 'aa',
+ alternate_name => 'bb',
+ },{
+ id => 2,
+ usable_column => 'cc',
+ alternate_name => 'dd',
+ },{
+ id => 3,
+ usable_column => 'ee',
+ alternate_name => 'ff',
+ }], 'accessor fields with TO_JSON works');
+}
+
done_testing;