1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-29 21:10:31 +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

@@ -154,6 +154,18 @@ class dbal_postgres extends dbal
return ($raw) ? $this->sql_server_version : 'PostgreSQL ' . $this->sql_server_version;
}
/**
* {@inheritDoc}
*/
function sql_conditional($condition, $action_true, $action_false = false)
{
$sql_condition = 'CASE WHEN ' . $condition;
$sql_condition .= ' THEN CAST(' . $action_true . ' AS TEXT)';
$sql_condition .= ($action_false !== false) ? ' ELSE CAST(' . $action_false . ' AS TEXT)' : '';
$sql_condition .= ' END';
return $sql_condition;
}
/**
* {@inheritDoc}
*/