aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db/postgres.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-06-20 12:41:26 +0200
committerJoas Schilling <nickvergessen@gmx.de>2012-06-20 12:41:26 +0200
commitc8e322d88f8195727c18eac90d30a5919e6fb8a0 (patch)
treef43f6949e16215488f9b133ab4a651f59496de8f /phpBB/includes/db/postgres.php
parent4fbbbfcebb6f8ed9867cb61623767a2f4c191ed6 (diff)
downloadforums-c8e322d88f8195727c18eac90d30a5919e6fb8a0.tar
forums-c8e322d88f8195727c18eac90d30a5919e6fb8a0.tar.gz
forums-c8e322d88f8195727c18eac90d30a5919e6fb8a0.tar.bz2
forums-c8e322d88f8195727c18eac90d30a5919e6fb8a0.tar.xz
forums-c8e322d88f8195727c18eac90d30a5919e6fb8a0.zip
[ticket/10942] Fix sql_conditional for mssql, postgre and oracle
PHPBB3-10942
Diffstat (limited to 'phpBB/includes/db/postgres.php')
-rw-r--r--phpBB/includes/db/postgres.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php
index dddf615f9c..a27fbb9d9f 100644
--- a/phpBB/includes/db/postgres.php
+++ b/phpBB/includes/db/postgres.php
@@ -157,6 +157,18 @@ class dbal_postgres extends dbal
/**
* {@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}
+ */
function sql_concatenate($string1, $string2)
{
return $string1 . ' || ' . $string2;