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

ActiveRecord not add quotation to the field name #1613

Closed
doctoruna opened this issue Dec 25, 2013 · 1 comment
Closed

ActiveRecord not add quotation to the field name #1613

doctoruna opened this issue Dec 25, 2013 · 1 comment

Comments

@doctoruna
Copy link

Foe example
static::find()->where("show = 1")->all();

will show database exception and 'show' is mysql keyword and it's not quoted, the executed query was

select * from countries where show=1;

which should be
select * from countries where show=1;

@klimov-paul
Copy link
Member

This is expected: you are responsible for any plain SQL on your own.
Query class still provides you several shortcut syntaxes.

In this particular case you should use:

MyArClass::find()->where(["show" => 1])->all(); 

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