digitalmars.D - php strings demo
- Kagamin (7/7) Nov 20 2010 See attachment. It's just a thought. Anyone want this in the language?
- Kagamin (4/11) Nov 20 2010 Wrote some unittests today and thought, this feature is useful when one ...
- Adam D. Ruppe (6/7) Nov 20 2010 easy sql statements (in, e.g. unittests).
- Kagamin (2/5) Nov 20 2010 I use it too, but found it hard to maintain/check ordering and meaning o...
- Graham Fawcett (4/12) Nov 23 2010 Isn't that a small price to pay to avoid SQL injection attacks?
- Kagamin (2/5) Nov 20 2010 It's also non-trivial to implement such functionality, since MS (and Ora...
- Nick Sabalausky (13/20) Nov 21 2010 Yes.
- =?iso-8859-2?B?VG9tZWsgU293afFza2k=?= (4/11) Nov 21 2010 std.conv.text can do this job just fine, bar the "uuu not found" bit.
- Kagamin (2/13) Nov 21 2010 Ugh... really... -_-
See attachment. It's just a thought. Anyone want this in the language? --- string sval="ab128#d"; int ival=274; static assert("asdf \{sval} astt35 \{ival} zzf \{uuu} g,d" == "asdf ab128#d astt35 274 zzf uuu g,d"); //(uuu not found) ---
Nov 20 2010
Kagamin Wrote:See attachment. It's just a thought. Anyone want this in the language? --- string sval="ab128#d"; int ival=274; static assert("asdf \{sval} astt35 \{ival} zzf \{uuu} g,d" == "asdf ab128#d astt35 274 zzf uuu g,d"); //(uuu not found) ---Wrote some unittests today and thought, this feature is useful when one wants easy sql statements (in, e.g. unittests). string typeName="Employee"; int[] ids=executeVector!int("select ID from Objects where type='\{typeName}'");
Nov 20 2010
Kagamin Wrote:Wrote some unittests today and thought, this feature is useful when one wantseasy sql statements (in, e.g. unittests). Meh, I find the placeholders to be much better (safer too): db.query("select id from objects where type = ?", typeName); I generally feel the same way about all the interpolated strings. Plain old format("%s", var); works for me.
Nov 20 2010
Adam D. Ruppe Wrote:Meh, I find the placeholders to be much better (safer too): db.query("select id from objects where type = ?", typeName);I use it too, but found it hard to maintain/check ordering and meaning of parameters when you edit the query, add or remove parameters.
Nov 20 2010
On Sat, 20 Nov 2010 18:03:34 -0500, Kagamin wrote:Adam D. Ruppe Wrote:Isn't that a small price to pay to avoid SQL injection attacks? Best, GrahamMeh, I find the placeholders to be much better (safer too): db.query("select id from objects where type = ?", typeName);I use it too, but found it hard to maintain/check ordering and meaning of parameters when you edit the query, add or remove parameters.
Nov 23 2010
Adam D. Ruppe Wrote:Meh, I find the placeholders to be much better (safer too): db.query("select id from objects where type = ?", typeName);It's also non-trivial to implement such functionality, since MS (and Oracle, afaik) require named parameters.
Nov 20 2010
"Kagamin" <spam here.lot> wrote in message news:ic9fjp$1nok$1 digitalmars.com...See attachment. It's just a thought. Anyone want this in the language? --- string sval="ab128#d"; int ival=274; static assert("asdf \{sval} astt35 \{ival} zzf \{uuu} g,d" == "asdf ab128#d astt35 274 zzf uuu g,d"); //(uuu not found) ---Yes. Ruby has that to: var = 42 Actually, that's pretty common in scripting languages. Although, I'd be happy at least with a a good string templating lib. Something like: auto str1 = "The value of $name$ is $val$".render( ["name":"myVar", "val":"17"] ); auto str2 = "Alternate delimiters are ::what::".render( ["what":"useful"], "::" ); That'd be more general anyway.
Nov 21 2010
Dnia 20-11-2010 o 22:46:33 Kagamin <spam here.lot> napisa=B3(a):See attachment. It's just a thought. Anyone want this in the language?=--- string sval=3D"ab128#d"; int ival=3D274; static assert("asdf \{sval} astt35 \{ival} zzf \{uuu} g,d" =3D=3D "asdf ab128#d astt35 274 zzf uuu g,d"); //(uuu not found) ---std.conv.text can do this job just fine, bar the "uuu not found" bit. -- = Tomek
Nov 21 2010
Tomek Sowi�ski Wrote:Dnia 20-11-2010 o 22:46:33 Kagamin <spam here.lot> napisa�(a):Ugh... really... -_-See attachment. It's just a thought. Anyone want this in the language? --- string sval="ab128#d"; int ival=274; static assert("asdf \{sval} astt35 \{ival} zzf \{uuu} g,d" == "asdf ab128#d astt35 274 zzf uuu g,d"); //(uuu not found) ---std.conv.text can do this job just fine, bar the "uuu not found" bit.
Nov 21 2010