1
0
mirror of synced 2025-02-21 14:43:14 +03:00

Merge branch 'master' of github.com:doctrine/doctrine2

This commit is contained in:
Jonathan H. Wage 2010-05-25 15:52:39 -04:00
commit 4934c49537
2 changed files with 31 additions and 22 deletions

View File

@ -527,7 +527,7 @@ class Expr
*/
private function _quoteLiteral($literal)
{
if (is_numeric($literal)) {
if (is_numeric($literal) && !is_string($literal)) {
return (string) $literal;
} else {
return "'" . str_replace("'", "''", $literal) . "'";

View File

@ -220,6 +220,15 @@ class ExprTest extends \Doctrine\Tests\OrmTestCase
$this->assertEquals(5, (string) $this->_expr->literal(5));
}
/**
* @group regression
* @group DDC-610
*/
public function testLiteralExprProperlyQuotesStrings()
{
$this->assertEquals("'00010001'", (string) $this->_expr->literal('00010001'));
}
public function testGreaterThanOrEqualToExpr()
{
$this->assertEquals('5 >= 2', (string) $this->_expr->gte(5, 2));