NAME
Persistence::Entity::Query - Database entity query.
CLASS HIERARCHY
SQL::Query
|
+----Persistence::Entity::Query
SYNOPSIS
my $entity_manager = $class->new(connection_name => 'my_connection');
$entity_manager->add_entities(SQL::Entity->new(
name => 'emp',
unique_expression => 'empno',
columns => [
sql_column(name => 'ename'),
sql_column(name => 'empno'),
sql_column(name => 'deptno')
],
indexes => [
sql_index(name => 'emp_idx1', columns => ['empno'])
]
));
package Employee;
use Abstract::Meta::Class ':all';
use Persistence::ORM ':all';
entity 'emp';
column empno => has('$.no') ;
column ename => has('$.name');
column deptno => has('$.deptno');
my $query = $entity_manager->query(emp => 'Employee');
$query->set_offset(20);
$query->set_limit(5);
my @emp = $query->execute();
# do stuff $emp[0]->name
my $query = $entity_manager->query('emp');
$query->set_offset(20);
$query->set_limit(5);
my @emp = $query->execute();
# do stuff $emp[0]->{ename}
DESCRIPTION
Represents database query based on entity definition.
EXPORT
None
ATTRIBUTES
- name
- cursor_callback
- condition_converter_callback
METHODS
- execute
- query_setup
SEE ALSO
SQL::Query Persistence::Entity
COPYRIGHT AND LICENSE
The Persistence::Entity::Query module is free software. You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
AUTHOR
Adrian Witas, adrian@webapp.strefa.pl