Re: string concatenation with %s

2015-03-30 Thread anonymous via Digitalmars-d-learn
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

Re: string concatenation with %s

2015-03-30 Thread Suliman via Digitalmars-d-learn
string sss = format(foo-, bar); It should be obvious now that you forgot to escape those double quotes. Thanks! Is there any way to stay string as is. without need of it's escaping and so on? It's seems I have seen something like it in docs, but I am not sure about it...

Re: string concatenation with %s

2015-03-30 Thread anonymous via Digitalmars-d-learn
On Monday, 30 March 2015 at 17:34:20 UTC, Suliman wrote: string sss = format(foo-, bar); It should be obvious now that you forgot to escape those double quotes. Thanks! Is there any way to stay string as is. without need of it's escaping and so on? It's seems I have seen something like it

Re: string concatenation with %s

2015-03-30 Thread Suliman via Digitalmars-d-learn
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), '%')); but I am getting next error: source\app.d(178): Error: invalid array

Re: string concatenation with %s

2015-01-07 Thread Justin Whear via Digitalmars-d-learn
On Wed, 07 Jan 2015 16:38:23 +, Suliman wrote: I except that writefln have some behavior as string concatenation, but it does not. IS there any way to put needed values in place of %s in string? std.string.format interpolates string with the same behavior as writefln but returns the

Re: string concatenation with %s

2015-01-07 Thread Gary Willoughby via Digitalmars-d-learn
On Wednesday, 7 January 2015 at 16:38:25 UTC, Suliman wrote: I need to construct complex SQL request, like: string sql = (INSERT INTO test.geomagnetic (`date`, `a_fredericksburg`, `fredericksburg`, `a_college`, `college`, `a_planetary`, `planetary`) VALUES ('%s', '%s', '%s', '%s', '%s',

Re: string concatenation with %s

2015-01-07 Thread bearophile via Digitalmars-d-learn
Suliman: I need to construct complex SQL request, like: string sql = (INSERT INTO test.geomagnetic (`date`, `a_fredericksburg`, `fredericksburg`, `a_college`, `college`, `a_planetary`, `planetary`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s');, date[i], a_fredericksburg[i],

Re: string concatenation with %s

2015-01-07 Thread Suliman via Digitalmars-d-learn
Please show the _clean_ input, followed by an output example. Bye, bearophile to prevent visual corruption I had past it here: http://www.everfall.com/paste/id.php?ftzy9lxr6yfy Just FYI use prepared statements instead of string concatenation for SQL queries. You mean some tools, that

Re: string concatenation with %s

2015-01-07 Thread Suliman via Digitalmars-d-learn
std.string.format interpolates string with the same behavior as writefln Thanks!

Re: string concatenation with %s

2015-01-07 Thread novice2 via Digitalmars-d-learn
what if a_college[i] will contain ` char? almost SQL have prepare statement...