You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using PHQL to make a query with joins generates broken PDO query.
For example, next code:
$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 50');
Generates the following query:
SELECT*FROM (SELECT Z1.*, ROWNUM PHALCON_RN FROM
(SELECTp.PAY_ORDER_POS_IDAS payOrderPosId,
o.PAY_DATEAS payDate, a.LAST_NAMEAS lastName FROM PAY_ORDER_POS AS p
INNER JOIN PAY_ORDER AS o ONp.PAY_ORDER_ID=o.PAY_ORDER_IDINNER JOIN ANKETA AS a ONa.ANKETA_ID=o.ANKETA_ID)
Z1 WHERE ROWNUM <=50)
SELECT*FROM (SELECT Z1.*, ROWNUM PHALCON_RN FROM (SELECTp.PAY_ORDER_POS_IDAS payOrderPosId, o.PAY_DATEAS payDate, a.LAST_NAMEAS lastName FROM PAY_ORDER_POS AS p INNER JOIN PAY_ORDER AS o ONp.PAY_ORDER_ID=o.PAY_ORDER_IDINNER JOIN ANKETA AS a ONa.ANKETA_ID=o.ANKETA_ID) Z1 WHERE ROWNUM <=50)
which results in error:
SQLSTATE[HY000]: General error: 907 OCIStmtExecute: ORA-00907: missing right parenthesis (/root/build/php-5.6.17/ext/pdo_oci/oci_statement.c:148)
Trying to query without limit gives another error:
$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');
SELECTp.PAY_ORDER_POS_IDAS payOrderPosId, o.PAY_DATEAS payDate, a.LAST_NAMEAS lastName
FROM PAY_ORDER_POS AS p
INNER JOIN PAY_ORDER AS o ONp.PAY_ORDER_ID=o.PAY_ORDER_IDINNER JOIN ANKETA AS a ONa.ANKETA_ID=o.ANKETA_ID
SELECTp.PAY_ORDER_POS_IDAS payOrderPosId, o.PAY_DATEAS payDate, a.LAST_NAMEAS lastName FROM PAY_ORDER_POS AS p INNER JOIN PAY_ORDER AS o ONp.PAY_ORDER_ID=o.PAY_ORDER_IDINNER JOIN ANKETA AS a ONa.ANKETA_ID=o.ANKETA_ID
SQLSTATE[HY000]: General error: 933 OCIStmtExecute: ORA-00933: SQL command not properly ended (/root/build/php-5.6.17/ext/pdo_oci/oci_statement.c:148)
Checking this with SQLDeveloper i figured that AS in the table naming should be omitted for Oracle. Therefore correct query is following:
SELECTp.PAY_ORDER_POS_IDAS payOrderPosId, o.PAY_DATEAS payDate, a.LAST_NAMEAS lastName
FROM PAY_ORDER_POS p
INNER JOIN PAY_ORDER o ONp.PAY_ORDER_ID=o.PAY_ORDER_IDINNER JOIN ANKETA a ONa.ANKETA_ID=o.ANKETA_ID
A little more investigation is that the first error about "right paranthesis" is as well caused by extra "AS"es in the query.
Phalcon version: 2.1.0 RC 1
The text was updated successfully, but these errors were encountered:
Using PHQL to make a query with joins generates broken PDO query.
For example, next code:
Generates the following query:
which results in error:
SQLSTATE[HY000]: General error: 907 OCIStmtExecute: ORA-00907: missing right parenthesis (/root/build/php-5.6.17/ext/pdo_oci/oci_statement.c:148)
Trying to query without limit gives another error:
SQLSTATE[HY000]: General error: 933 OCIStmtExecute: ORA-00933: SQL command not properly ended (/root/build/php-5.6.17/ext/pdo_oci/oci_statement.c:148)
Checking this with SQLDeveloper i figured that AS in the table naming should be omitted for Oracle. Therefore correct query is following:
A little more investigation is that the first error about "right paranthesis" is as well caused by extra "AS"es in the query.
Phalcon version: 2.1.0 RC 1
The text was updated successfully, but these errors were encountered: