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:
@@ -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}
|
||||
*/
|
||||
|
Reference in New Issue
Block a user