Class:...Search(3pm)
π Class::DBI::AbstractSearch β the Class:...Search(3pm) glow-up π
okay bestie, gather round, because this one is a manual page for Class::DBI::AbstractSearch, and it's literally the moment your Class::DBI setup gets a whole personality. it's giving "abstract Class::DBI's SQL with SQL::Abstract::Limit" energy, and honestly? obsessed. π¦
β¨ NAME β¨
Class::DBI::AbstractSearch β abstract Class::DBI's SQL with SQL::Abstract::Limit. that's the whole vibe. no cap.
πΈ SYNOPSIS πΈ
here's the moment you've been waiting for, the main character entrance:
package CD::Music;
use Class::DBI::AbstractSearch;
package main;
my @music = CD::Music->search_where(
artist => [ 'Ozzy', 'Kelly' ],
status => { '!=', 'outdated' },
);
my @misc = CD::Music->search_where(
{ artist => [ 'Ozzy', 'Kelly' ],
status => { '!=', 'outdated' } },
{ order_by => "reldate DESC",
limit_dialect => 'LimitOffset',
limit => 1
offset => 2 });
look at her go. π
π DESCRIPTION π
so like, Class::DBI::AbstractSearch is a Class::DBI plugin, right? and its whole job β its purpose, its calling, its moment β is to glue SQL::Abstract::Limit into Class::DBI. that's it. that's the slay. π₯
π METHODS π
using this module adds the following methods into your data class. yes, your data class. it's giving generous. π«Ά
π search_where
$class->search_where(%where);
takes a hash to specify the WHERE clause. for the hash options, go look at SQL::Abstract, bestie β that's where the deets live.
$class->search_where(\%where,\%attrs);
takes a hash reference to specify the WHERE clause. again, see SQL::Abstract for the hash options. and then it takes a hash reference to specify additional query attributes. here's the tea on which attributes Class::DBI::AbstractSearch actually uses:
order_byβ an array reference of fields that will be used to order the results of your query. lineup time. β¨limit_dialectβ a scalar, DBI handle, object class, etc. that describes the syntax model for a LIMIT/OFFSET SQL clause. please seeSQL::Abstract::Limitfor more information, i'm not gonna gatekeep but i'm also not gonna re-explain it. πlimitβ a scalar value that will be used for the LIMIT argument in a query. keeping it contained, periodt.offsetβ a scalar value that will be used for the OFFSET argument in a query. the little scoot. π
any other attributes are passed to the SQL::Abstract::Limit constructor, and can be used to control how queries are created. for example, to use 'AND' instead of 'OR' by default, use:
$class->search_where(\%where, { logic => 'AND' });
lowkey iconic that it just hands the rest over like that. π
π AUTHOR π
Tatsuhiko Miyagawa <miyagawa@bulknews.net> β with some help from the cdbi-talk mailing list, especially:
Tim Bunce
Simon Wilcox
Tony Bowden
and listen: this library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. so like, go off. legally. πΈ
π¦ SEE ALSO π¦
Class::DBISQL::AbstractSQL::Abstract::Limit
bestie reminder: this page ships as part ofperl v5.32.0, dated2021-01-01, and it's a User Contributed Perl Documentation page forClass:...Search(3pm). okay love u bye πβ¨π
π¦ where this page comes from
- debian bookworm: libclass-dbi-abstractsearch-perl 0.07-4.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libclass-dbi-abstractsearch-perl 0.07-4.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libclass-dbi-abstractsearch-perl 0.07-4.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libclass-dbi-abstractsearch-perl 0.07-4.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libclass-dbi-abstractsearch-perl 0.07-4.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libclass-dbi-abstractsearch-perl 0.07-4.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms