view release on metacpan or search on metacpan
lib/DBIx/ObjectMapper/Engine.pm view on Meta::CPAN
sub namesep { }
sub quote { }
sub driver { }
sub datetime_parser { }
sub get_primary_key { }
sub get_column_info { }
sub get_unique_key { }
sub get_tables { }
sub select { }
sub select_single { }
sub update { }
sub insert { }
sub create { }
sub delete { }
sub iterator { }
1;
__END__
=head1 NAME
lib/DBIx/ObjectMapper/Engine/DBI.pm view on Meta::CPAN
return $callback && ref($callback) eq 'CODE'
? $callback->( $result, $query )
: $result;
}
sub _as_query_object {
my ($self, $action, $query ) = @_;
return $self->query->$action( %$query );
}
sub update {
my ( $self, $query, $callback ) = @_;
my $query_class = ref( $self->query ) . '::Update';
unless ( ref $query eq $query_class ) {
$query = $self->_as_query_object('update', $query);
}
$callback->($query, $self->dbh) if $callback and ref($callback) eq 'CODE';
if ( my $keys = $self->{cache_target_table}{ $query->table } ) {
lib/DBIx/ObjectMapper/Mapper.pm view on Meta::CPAN
push @column, $self->load_properties unless @column;
return $self->table->select->column(@column);
}
sub insert {
my $self = shift;
my %data = @_;
return $self->table->insert(%data)->execute;
}
sub update {
my $self = shift;
my ( $data, $cond ) = @_;
return map { $_->execute } $self->table->update($data, $cond);
}
sub delete {
my $self = shift;
my @where = @_;
return map { $_->execute } $self->table->delete(@where);
}
lib/DBIx/ObjectMapper/Mapper/Instance.pm view on Meta::CPAN
$modified_data->{$prop_name} = $val;
$is_modified = 1;
}
}
return $is_modified;
}
sub modified_data { $_[0]->{modified_data} }
sub update {
my ( $self ) = @_;
confess 'it need to be "persistent" status.' unless $self->is_persistent;
my $reduce_data = $self->reducing;
my $modified_data = $self->modified_data;
my $uniq_cond = $self->identity_condition;
my $class_mapper = $self->instance->__class_mapper__;
my $result;
try {
lib/DBIx/ObjectMapper/Metadata.pm view on Meta::CPAN
}
sub query_object {
my $self = shift;
return $self->{query_object} ||= $self->{query_class}->new($self->engine);
}
sub select { $_[0]->query_object->select }
sub insert { $_[0]->query_object->insert }
sub delete { $_[0]->query_object->delete }
sub update { $_[0]->query_object->update }
1;
__END__
=head1 NAME
DBIx::ObjectMapper::Metadata
=head1 AUTHOR
lib/DBIx/ObjectMapper/Metadata/Polymorphic.pm view on Meta::CPAN
my @cond;
my $table = $type eq 'parent' ? $self->parent_table : $self->child_table;
for my $c (@$cond) {
push @cond, [ map { ref $_ ? $table->c( $_->name ) : $_ } @$c ];
}
return @cond;
}
sub update {
my $self = shift;
my ( $data, $cond ) = @_;
my %parent_data;
my %child_data;
for my $key ( keys %$data ) {
if( $self->{shared_column}->{$key} ) {
$parent_data{$key} = $data->{$key};
$child_data{$key} = $data->{$key};
}
lib/DBIx/ObjectMapper/Metadata/Query.pm view on Meta::CPAN
sub count {
my $self = shift;
return $self->query_object->count->from(
[ $self->{query}->builder, $self->table_name ] );
}
sub insert { confess "INSERT is not suppurt." }
sub delete { confess "DELETE is not suppurt." }
sub update { confess "UPDATE is not suppurt." }
1;
lib/DBIx/ObjectMapper/Metadata/Table.pm view on Meta::CPAN
sub delete {
my $self = shift;
my $query = $self->query_object->delete( $self->_delete_query_callback )
->table( $self->table_name );
$query->where(@_) if @_;
return $query;
}
sub _delete_query_callback { undef } # TODO cascade delete
sub update {
my $self = shift;
my ( $data, $cond ) = @_;
my $query = $self->query_object->update( $self->_update_query_callback )
->table( $self->table_name );
$query->set(%$data) if $data;
$query->where( @$cond ) if $cond;
return $query;
}
sub _update_query_callback {
lib/DBIx/ObjectMapper/Query.pm view on Meta::CPAN
use Carp::Clan qw/^DBIx::ObjectMapper/;
use base qw(DBIx::ObjectMapper::Query::Base);
use DBIx::ObjectMapper::Query::Select;
use DBIx::ObjectMapper::Query::Insert;
use DBIx::ObjectMapper::Query::Update;
use DBIx::ObjectMapper::Query::Delete;
use DBIx::ObjectMapper::Query::Count;
sub select { DBIx::ObjectMapper::Query::Select->new( shift->engine, @_ ) }
sub insert { DBIx::ObjectMapper::Query::Insert->new( shift->engine, @_ ) }
sub update { DBIx::ObjectMapper::Query::Update->new( shift->engine, @_ ) }
sub delete { DBIx::ObjectMapper::Query::Delete->new( shift->engine, @_ ) }
sub count { DBIx::ObjectMapper::Query::Count->new( shift->engine, @_ ) }
1;
lib/DBIx/ObjectMapper/SQL.pm view on Meta::CPAN
my %param = @_;
$param{driver} = $self->{driver} if ref $self;
return DBIx::ObjectMapper::SQL::Select->new(%param);
}
sub insert {
my $self = shift;
return DBIx::ObjectMapper::SQL::Insert->new(@_);
}
sub update {
my $self = shift;
return DBIx::ObjectMapper::SQL::Update->new(@_);
}
sub delete {
my $self = shift;
return DBIx::ObjectMapper::SQL::Delete->new(@_);
}
sub union {
view all matches for this distributionview release on metacpan - search on metacpan