1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-05 16:27:38 +02:00

[ticket/10942] Fix sql_conditional for mssql, postgre and oracle

PHPBB3-10942
This commit is contained in:
Joas Schilling
2012-06-20 12:41:26 +02:00
parent 4fbbbfcebb
commit c8e322d88f
5 changed files with 60 additions and 0 deletions

View File

@@ -91,6 +91,18 @@ class dbal_mssql extends dbal
return ($this->sql_server_version) ? 'MSSQL<br />' . $this->sql_server_version : 'MSSQL';
}
/**
* {@inheritDoc}
*/
function sql_conditional($condition, $action_true, $action_false = false)
{
$sql_condition = 'CASE WHEN ' . $condition;
$sql_condition .= ' THEN CAST(' . $action_true . ' AS VARCHAR)';
$sql_condition .= ($action_false !== false) ? ' ELSE CAST(' . $action_false . ' AS VARCHAR)' : '';
$sql_condition .= ' END';
return $sql_condition;
}
/**
* {@inheritDoc}
*/