PHP Variable Statement At End of SQL Query Produce

2019-05-25 04:27发布

问题:

I have SQL Dialects enabled for my project. I am using the below code

There is a PHP variable that is set if a certain condition is met. SQL Dialects thinks there is an error at the end of the SQL statement since it expects either a GROUP BY, HAVING, or other SQL declaration after the WHERE declaration. It underlines the variable and the entire file is marked as having known syntax errors. Is there a way for me to create an exception in SQL Dialects so this is ignored?

回答1:

The inspection is performed by Database Support module:

  1. which knows nothing about PHP variables;
  2. this is not a valid SQL from that specific dialect point of view (MySQL/SQL Server/whatever).

Your only choice ATM is to use "Keywords Only" as SQL Dialect where only basic syntax highlighting will be available.

Other than that:

  • http://youtrack.jetbrains.com/issue/WI-2450
  • http://youtrack.jetbrains.com/issue/WI-7594
  • somehow related http://youtrack.jetbrains.com/issue/WI-2324


标签: phpstorm