Skip to content

Phalcon\Mvc\Model::find() with limit returns no results in Oracle #11217

@rlaffers

Description

@rlaffers

Phalcon 2.0.8
Oracle 10g.

There seems to be a problem with the Oracle dialect. When running

        $result = Languages::find(array('limit' => 2));
        echo '<pre>' . var_export($result->toArray(), 1) . '</pre>';

the result is empty. I logged the SQL query produced by this code:

SELECT * FROM (SELECT Z1.*, ROWNUM PHALCON_RN FROM (SELECT LANGUAGE.ID_LANGUAGE, LANGUAGE.TITLE, LANGUAGE.CODE_2, LANGUAGE.CODE_3, LANGUAGE.VALID, LANGUAGE.USER_ACTOR, LANGUAGE.LOCALE FROM COMMON.LANGUAGE) Z1 WHERE ROWNUM <= 0)
[params: Array
(
    [APL0] => 2
)
] 

The param APL0 seems to be ignored - it is not used anywhere in the query.
Also, please note the ROWNUM in Oracle starts at 1, not 0 as reported here.

Language is my model extending \Phalcon\Mvc\Model. It uses columnMap() with the columns listed in the SQL query.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions