Unverified Commit e9c99321 authored by belgattitude's avatar belgattitude Committed by Luís Cobucci

Improves readability of escape sequences

parent 45ea287c
......@@ -451,13 +451,29 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
* Ensure default values (un-)escaping is properly done by mysql platforms.
* The test is voluntarily relying on schema introspection due to current
* doctrine limitations. Once #2850 is landed, this test can be removed.
* @see https://dev.mysql.com/doc/refman/5.7/en/string-literals.html
*/
public function testEnsureDefaultsAreUnescapedFromSchemaIntrospection() : void
{
$platform = $this->_sm->getDatabasePlatform();
$this->_conn->query('DROP TABLE IF EXISTS test_column_defaults_with_create');
$default = "a\\0b\\'c\"d\te\\Zf\\\\g''h";
// https://dev.mysql.com/doc/refman/5.7/en/string-literals.html
$escapeSequences = [
"\\0", // An ASCII NUL (X'00') character
"\\'", "''", // Single quote
'\\"', '""', // Double quote
'\\b', // A backspace character
'\\n', // A new-line character
'\\r', // A carriage return character
'\\t', // A tab character
'\\Z', // ASCII 26 (Control+Z)
'\\\\', // A backslash (\) character
'\\%', // A percent (%) character
'\\_', // An underscore (_) character
];
$default = implode('+', $escapeSequences);
$sql = "CREATE TABLE test_column_defaults_with_create(
col1 VARCHAR(255) NULL DEFAULT {$platform->quoteStringLiteral($default)}
)";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment