DBIx-Custom

 view release on metacpan or  search on metacpan

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

  if (@$params > 1) {
    for my $param (@$params) {
      $self->execute($sql, $param, %opt);
    }
  }
  else {
    $self->execute($sql, $params->[0], %opt);
  }
}

sub update {
  my $self = shift;

  # Options
  my $param = @_ % 2 ? shift : undef;
  my %opt = @_;
  $param ||= {};
  
  # Don't allow update all rows
  confess qq{update method where option must be specified } . _subname
    if !$opt{where} && !defined $opt{id} && !$opt{allow_update_all};

lib/DBIx/Custom/Model.pm  view on Meta::CPAN

# DEPRECATED
sub primary_key {
  if (@_ == 1) {
    return $_[0]{'primary_key'};
  }
  $_[0]{'primary_key'} = $_[1];
  $_[0];
};

# DEPRECATED
sub update_or_insert {
  my ($self, $param, %opt) = @_;

  _deprecate('0.39', "DBIx::Custom::Model::update_or_insert method is DEPRECATED!");

  confess "update_or_insert method need primary_key and id option "
    unless (defined $opt{id} || defined $self->{id})
        && (defined $opt{primary_key} || defined $self->{primary_key});
  
  my $statement_opt = $opt{option} || {};
  my $rows = $self->select(%opt, %{$statement_opt->{select} || {}})->all;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.076 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )