user workarount to compare CLOB column with CHAR value

This commit is contained in:
Jörn Friedrich Dreyer 2014-01-21 11:56:34 +01:00
parent 0f794b6889
commit 21832bc890
1 changed files with 13 additions and 6 deletions

View File

@ -48,18 +48,25 @@ class Helper {
static public function getServerConfigurationPrefixes($activeConfigurations = false) {
$referenceConfigkey = 'ldap_configuration_active';
$query = '
$sql = '
SELECT DISTINCT `configkey`
FROM `*PREFIX*appconfig`
WHERE `appid` = \'user_ldap\'
AND `configkey` LIKE ?
';
if($activeConfigurations) {
$query .= ' AND `configvalue` = \'1\'';
}
$query = \OCP\DB::prepare($query);
$serverConfigs = $query->execute(array('%'.$referenceConfigkey))->fetchAll();
if($activeConfigurations) {
if (\OC_Config::getValue( 'dbtype', 'sqlite' ) === 'oci') {
//FIXME oracle hack: need to explicitly cast CLOB to CHAR for comparison
$sql .= ' AND to_char(`configvalue`)=\'1\'';
} else {
$sql .= ' AND `configvalue` = \'1\'';
}
}
$stmt = \OCP\DB::prepare($sql);
$serverConfigs = $stmt->execute(array('%'.$referenceConfigkey))->fetchAll();
$prefixes = array();
foreach($serverConfigs as $serverConfig) {