# $rs->count_rs->as_query,
# '(
# SELECT COUNT( * ) FROM (
- # SELECT * FROM (
- # SELECT A.*, ROWNUM r FROM (
+ # SELECT artistid FROM (
+ # SELECT artistid, ROWNUM rownum__index FROM (
# SELECT
- # me.artistid AS col1
+ # me.artistid
# FROM artist me
# START WITH name = ?
# CONNECT BY artistid = PRIOR parentid
- # ) A
- # WHERE ROWNUM < 3
- # ) B
- # WHERE r >= 1
- # ) count_subq
+ # ) me
+ # ) me
+ # WHERE rownum__index BETWEEN 1 AND 2
+ # ) me
# )',
# [ [ name => 'greatgrandchild' ] ],
# );
# select the whole cycle tree with nocylce
{
my $rs = $schema->resultset('Artist')->search({}, {
- nocycle => 1,
+ connect_by_nocycle => 1,
start_with => { name => 'cycle-root' },
'+select' => [ \ 'CONNECT_BY_ISCYCLE' ],
connect_by => { parentid => { -prior => \ 'artistid' } },