Style MYSQL

Is there way to style mysql that's inside PHP script e.g.

$request = "SELECT * from users where user_id = {$user_id}";


to convert operators like SELECT, FROM, WHERE OR, AND etc to upper case automatically with "reformat code"?

And secondly break lines
$request = "SELECT *
                     FROM users
                         WHERE user_id = {$user_id}";

1 comment
Comment actions Permalink

Hi Johan,

No -- SQL formatting in PhpStorm is very limited. It will not:

  • Uppercase keywords
  • Move certain portions of command to a new line


Also, the injected language fragment (like in your example -- inside string variable) -- as far as I'm aware it will not touch it at all.

You can see what it can do by checking available formatting options at Settings | Code Style | SQL

0

Please sign in to leave a comment.