doing raw sql with createNativeQuery #4974

Closed
opened 2026-01-22 14:55:00 +01:00 by admin · 3 comments
Owner

Originally created by @ghost on GitHub (Jan 14, 2016).

Originally assigned to: @Ocramius on GitHub.

I'm trying to create a raw sql query , I get the error

Cannot evaluate expression

source code:

$rs = new Doctrine\ORM\Query\ResultSetMapping;
$query = $em->createNativeQuery('SELECT alpha*_2_code FROM my_table', $rsm);

help?

Originally created by @ghost on GitHub (Jan 14, 2016). Originally assigned to: @Ocramius on GitHub. I'm trying to create a raw sql query , I get the error ``` php Cannot evaluate expression ``` source code: ``` php $rs = new Doctrine\ORM\Query\ResultSetMapping; $query = $em->createNativeQuery('SELECT alpha*_2_code FROM my_table', $rsm); ``` help?
admin added the Invalid label 2026-01-22 14:55:00 +01:00
admin closed this issue 2026-01-22 14:55:00 +01:00
Author
Owner

@deeky666 commented on GitHub (Jan 14, 2016):

@BardiaAfshin the SQL looks from. alpha*_2_code usually is not a valid identifier if unquoted. Also where do you get the error? Is it a Doctrine or database error and which database are you using?

@deeky666 commented on GitHub (Jan 14, 2016): @BardiaAfshin the SQL looks from. `alpha*_2_code` usually is not a valid identifier if unquoted. Also where do you get the error? Is it a Doctrine or database error and which database are you using?
Author
Owner

@Ocramius commented on GitHub (Jan 20, 2016):

I just checked: there is no such string coming out of the DBAL or ORM: closing as Invalid

@Ocramius commented on GitHub (Jan 20, 2016): I just checked: there is no such string coming out of the DBAL or ORM: closing as `Invalid`
Author
Owner

@Ocramius commented on GitHub (Jan 20, 2016):

To clarify: yes, this is the database throwing an error (rightfully so)

@Ocramius commented on GitHub (Jan 20, 2016): To clarify: yes, this is the database throwing an error (rightfully so)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#4974