Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHQL returning empty rows for query (Oracle) #11801

Closed
Skydev0h opened this issue May 17, 2016 · 1 comment
Closed

PHQL returning empty rows for query (Oracle) #11801

Skydev0h opened this issue May 17, 2016 · 1 comment

Comments

@Skydev0h
Copy link
Contributor

Considering the following piece of code:

    function accessProtected($obj, $prop) {
        $reflection = new ReflectionClass($obj);
        $property = $reflection->getProperty($prop);
        $property->setAccessible(true);
        return $property->getValue($obj);
    }

    public function testAction() {
        $res = $this->modelsManager->executeQuery('select p.payOrderPosId, o.payDate, a.lastName ' . 
            'from HL\\PayOrderPos p join HL\\PayOrder o on p.payOrderId = o.payOrderId ' .
            'join HL\\Anketa a on a.anketaId = o.anketaId limit 10');
        $result = $this->accessProtected($res, '_result');
        $sql = $this->accessProtected($result, '_sqlStatement');
        echo '<pre>';
        echo "SQL: $sql\n\n";
        foreach ($res as $k => $r) {
            echo $k . ":\n"; var_dump($r);
            var_dump($r->toArray()); echo "\n";
        }
        die();
    }

It generates the following result: (i have already applied my "AS" aliasing fix)

SQL: SELECT * FROM (SELECT Z1.*, ROWNUM PHALCON_RN FROM (SELECT p.PAY_ORDER_POS_ID AS payOrderPosId, o.PAY_DATE AS payDate, a.LAST_NAME AS lastName FROM PAY_ORDER_POS p  INNER JOIN PAY_ORDER o ON p.PAY_ORDER_ID = o.PAY_ORDER_ID INNER JOIN ANKETA a ON a.ANKETA_ID = o.ANKETA_ID) Z1 WHERE ROWNUM <= 10)

0:
object(Phalcon\Mvc\Model\Row)#147 (0) {
}
array(0) {
}

1:
object(Phalcon\Mvc\Model\Row)#148 (0) {
}
array(0) {
}

2:
object(Phalcon\Mvc\Model\Row)#147 (0) {
}
array(0) {
}

3:
object(Phalcon\Mvc\Model\Row)#148 (0) {
}
array(0) {
}

4:
object(Phalcon\Mvc\Model\Row)#147 (0) {
}
array(0) {
}

5:
object(Phalcon\Mvc\Model\Row)#148 (0) {
}
array(0) {
}

6:
object(Phalcon\Mvc\Model\Row)#147 (0) {
}
array(0) {
}

7:
object(Phalcon\Mvc\Model\Row)#148 (0) {
}
array(0) {
}

8:
object(Phalcon\Mvc\Model\Row)#147 (0) {
}
array(0) {
}

9:
object(Phalcon\Mvc\Model\Row)#148 (0) {
}
array(0) {
}

Meanwhile the generated SQL query to database:

SELECT * FROM (SELECT Z1.*, ROWNUM PHALCON_RN FROM (SELECT p.PAY_ORDER_POS_ID AS payOrderPosId, o.PAY_DATE AS payDate, a.LAST_NAME AS lastName FROM PAY_ORDER_POS p  
INNER JOIN PAY_ORDER o ON p.PAY_ORDER_ID = o.PAY_ORDER_ID INNER JOIN ANKETA a ON a.ANKETA_ID = o.ANKETA_ID) Z1 WHERE ROWNUM <= 10);

gives correct results from the database.
image

What's the problem here?

@sergeyklay
Copy link
Contributor

Phalcon does not support Oracle. Refer to #12008

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants