NAME

DBIx::Meld::ResultSet - An ORMish representation of a SQL query.

SYNOPSIS

my $rs = $meld->resultset('users');
my $disabled_users = $rs->search({ status => 0 });
print 'Number of disabled users: ' . $disabled_users->count() . "\n";

DESCRIPTION

This class is a very lightweight wrapper around DBIx::Meld. All it does is remember the table name for all of the SQL::Abstract queries, like update(), and provides a way to progressively build a SQL query, much like DBIx::Class::ResultSet.

METHODS

my $old_rs = $meld->resultset('users')->search({ status => 0 });
my $new_rs = $old_rs->search({ age > 18 });
print 'Disabled adults: ' . $new_rs->count() . "\n";

Returns a new resultset object that overlays the passed in where clause on top of the old where clause, creating a new resultset. The original resultset's where clause is left unmodified.

insert

my $users = $meld->resultset('users');
$users->insert({ user_name => 'joe_bob' });

update

my $users = $meld->resultset('users');
$users->search({ user_name => 'joe_bob' })->update({ email => 'joe@example.com' });

delete

$meld->resultset('users')->search({ user_id => 12 })->delete();

array_row

my $row = $users->search({ user_id => 12 })->array_row(['user_name', 'email']);
print $row->[0]; # user_name
print $row->[1]; # email

hash_row

my $row = $users->search({ user_id => 12 })->hash_row('*');
print $row->{user_name};

array_of_array_rows

my $rows = $users->search({ status => 1 })->array_of_array_rows(['user_name']);
foreach my $row (@$rows) {
    print $row->[0] . "\n";
}

array_of_hash_rows

hash_of_hash_rows

count

column

AUTHOR

Aran Clary Deltac <bluefeet@gmail.com>

LICENSE

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