Ambrosia
view release on metacpan or search on metacpan
lib/Ambrosia/DataProvider/ResourceDriver.pm view on Meta::CPAN
$old->($h) && $h->{$f} gt $v
},
'>=' => sub {
my $h = shift;
$old->($h) && $h->{$f} ge $v
},
'!=' => sub {
my $h = shift;
$old->($h) && $h->{$f} ne $v
},
'like' => sub {
my $h = shift;
$old->($h) && $h->{$f} =~ /$v/
},
}->{lc($op)};
return $self;
}
sub next
{
my $self = shift;
my $table = $self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::SOURCE]->[-1];
my $source = $self->handler->{$table};
my @fields = @{$self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::WHAT]};
M1:
if ( my $res = $source->[$self->__start++] )
{
if ( my $p = $self->_cql_query->[&Ambrosia::DataProvider::BaseDriver::PREDICATE] )
{
goto M1 unless $p->($res);
}
return @fields ? {map {$_ => $res->{$_}} @fields} : $res;
}
return;
}
sub count
{
my $table = $_[0]->_cql_query->[&Ambrosia::DataProvider::BaseDriver::SOURCE]->[-1];
return scalar @{$_[0]->handler->{$table}};
}
sub limit
{
}
sub skip
{
}
sub insert
{
die 'Cannot insert. Resource read only';
}
sub update
{
die 'Cannot update. Resource read only';
}
sub delete
{
die 'Cannot delete. Resource read only';
}
1;
__END__
=head1 NAME
Ambrosia::DataProvider::ResourceDriver - a class realize Ambrosia::DataProvider::BaseDriver and provide connection to resources storage.
=head1 VERSION
version 0.010
=head1 SYNOPSIS
use Ambrosia::DataProvider;
my $confDS = {
Resource => [
{
engine_name => 'Resource::Hash',
source_name => 'application_name',
engine_params => {
path => $PATH_ROOT . '/Application/Resource/Resources.pm'
}
},
]
};
instance Ambrosia::Storage(application_name => $confDS);
Ambrosia::DataProvider::assign 'application_name';
=head1 DESCRIPTION
C<Ambrosia::DataProvider::DBIDriver> is a class realize Ambrosia::DataProvider::BaseDriver and provide connection to data bases throw DBI.
For more information see:
=over
=item L<Ambrosia::DataProvider::Engine::Resource::Hash>
=back
=head1 SUBROUTINES/METHODS
=head2 cache
Returns cache.
=head2 open_connection (Wraper. Translate request to engine.)
( run in 0.853 second using v1.01-cache-2.11-cpan-13bb782fe5a )