QBit::Application::Model::DB::Query
Base class for DB queries.
_found_rows
No arguments.
Method called from "new" before return object.
Arguments:
%opts - options with keys
table - object
fields (optional, default: all fields)
filter (optional)
Return values:
$query - object
Example:
my $query = $app->db->query->select( table => $app->db->users, fields => [qw(id login)], filter => {id => 3}, );
alias (optional)
join_type (optional, default: 'INNER JOIN')
join_on (optional, default: use foreign keys)
my $join_query = $query->join( table => $app->db->fio, fields => [qw(name surname)], filter => ['name' => 'LIKE' => \'Max'], join_type => 'INNER JOIN', join_on => ['user_id' => '=' => {'id' => $app->db->users}], );
join_type => 'LEFT JOIN'
join_type => 'RIGHT JOIN'
@fields
my $group_query = $query->group_by(qw(name surname));
$expression
my $query_with_having = $query->having([cnt => '>=' => \100]);
@fields - fields or reference to array
my $order_query = $query->order_by('id', ['login', 1]);
@limit
my $limit_query = $query->limit(100, 200);
my $distinct_query = $query->distinct();
all - boolean (optional, default: FALSE)
my $union_query = $query->union( $app->db->query->select( table => $app->db->people, fields => [qw(id login name surname)] ), all => FALSE, );
all => TRUE
$flag - boolean
my $calc_rows_query = $query->calc_rows(TRUE);
my $all_langs_query = $query->all_langs(TRUE);
my $for_update_query = $query->for_update();
offset - number (optional, default: 0)
$sql - string
my $sql = $query->get_sql_with_data();
$data - reference to array
my $data = $query->get_all();
$bool
my $bool = $query->found_rows();
For more information see code and test.
To install QBit::Application::Model::DB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm QBit::Application::Model::DB
CPAN shell
perl -MCPAN -e shell install QBit::Application::Model::DB
For more information on module installation, please visit the detailed CPAN module installation guide.