]> git.andy128k.dev Git - ipf-legacy-orm.git/commitdiff
add coalesce function
authorAndrey Kutejko <andy128k@gmail.com>
Thu, 25 Jul 2013 20:11:23 +0000 (23:11 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Thu, 25 Jul 2013 20:11:23 +0000 (23:11 +0300)
ipf/orm/expression/driver.php

index a256d8edabf421e8b0f10fb98fa3b3ca21862f41..5c7baa27573910896d3327fe1cb522fb86e786c3 100644 (file)
@@ -107,6 +107,13 @@ class IPF_ORM_Expression_Driver extends IPF_ORM_Connection_Module
         return 'NOW()';
     }
 
+    public function coalesce($expression1, $expression2)
+    {
+        $expression1 = $this->getIdentifier($expression1);
+        $expression2 = $this->getIdentifier($expression2);
+        return 'COALESCE(' . $expression1 . ', ' . $expression2 . ')';
+    }
+
     public function soundex($value)
     {
         throw new IPF_ORM_Exception('SQL soundex function not supported by this driver.');
@@ -277,4 +284,5 @@ class IPF_ORM_Expression_Driver extends IPF_ORM_Connection_Module
         }
         return $m . '(' . implode(', ', $a) . ')';
     }
-}
\ No newline at end of file
+}
+