[Catalyst-commits] r7621 -
CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Mon Apr 21 17:01:01 BST 2008
Author: karpet
Date: 2008-04-21 17:01:00 +0100 (Mon, 21 Apr 2008)
New Revision: 7621
Modified:
CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model/RDBO.pm
Log:
switch to Class::C3
Modified: CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model/RDBO.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model/RDBO.pm 2008-04-21 16:00:58 UTC (rev 7620)
+++ CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model/RDBO.pm 2008-04-21 16:01:00 UTC (rev 7621)
@@ -3,10 +3,11 @@
use warnings;
use base qw( CatalystX::CRUD::Model CatalystX::CRUD::Model::Utils );
use CatalystX::CRUD::Iterator;
+use Class::C3;
our $VERSION = '0.11';
-__PACKAGE__->mk_ro_accessors(qw( name manager ));
+__PACKAGE__->mk_ro_accessors(qw( name manager treat_like_int ));
__PACKAGE__->config->{object_class} = 'CatalystX::CRUD::Object::RDBO';
=head1 NAME
@@ -63,7 +64,7 @@
sub Xsetup {
my $self = shift;
- $self->NEXT::Xsetup(@_);
+ $self->next::method(@_);
$self->{name} = $self->config->{name};
if ( !$self->name ) {
@@ -87,6 +88,9 @@
# rdbo sql uses 'ne' for not equal
$self->ne_sign('ne');
+ # cache the treat_like_int hash
+ $self->_treat_like_int;
+
# load the Manager
eval "require $mgr";
@@ -119,7 +123,7 @@
my $err = defined($obj) ? $obj->error : $@;
return if $self->throw_error("can't create new $rdbo object: $err");
}
- return $self->NEXT::new_object( delegate => $obj );
+ return $self->next::method( delegate => $obj );
}
=head2 fetch( @params )
@@ -275,20 +279,21 @@
=cut
-sub treat_like_int {
+sub _treat_like_int {
my $self = shift;
- return $self->{_treat_like_int} if $self->{_treat_like_int};
- $self->{_treat_like_int} = {};
+ return $self->{treat_like_int} if $self->{treat_like_int};
+ $self->{treat_like_int} = {};
my $col_names = $self->_get_field_names;
# treat wildcard timestamps like ints not text (>= instead of ILIKE)
for my $name (@$col_names) {
my $col = $self->name->meta->column($name);
- $self->{_treat_like_int}->{$name} = 1
- if $col->type =~ m/^date(time)?$/;
+ if ( $col->type =~ m/date|time/ ) {
+ $self->{treat_like_int}->{$name} = 1;
+ }
}
- return $self->{_treat_like_int};
+ return $self->{treat_like_int};
}
sub make_query {
More information about the Catalyst-commits
mailing list