Inject SQL Language - apply PHP logic within statement

I use PHP to build complex queries.  For example, I might have a query that optionally joins to a table, or optionally includes a column, or has optional conditions in the where clause.
Is there a way to format this that does not break PHPStorms ability to hilight the SQL syntax?

I.e. if I close a quote to concat a variable, the syntax hilighting will not resume when I reopen the quote.

2 comments

Hi there,

Is there a way to format this that does not break PHPStorms ability to hilight the SQL syntax?

Nope -- http://youtrack.jetbrains.com/issue/WI-534

0

Thanks for the info.  It's unfortunate, but I can appreciate that it would not be a very straight forward thing to implement, and having an answer I can now stop hunting for a method to get it to work.
Having said that, if you're not using PDO then I think using sprintf() to inject the values into the query string probably the neatest work around for simply concatenating strings into the query.

0

Please sign in to leave a comment.