Using Python's triple-quoted strings I can define strings containing '
, backticks, or "
without having to care about it:
hello = """
This string is bounded by triple double quotes (3 times ").
Unescaped newlines in the string are retained, though
it is still possible to use all normal escape sequences.
Whitespace at the beginning of a line is
significant.
This string ends in a newline.
"""
In PHP I could use heredoc (<<<
):
$str = <<<EOD
Example of string
spanning multiple lines
using heredoc syntax.
EOD;
How can I do the same in MySQL? Right now I have to make sure I escape the character I use to delimitate, e.g. if I use '
as delimiter I have to use \'
in my string:
UPDATE article
SET article_text ='
Extra-virgin olive oil is a staple in any chef\'s kitchen.
'
I would like to be able something like
UPDATE article
SET article_text ='''
Extra-virgin olive oil is a staple in any chef's kitchen.
'''