DBIx-Skinny

 view release on metacpan or  search on metacpan

lib/DBIx/Skinny.pm  view on Meta::CPAN

668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
    $obj;
}
 
sub bulk_insert {
    my ($class, $table, $args) = @_;
 
    my $code = $class->_attributes->{dbd}->can('bulk_insert') or Carp::croak "dbd don't provide bulk_insert method";
    $code->($class, $table, $args);
}
 
sub update {
    my ($class, $table, $args, $where) = @_;
 
    my $schema = $class->schema;
    $class->call_schema_trigger('pre_update', $schema, $table, $args);
 
    my $values = {};
    for my $col (keys %{$args}) {
       $values->{$col} = $schema->call_deflate($col, $args->{$col});
    }

lib/DBIx/Skinny.pm  view on Meta::CPAN

698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
    my $sth = $class->_execute($sql, $bind_columns, $table);
 
    my $rows = $sth->rows;
 
    $class->_close_sth($sth);
    $class->call_schema_trigger('post_update', $schema, $table, $rows);
 
    return $rows;
}
 
sub update_by_sql {
    my ($class, $sql, $bind) = @_;
 
    Carp::carp( 'update_by_sql has been deprecated. Please use $skinny->do($sql, undef, @bind)' );
    $class->do($sql, undef, @$bind);
}
 
sub delete {
    my ($class, $table, $where) = @_;
 
    my $schema = $class->schema;

lib/DBIx/Skinny/Row.pm  view on Meta::CPAN

101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
    return \%rows;
}
 
sub insert {
    my $self = shift;
 
    $self->{skinny}->find_or_create($self->{opt_table_info}, $self->get_columns);
}
 
sub update {
    my ($self, $args, $table) = @_;
 
    $table ||= $self->{opt_table_info};
    my $upd = $self->get_dirty_columns;
    map {$upd->{$_} = $args->{$_}} keys %$args;
 
    return 0 unless %$upd;
 
    my $result = $self->{skinny}->update($table, $upd, $self->_where_cond($table));
    $self->set_columns($upd);



( run in 0.514 second using v1.01-cache-2.11-cpan-49f99fa48dc )