class::dbi::plugin::abstractcount(3pm) [debian man page]
AbstractCount(3pm) User Contributed Perl Documentation AbstractCount(3pm)NAME
Class::DBI::Plugin::AbstractCount - get COUNT(*) results with abstract SQL
SYNOPSIS
use base 'Class::DBI';
use Class::DBI::Plugin::AbstractCount;
my $count = Music::Vinyl->count_search_where(
{ artist => 'Frank Zappa'
, title => { like => '%Shut Up 'n Play Yer Guitar%' }
, released => { between => [ 1980, 1982 ] }
});
DESCRIPTION
This Class::DBI plugin combines the functionality from Class::DBI::Plugin::CountSearch (counting objects without having to use an array or
an iterator), and Class::DBI::AbstractSearch, which allows complex where-clauses a la SQL::Abstract.
METHODS
count_search_where
Takes a hashref with the abstract where-clause. An additional attribute hashref can be passed to influence the default behaviour: arrayrefs
are OR'ed, hashrefs are AND'ed.
TODO
More tests, more doc.
SEE ALSO
SQL::Abstract for details about the where-clause and the attributes.
Class::DBI::AbstractSearch
Class::DBI::Plugin::CountSearch
AUTHOR
Jean-Christophe Zeus, <mail@jczeus.com> with some help from Tatsuhiko Myagawa and Todd Holbrook.
COPYRIGHT AND LICENSE
Copyright (C) 2004 by Jean-Christophe Zeus
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.0 2009-07-01 AbstractCount(3pm)
Check Out this Related Man Page
Class::DBI::AbstractSearch(3pm) User Contributed Perl Documentation Class::DBI::AbstractSearch(3pm)NAME
Class::DBI::AbstractSearch - Abstract Class::DBI's SQL with SQL::Abstract::Limit
SYNOPSIS
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 });
DESCRIPTION
Class::DBI::AbstractSearch is a Class::DBI plugin to glue SQL::Abstract::Limit into Class::DBI.
METHODS
Using this module adds following methods into your data class.
search_where
$class->search_where(%where);
Takes a hash to specify WHERE clause. See SQL::Abstract for hash options.
$class->search_where(\%where,\%attrs);
Takes hash reference to specify WHERE clause. See SQL::Abstract for hash options. Takes a hash reference to specify additional query
attributes. Class::DBI::AbstractSearch uses these attributes:
o order_by
Array reference of fields that will be used to order the results of your query.
o limit_dialect
Scalar, DBI handle, object class, etc. that describes the syntax model for a LIMIT/OFFSET SQL clause. Please see
SQL::Abstract::Limit for more information.
o limit
Scalar value that will be used for LIMIT argument in a query.
o offset
Scalar value that will be used for OFFSET argument in a query.
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' });
AUTHOR
Tatsuhiko Miyagawa <miyagawa@bulknews.net> with some help from cdbi-talk mailing list, especially:
Tim Bunce
Simon Wilcox
Tony Bowden
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
Class::DBI, SQL::Abstract, SQL::Abstract::Limit
perl v5.10.0 2009-07-21 Class::DBI::AbstractSearch(3pm)