Skip to content
Snippets Groups Projects
Commit a8788eda authored by Carsten  Rose's avatar Carsten Rose
Browse files

QIFEMPTY: detected empty for all - fixed. Not clear why the unit test not...

QIFEMPTY: detected empty for all - fixed. Not clear why the unit test not failed already. Unit tests checked again that they really work: they do!
parent 2a62a92e
No related branches found
No related tags found
No related merge requests found
Pipeline #2601 passed
......@@ -81,7 +81,7 @@ CREATE FUNCTION QIFEMPTY(input TEXT, token TEXT)
BEGIN
DECLARE output TEXT;
SET output =
IF(ISNULL(input) OR input = '' OR input = '0000-00-00' OR input = '0000-00-00 00:00:00', token,
IF(ISNULL(input) OR input = '' OR input = '0' OR input = '0000-00-00' OR input = '0000-00-00 00:00:00', token,
input);
RETURN output;
END;
......
......@@ -65,8 +65,17 @@ class DatabaseFunction extends AbstractDatabaseTest {
public function testQIfEmpty() {
$this->assertEquals('test', $this->db->sql('SELECT QIFEMPTY("test","-")', ROW_IMPLODE_ALL));
$this->assertEquals('<', $this->db->sql('SELECT QIFEMPTY("<","-")', ROW_IMPLODE_ALL));
$this->assertEquals('-', $this->db->sql('SELECT QIFEMPTY(null,"-")', ROW_IMPLODE_ALL));
$this->assertEquals('-', $this->db->sql('SELECT QIFEMPTY("","-")', ROW_IMPLODE_ALL));
$this->assertEquals('-', $this->db->sql('SELECT QIFEMPTY("0","-")', ROW_IMPLODE_ALL));
$this->assertEquals('-', $this->db->sql('SELECT QIFEMPTY(0,"-")', ROW_IMPLODE_ALL));
$this->assertEquals('1', $this->db->sql('SELECT QIFEMPTY("1","-")', ROW_IMPLODE_ALL));
$this->assertEquals('1', $this->db->sql('SELECT QIFEMPTY(1,"-")', ROW_IMPLODE_ALL));
$this->assertEquals('-', $this->db->sql('SELECT QIFEMPTY("0000-00-00","-")', ROW_IMPLODE_ALL));
$this->assertEquals('-', $this->db->sql('SELECT QIFEMPTY("0000-00-00 00:00:00","-")', ROW_IMPLODE_ALL));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment