-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
When building queries, DBAL doesn't consider reserved keywords #3152
Comments
The same is reproducible with |
@Ocramius we can use this issue as a starting point for discussion of whether/how identifiers should be quoted in the DBAL. |
Hi guys I'm facing the same problem in MYSQL, I have a field called 'desc': $conn->insert('my_table', [
'desc' => 'Hello',
...
]); The "desc" word throws a SyntaxException. My solution was to put mysql quote as array parameter like this: $conn->insert('my_table', [
'`desc`' => 'Hello', // `desc`
...
]); May it can be a parcial solution, can we discuss a fix?? Best. |
@leoqbc we haven't given enough thought to this issue. Long story short, even if it's relatively easy to fix in Therefore, the only valid solution right now is to quote identifiers manually (e.g. by using |
Make sense, as I imagined, not easy to patch... Well Maybe it can be refactored in future, since It breaks SOLID's SRP IMHO, but I dont know the complete API. Thanks @morozov and good luck on this. |
Closing as the issue is by design. The builder accepts SQL expressions as column names, so the consumer of the API is responsible for building proper SQL. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug Report
When building queries, DBAL doesn't consider reserved keywords
Summary
Assuming
'FILE'
is a reserved keyword on the Oracle platform, I can create a table with the'file'
column using the schema manager but I can't execute anINSERT
orUPDATE
statement using theConnection
API. I also cannotSELECT
from the table usingQueryBuilder
.How to reproduce
Expected behavior
The keywords are handled consistently by the Schema Manager and Query Builder.
The text was updated successfully, but these errors were encountered: