orm: IFNULL, NULLIF functions

This commit is contained in:
Yuri Kuznetsov
2020-03-06 13:02:39 +02:00
parent ec4afe0e11
commit 770cac9b87
2 changed files with 15 additions and 0 deletions
+4
View File
@@ -162,6 +162,8 @@ abstract class Base
'NOT',
'IN',
'NOT_IN',
'IFNULL',
'NULLIF',
'BINARY',
'UNIX_TIMESTAMP',
'TIMESTAMPDIFF_DAY',
@@ -195,6 +197,8 @@ abstract class Base
'MUL',
'DIV',
'MOD',
'IFNULL',
'NULLIF',
'TIMESTAMPDIFF_DAY',
'TIMESTAMPDIFF_MONTH',
'TIMESTAMPDIFF_YEAR',
+11
View File
@@ -764,6 +764,17 @@ class QueryTest extends \PHPUnit\Framework\TestCase
$this->assertEquals($expectedSql, $sql);
}
public function testFunction18()
{
$sql = $this->query->createSelectQuery('Comment', [
'select' => [["IFNULL:(name, '')", 'test']],
'withDeleted' => true
]);
$expectedSql =
"SELECT IFNULL(comment.name, '') AS `test` FROM `comment`";
$this->assertEquals($expectedSql, $sql);
}
public function testFunctionTZ1()
{
$sql = $this->query->createSelectQuery('Comment', [