How to disable SQL inspections?

In several of my PHP files, I have SQL statements that are autodetected. These statements are always reported as errors by PHPStorm. For example,

select * from $schema.$table where x = ':id'


gives an error at the '.' of "( or ONLY expected, got _" which is totally incorrect. Apparently the inspections can't handle variables. How do I turn them off?

In settings, inspections, I have turned off all of the SQL inspections. Where do I go to get rid of these remaining erroroneous inspections?

4 comments

Hi there,

You may change Default SQL Dialect from your (MySQL/SQL Server/etc) to "keywords only" -- no inspections will be run at all -- only basic syntax highlighting.

This can be done at "Settings | SQL Dialects" (set once for the whole project).

Regarding "handling variables": http://youtrack.jetbrains.com/issue/WI-2450

0

Awesome, thanks. That resolved my issue nicely.

For others that search this in the future, if you change the SQL dialects in Settings > Language Injections, "keywords only" is called "Generic SQL" in the pulldowns, but once selected will be listed as "keywords only" in the table.

0

Not really.

"Settings | SQL Dialects" is NOT the same as "Settings | Language Injections". And in "Settings | SQL Dialects" the correct option called "keywords only"

0

There is no "SQL Dialects" major section in IntelliJ now.  When I search on "SQL Dialects" in the preferences, it opens "Languages and Frameworks" and "SQL Dialects" appears there.  There is no "keywords only" option there, just "Generic SQL". When I set the global and project SQL dialects to Generic SQL, it solves the problem.

Searching for "keywords only" comes up blank.

 

1

Please sign in to leave a comment.