Alessandro Ranellucci > DBIx-Lite-0.27 > DBIx::Lite::Row

Download:
DBIx-Lite-0.27.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.27   Source  

NAME ^

DBIx::Lite::Row

VERSION ^

version 0.27

OVERVIEW ^

This class is not supposed to be instantiated manually. You usually get your first Result objects by calling one of retrieval methods on a DBIx::Lite::ResultSet object.

Accessor methods will be provided automatically for all retrieved columns and for related tables (see docs for DBIx::Lite::Schema). If a column does not exist, calling its method will die with an exception (use get if you want to handle this gracefully).

    my $book = $dbix->table('books')->find({ id => 10 });
    print $book->title;
    print $book->author->name;

hashref

This method returns a hashref containing column values.

    my $hashref = $book->hashref;
    print "$_ = $hashref->{$_}\n" for keys %$hashref;

get

This method accepts a column names and returns its value. If the column does not exist, it returns undef.

    print $book->get('title');

update

This method is only available if you specified a primary key for the table (see docs for DBIx::Lite::Schema).

It accepts a hashref of column values and it will perform a SQL UPDATE command.

delete

This method is only available if you specified a primary key for the table (see docs for DBIx::Lite::Schema).

It will perform a SQL DELETE command.

insert_related

This method is only available if you specified a primary key for the table (see docs for DBIx::Lite::Schema).

It accepts the name of the relted column you want to insert into, and a hashref of the column values to pass to the INSERT command. It will return the inserted object.

    $dbix->schema->one_to_many('authors.id' => 'books.author_id');
    my $book = $author->insert_related('books', { title => 'Camel Tales' });

AUTHOR ^

Alessandro Ranellucci <aar@cpan.org>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2016 by Alessandro Ranellucci.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: