string concatenation with %s

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Mar 30 10:22:10 PDT 2015


On Monday, 30 March 2015 at 17:18:01 UTC, Suliman wrote:
> same problem. I am preparing string to next SQL request:
>
> string sss = format("SELECT * FROM test.imgs WHERE src LIKE 
> CONCAT('%', REPLACE(CAST(CURDATE()as char), "-", ""), '%') OR 
> CONCAT('%', CAST(CURDATE()as char), '%')");

Here's your code without SQL noise:

string sss = format("foo"-", ""bar");

It should be obvious now that you forgot to escape those double 
quotes.


More information about the Digitalmars-d-learn mailing list