Search code examples
phpstorm

PHP Variable Statement At End of SQL Query Produces Error Flag SQL Dialects


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

enter image description here

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?


Solution

  • 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: