string concatenation with %s
Gary Willoughby via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jan 7 08:47:42 PST 2015
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', '%s', '%s');", date[i], a_fredericksburg[i],
> fredericksburg[i], a_college[i], college[i], a_planetary[i],
> planetary[i]);
>
>
> 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?
Just FYI use prepared statements instead of string concatenation
for SQL queries.
http://en.wikipedia.org/wiki/Prepared_statement
More information about the Digitalmars-d-learn
mailing list