SQL::Entity::Index - Entity index abstraction.
use SQL::Entity::Index; my $index = SQL::Entity::Index->new( name => 'idx_empno', columns => ['empno'], hint => ' INDEX_ASC( emp empno ) ' );
Represents index, that force resultset order by either generating ORDER BY sql fragment, or by adding hint sql fragement (Oracle, MySQL) my $entity = SQL::Entity->new( name => 'emp', primary_key => ['empno'], unique_expression => 'rowid', columns => [ sql_column(name => 'ename'), sql_column(name => 'empno'), sql_column(name => 'deptno') ], indexes => [ sql_index(name => 'idx_emp_empno', columns => ['empno'], hint => 'INDEX_ASC(emp idx_emp_empno)'), sql_index(name => 'idx_emp_ename', columns => ['ename']), ], order_index => 'idx_emp_ename' ); my ($sql, $bind_variables) = $query->query(); will return SELECT emp.* FROM ( SELECT /*+ INDEX_ASC(emp idx_emp_ename) */ ROWNUM AS the_rownum, emp.rowid AS the_rowid, emp.deptno, emp.ename, emp.empno FROM emp WHERE ROWNUM < ?) emp WHERE the_rownum >=
sql_index by 'all' tag.
order_by_cluase => 'empno desc, ename asc'
Cost base optymizer hitn (Oracle, MySQL)
#TODO add dybnamic hint based on condition objects
Creates a new instance of the SQL::Entity::Index
Returns sql fragment operand to ORDER BY cluase
SQL::Entity SQL::Entity::Column
The SQL::Entity::Index 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.
Adrian Witas, adrian@webapp.strefa.pl
To install SQL::Entity, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SQL::Entity
CPAN shell
perl -MCPAN -e shell install SQL::Entity
For more information on module installation, please visit the detailed CPAN module installation guide.