Andy Grundman > DBIx-Class-0.03003 > DBIx::Class::Row

Download:
DBIx-Class-0.03003.tar.gz

Dependencies

Annotate this POD (1)

CPAN RT

New  11
Open  16
Stalled  11
View/Report Bugs
Source   Latest Release: DBIx-Class-0.082700_11

NAME ^

DBIx::Class::Row - Basic row methods

SYNOPSIS ^

DESCRIPTION ^

This class is responsible for defining and doing basic operations on rows derived from DBIx::Class::Table objects.

METHODS ^

new
  my $obj = My::Class->new($attrs);

Creates a new row object from column => value mappings passed as a hash ref

insert
  $obj->insert;

Inserts an object into the database if it isn't already in there. Returns the object itself.

in_storage
  $obj->in_storage; # Get value
  $obj->in_storage(1); # Set value

Indicated whether the object exists as a row in the database or not

create
  my $new = My::Class->create($attrs);

A shortcut for My::Class->new($attrs)->insert;

update
  $obj->update;

Must be run on an object that is already in the database; issues an SQL UPDATE query to commit any changes to the object to the db if required.

delete
  $obj->delete

Deletes the object from the database. The object is still perfectly usable accessor-wise etc. but ->in_storage will now return 0 and the object must be re ->insert'ed before it can be ->update'ed

get_column
  my $val = $obj->get_column($col);

Fetches a column value

get_columns
  my %data = $obj->get_columns;

Fetch all column values at once.

set_column
  $obj->set_column($col => $val);

Sets a column value; if the new value is different to the old the column is marked as dirty for when you next call $obj->update

set_columns
  my $copy = $orig->set_columns({ $col => $val, ... });

Set more than one column value at once.

copy
  my $copy = $orig->copy({ change => $to, ... });

Insert a new row with the specified changes.

store_column
  $obj->store_column($col => $val);

Sets a column value without marking it as dirty

insert_or_update
  $obj->insert_or_update

Updates the object if it's already in the db, else inserts it

is_changed
  my @changed_col_names = $obj->is_changed

AUTHORS ^

Matt S. Trout <mst@shadowcatsystems.co.uk>

LICENSE ^

You may distribute this code under the same terms as Perl itself.

syntax highlighting: