Comments on: Tame SQL With Multiline Quotes in C# and PHP http://gen5.info/q/2008/05/13/tame-sql-with-multiline-quotes-in-c-and-php/ Towards Intelligent Systems Wed, 11 Jul 2012 12:59:08 +0000 hourly 1 http://wordpress.org/?v=3.0.3 By: JJ http://gen5.info/q/2008/05/13/tame-sql-with-multiline-quotes-in-c-and-php/comment-page-1/#comment-1095 JJ Tue, 14 Oct 2008 03:52:15 +0000 http://gen5.info/q/2008/05/13/tame-sql-with-multiline-quotes-in-c-and-php/#comment-1095 in C and C++ you can do like java but without the + symbols. char* query= " SELECT *" " FROM foo" " WHERE bar=66" ; but if you need linebreaks in the query you need to add them explicitly. in C and C++ you can do like java but without the + symbols.

char* query=
” SELECT *”
” FROM foo”
” WHERE bar=66″ ;

but if you need linebreaks in the query you need to add them explicitly.

]]>
By: admin http://gen5.info/q/2008/05/13/tame-sql-with-multiline-quotes-in-c-and-php/comment-page-1/#comment-348 admin Thu, 15 May 2008 20:59:59 +0000 http://gen5.info/q/2008/05/13/tame-sql-with-multiline-quotes-in-c-and-php/#comment-348 Yes, the "here quotes" in PHP are an effective way to do this too. Yes, the “here quotes” in PHP are an effective way to do this too.

]]>
By: monk.e.boy http://gen5.info/q/2008/05/13/tame-sql-with-multiline-quotes-in-c-and-php/comment-page-1/#comment-340 monk.e.boy Wed, 14 May 2008 14:20:32 +0000 http://gen5.info/q/2008/05/13/tame-sql-with-multiline-quotes-in-c-and-php/#comment-340 damn, my formatting got lost. monk.e.boy damn, my formatting got lost.

monk.e.boy

]]>
By: monk.e.boy http://gen5.info/q/2008/05/13/tame-sql-with-multiline-quotes-in-c-and-php/comment-page-1/#comment-339 monk.e.boy Wed, 14 May 2008 14:20:14 +0000 http://gen5.info/q/2008/05/13/tame-sql-with-multiline-quotes-in-c-and-php/#comment-339 Doesn't everyone do SQL in PHP like this? : $sql = <<<EOT SELECT * FROM stuff WHERE x=y EOT; // run $sql Why would you write it any other way? ;-) monk.e.boy Doesn’t everyone do SQL in PHP like this? :

$sql = <<<EOT

SELECT *
FROM stuff
WHERE
x=y

EOT;

// run $sql

Why would you write it any other way? ;-)

monk.e.boy

]]>
By: Richard@Home http://gen5.info/q/2008/05/13/tame-sql-with-multiline-quotes-in-c-and-php/comment-page-1/#comment-338 Richard@Home Wed, 14 May 2008 10:19:27 +0000 http://gen5.info/q/2008/05/13/tame-sql-with-multiline-quotes-in-c-and-php/#comment-338 In PHP you can use the heredoc syntax: $query = <<<SQL SELECT foo, bar FROM baz WHERE foo='boo' SQL; or just regular strings: $query = " SELECT ... "; or better yet - put it in a stored procedure ;-) In PHP you can use the heredoc syntax:

$query = <<<SQL
SELECT
foo,
bar
FROM
baz
WHERE foo=’boo’
SQL;

or just regular strings:
$query = ”
SELECT

“;

or better yet – put it in a stored procedure ;-)

]]>