SQL Dialects reporting statement constructions as errors
Hi
I am geting errors reported when using the SQL dialect MySQL when constructing SQL statement using PHP variables to supply references such as table names, column names etc. The reported error is "<reference> expected, got ${". This also occurs with most other dialects and I can only remove the errors by setting the
dialect to Generic. I am not sure whether this means that Generic is not perfoming any SQL syntax chacking and therefore not throwing the error or whether the Generic dialect is recognising the SQL construction from a variable. I suspect it is the former here but if it is the latter then the MySQL dialect should also be able to recognize the same construction for the reference.
Is there any way to
turn off this specific check on the syntax
or
lower it to a warning rather than an error
or
even better recognize that references in the syntax can have the form '.$variable.'?
It defeats the purpose of the syntax checking to have a large number of errors reported which are not in fact errors, but a result of the construction of the SQL statement. The construction of SQL statements using variables is is so common in PHP programming that it would be nice to be able to recognise it, particularly if in a more general form such as '.php_expression.'.
Please sign in to leave a comment.
Hi there,
1) What is your IDE version exactly?
2) Please provide basic code sample (so that we all work with the same example)
3) Screenshot fo your "Settings | Tools | Database"
-----
Generic means syntax highlighting only, no proper checks against actual DB structure or anything like that.
From https://www.jetbrains.com/phpstorm/help/sql-dialects.html