NAME

SQLx::Core::ResultSet - Methods for searching and altering tables

count

Returns the number of rows found

first

Get the first result from a resultset

next

A simple iterator to loop through a resultset. Each returned result will be blessed as a Result.

# MySchema/Result/Table.pm

sub name { return shift->{result}->{name}; }

# test.pl

while(my $row = $result->next) {
    print $row->name;
}

primary_key

Sets the primary key for the current ResultSet

$rs->primary_key('id');

Access to the SQL SELECT query. Returns an array with the selected rows, which contains a hashref of values. First parameter is an array of what you want returned ie: SELECT this, that If you enter an empty array ([]), then it will return everything ie: SELECT * The second parameter is a hash of keys and values of what to search for.

my $res = $resultset->search([qw/name id status/], { status => 'active' });

my $res = $resultset->search([], { status => 'disabled' });

my $res = $resultset->search([], { -or => [ name => 'Test', name => 'Foo' ], status => 'active' });

insert

Inserts a new record into the current resultset.

my $insert = $resultset->insert({name => 'Foo', user => 'foo_bar', pass => 'baz'});
if ($insert) { print "Added user!\n"; }
else { print "Could not add user\n"; }