view release on metacpan or search on metacpan
lib/DBIx/Class/Admin.pm view on Meta::CPAN
=item Arguments: $rs, $set, $where
=back
update takes the name of a resultset from the schema_class, a hashref of data to update and
a where hash used to form the search for the rows to update.
=cut
sub update {
my ($self, $rs, $set, $where) = @_;
$rs ||= $self->resultset();
$where ||= $self->where();
$set ||= $self->set();
my $resultset = $self->schema->resultset($rs);
$resultset = $resultset->search( ($where||{}) );
my $count = $resultset->count();
print "This action will modify $count ".ref($resultset)." records.\n" if (!$self->quiet);
lib/DBIx/Class/CDBICompat/LazyLoading.pm view on Meta::CPAN
sub resultset_instance {
my $self = shift;
my $rs = $self->next::method(@_);
$rs = $rs->search(undef, { columns => [ $self->columns('Essential') ] });
return $rs;
}
# Emulate that CDBI throws out all changed columns and reloads them on
# request in case the database modifies the new value (say, via a trigger)
sub update {
my $self = shift;
my @dirty_columns = keys %{$self->{_dirty_columns}};
my $ret = $self->next::method(@_);
$self->_clear_column_data(@dirty_columns);
return $ret;
}
lib/DBIx/Class/CDBICompat/Triggers.pm view on Meta::CPAN
my $self = shift;
return $self->create(@_) unless ref $self;
$self->call_trigger('before_create');
$self->next::method(@_);
$self->call_trigger('after_create');
return $self;
}
sub update {
my $self = shift;
$self->call_trigger('before_update');
my @to_update = keys %{$self->{_dirty_columns} || {}};
return -1 unless @to_update;
$self->next::method(@_);
$self->call_trigger('after_update');
return $self;
}
sub delete {
lib/DBIx/Class/FilterColumn.pm view on Meta::CPAN
$self->make_column_dirty($col);
delete $self->{_column_data}{$col};
}
else {
$self->set_column($col, $self->_column_to_storage($col, $filtered));
};
return $self->{_filtered_column}{$col} = $filtered;
}
sub update {
my ($self, $data, @rest) = @_;
my $colinfos = $self->result_source->columns_info;
foreach my $col (keys %{$data||{}}) {
if ( exists $colinfos->{$col}{_filter_info} ) {
$self->set_filtered_column($col, delete $data->{$col});
# FIXME update() reaches directly into the object-hash
# and we may *not* have a filtered value there - thus
lib/DBIx/Class/Ordered.pm view on Meta::CPAN
=head2 update
Overrides the DBIC update() method by checking for a change
to the position and/or group columns. Movement within a
group or to another group is handled by repositioning
the appropriate siblings. Position defaults to the end
of a new group if it has been changed to undef.
=cut
sub update {
my $self = shift;
# this is set by _ordered_internal_update()
return $self->next::method(@_) if $self->result_source->schema->{_ORDERED_INTERNAL_UPDATE};
my $upd = shift;
$self->set_inflated_columns($upd) if $upd;
my $position_column = $self->position_column;
my @group_columns = $self->_grouping_columns;
lib/DBIx/Class/Relationship/Base.pm view on Meta::CPAN
=item Return Value: L<$result|DBIx::Class::Manual::ResultClass>
=back
Update or create a result object of a related class. See
L<DBIx::Class::ResultSet/update_or_create> for details.
=cut
sub update_or_create_related {
#my ($self, $rel, @args) = @_;
shift->related_resultset(shift)->update_or_create(@_);
}
=head2 set_from_related
=over 4
=item Arguments: $rel_name, L<$result|DBIx::Class::Manual::ResultClass>
lib/DBIx/Class/ResultSet.pm view on Meta::CPAN
Note that L</update> does not process/deflate any of the values passed in.
This is unlike the corresponding L<DBIx::Class::Row/update>. The user must
ensure manually that any value passed to this method will stringify to
something the RDBMS knows how to deal with. A notable example is the
handling of L<DateTime> objects, for more info see:
L<DBIx::Class::Manual::Cookbook/Formatting DateTime objects in queries>.
=cut
sub update {
my ($self, $values) = @_;
$self->throw_exception('Values for update must be a hash')
unless ref $values eq 'HASH';
return $self->_rs_update_delete ('update', $values);
}
=head2 update_all
=over 4
lib/DBIx/Class/Row.pm view on Meta::CPAN
To determine before calling this method, which column values have
changed and will be updated, call L</get_dirty_columns>.
To check if any columns will be updated, call L</is_changed>.
To force a column to be updated, call L</make_column_dirty> before
this method.
=cut
sub update {
my ($self, $upd) = @_;
$self->set_inflated_columns($upd) if $upd;
my %to_update = $self->get_dirty_columns
or return $self;
$self->throw_exception( "Not in database" ) unless $self->in_storage;
my $rows = $self->result_source->storage->update(
lib/DBIx/Class/Storage.pm view on Meta::CPAN
=cut
sub insert { die "Virtual method!" }
=head2 update
Handle an update statement.
=cut
sub update { die "Virtual method!" }
=head2 delete
Handle a delete statement.
=cut
sub delete { die "Virtual method!" }
=head2 select_single
lib/DBIx/Class/Storage/DBI.pm view on Meta::CPAN
}
catch {
$err = shift unless defined $err;
};
$self->throw_exception($err) if defined $err;
return $count;
}
sub update {
#my ($self, $source, @args) = @_;
shift->_execute('update', @_);
}
sub delete {
#my ($self, $source, @args) = @_;
shift->_execute('delete', @_);
}
lib/DBIx/Class/Storage/DBI/ODBC/ACCESS.pm view on Meta::CPAN
last;
}
}
local $self->{disable_sth_caching} = 1 if $is_image_insert
&& $self->disable_sth_caching_for_image_insert_or_update;
return $self->next::method(@_);
}
sub update {
my $self = shift;
my ($source, $fields) = @_;
my $columns_info = $source->columns_info;
my $is_image_insert = 0;
for my $col (keys %$fields) {
if ($self->_is_binary_lob_type($columns_info->{$col}{data_type})) {
$is_image_insert = 1;
lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm view on Meta::CPAN
($identity_col => $self->last_insert_id($source, $identity_col)) : ()),
%$to_insert,
%$updated_cols,
};
$self->_insert_blobs ($source, $blob_cols, $final_row) if $blob_cols;
return $updated_cols;
}
sub update {
my $self = shift;
my ($source, $fields, $where, @rest) = @_;
#
# When *updating* identities, ASE requires SET IDENTITY_UPDATE called
#
if (my $blob_cols = $self->_remove_blob_cols($source, $fields)) {
# If there are any blobs in $where, Sybase will return a descriptive error
# message.
view all matches for this distributionview release on metacpan - search on metacpan