Let the caller do the quoting

parent 44f7c139
...@@ -260,7 +260,7 @@ class ExpressionBuilder ...@@ -260,7 +260,7 @@ class ExpressionBuilder
public function like($x, $y/*, ?string $escapeChar = null */) public function like($x, $y/*, ?string $escapeChar = null */)
{ {
return $this->comparison($x, 'LIKE', $y) . return $this->comparison($x, 'LIKE', $y) .
(func_num_args() >= 3 ? sprintf(" ESCAPE '%s'", func_get_arg(2)) : ''); (func_num_args() >= 3 ? sprintf(' ESCAPE %s', func_get_arg(2)) : '');
} }
/** /**
...@@ -274,7 +274,7 @@ class ExpressionBuilder ...@@ -274,7 +274,7 @@ class ExpressionBuilder
public function notLike($x, $y/*, ?string $escapeChar = null */) public function notLike($x, $y/*, ?string $escapeChar = null */)
{ {
return $this->comparison($x, 'NOT LIKE', $y) . return $this->comparison($x, 'NOT LIKE', $y) .
(func_num_args() >= 3 ? sprintf(" ESCAPE '%s'", func_get_arg(2)) : ''); (func_num_args() >= 3 ? sprintf(' ESCAPE %s', func_get_arg(2)) : '');
} }
/** /**
......
...@@ -229,7 +229,7 @@ class ExpressionBuilderTest extends \Doctrine\Tests\DbalTestCase ...@@ -229,7 +229,7 @@ class ExpressionBuilderTest extends \Doctrine\Tests\DbalTestCase
{ {
self::assertEquals( self::assertEquals(
"a.song LIKE 'a virgin' ESCAPE '💩'", "a.song LIKE 'a virgin' ESCAPE '💩'",
$this->expr->like('a.song', "'a virgin'", '💩') $this->expr->like('a.song', "'a virgin'", "'💩'")
); );
} }
...@@ -245,7 +245,7 @@ class ExpressionBuilderTest extends \Doctrine\Tests\DbalTestCase ...@@ -245,7 +245,7 @@ class ExpressionBuilderTest extends \Doctrine\Tests\DbalTestCase
{ {
self::assertEquals( self::assertEquals(
"p.description NOT LIKE '20💩%' ESCAPE '💩'", "p.description NOT LIKE '20💩%' ESCAPE '💩'",
$this->expr->notLike('p.description', "'20💩%'", '💩') $this->expr->notLike('p.description', "'20💩%'", "'💩'")
); );
} }
} }
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