>Is it possible to specify dialect for a query using annotations?
What annotations do you have in mind exactly?
-----
In any case -- Yes -- via PHPDoc style comment using "@lang" tag just before the string with SQL code:
$sql = /** @lang MySQL */'SELECT * FROM myTable LIMIT 1';
-----
At the same time you can avoid adding extra comments and use HEREDOC/NOWDOC only. You will then just need to add (copy existing and slightly modify it) some Language Injection rule ("Settings/Preferences | Editor | Language Injections").
In short:
$sql = <<<MySQL SELECT * FROM myTable LIMIT 1 MySQL;
Correct language (or SQL Dialect in this particular case) will be taken from the label used (MySQL in our case -- Label used for identifying the rule, and then Dialect will be taken from the rule definition). You just need to copy existing injection rule and modify it so that MySQL will be used there (MySQL as a label + MySQL as SQL Dialect).
P.S. Label can be anything -- it just "MySQL" here would be pretty much self explanatory (instead of, for example, some "SecondLang" as a label).
Hi there,
>Is it possible to specify dialect for a query using annotations?
What annotations do you have in mind exactly?
-----
In any case -- Yes -- via PHPDoc style comment using "@lang" tag just before the string with SQL code:
-----
At the same time you can avoid adding extra comments and use HEREDOC/NOWDOC only. You will then just need to add (copy existing and slightly modify it) some Language Injection rule ("Settings/Preferences | Editor | Language Injections").
In short:
Correct language (or SQL Dialect in this particular case) will be taken from the label used (MySQL in our case -- Label used for identifying the rule, and then Dialect will be taken from the rule definition). You just need to copy existing injection rule and modify it so that MySQL will be used there (MySQL as a label + MySQL as SQL Dialect).
P.S. Label can be anything -- it just "MySQL" here would be pretty much self explanatory (instead of, for example, some "SecondLang" as a label).
This is exactly what I was looking for! Many thanks for your help!
Regards,
Roman