Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change search_like example to use search #96

Open
wants to merge 5 commits into
base: current/blead
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/DBIx/Class/Manual/Intro.pod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class defines one Table, which defines the Columns it has, along with
any Relationships it has to other tables. (And oh, so much more
besides) The important thing to understand:

A Result class == Table
I<A Result class == Table>

(most of the time, but just bear with my simplification)

Expand Down Expand Up @@ -50,8 +50,7 @@ You could easily achieve it.

The important thing to understand:

Any time you would reach for a SQL query in DBI, you are
creating a DBIx::Class::ResultSet.
I<Any time you would reach for a SQL query in DBI, you are creating a DBIx::Class::ResultSet.>

=head2 Search is like "prepare"

Expand All @@ -61,8 +60,7 @@ use a method that wants to access the data. (Such as "next", or "first")

The important thing to understand:

Setting up a ResultSet does not execute the query; retrieving
the data does.
I<Setting up a ResultSet does not execute the query; retrieving the data does.>

=head2 Search results are returned as Rows

Expand Down Expand Up @@ -363,10 +361,10 @@ In list context, the C<search> method returns all of the matching rows:
print $album->artist . ' - ' . $album->title;
}

We also provide a handy shortcut for doing a C<LIKE> search:
We also provide a way to do C<LIKE> searches:

# Find albums whose artist starts with 'Jimi'
my $rs = $schema->resultset('Album')->search_like({ artist => 'Jimi%' });
my $rs = $schema->resultset('Album')->search({ artist => { like => 'Jimi%' } });

Or you can provide your own C<WHERE> clause:

Expand Down Expand Up @@ -402,6 +400,8 @@ attributes:

C<@albums> then holds the two most recent Bob Marley albums.

For more information on searching, see L<DBIx::Class::ResultSet/search>.

For more information on what you can do with a L<DBIx::Class::ResultSet>, see
L<DBIx::Class::ResultSet/METHODS>.

Expand Down