From d6878f5551d8524aa1ef57cfa0afe811f81d3fa0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Wed, 8 May 2013 16:18:24 +0200 Subject: [PATCH] use to_char only for oracle, whitespace --- lib/app.php | 9 +++++++-- lib/db.php | 12 ++++++------ lib/user.php | 6 +++++- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/lib/app.php b/lib/app.php index 811d6e4675e..889d135d7db 100644 --- a/lib/app.php +++ b/lib/app.php @@ -172,8 +172,13 @@ class OC_App{ return array(); } $apps=array('files'); - $query = OC_DB::prepare( 'SELECT `appid` FROM `*PREFIX*appconfig`' - .' WHERE `configkey` = \'enabled\' AND to_char(`configvalue`)=\'yes\'' ); + $sql = 'SELECT `appid` FROM `*PREFIX*appconfig`' + .' WHERE `configkey` = \'enabled\' AND `configvalue`=\'yes\''; + if (OC_Config::getValue( 'dbtype', 'sqlite' ) === 'oci') { //FIXME oracle hack + $sql = 'SELECT `appid` FROM `*PREFIX*appconfig`' + .' WHERE `configkey` = \'enabled\' AND to_char(`configvalue`)=\'yes\''; + } + $query = OC_DB::prepare( $sql ); $result=$query->execute(); if( \OC_DB::isError($result)) { throw new DatabaseException($result->getMessage(), $query); diff --git a/lib/db.php b/lib/db.php index 013351fcdcf..7c75dc67868 100644 --- a/lib/db.php +++ b/lib/db.php @@ -273,12 +273,12 @@ class OC_DB { break; case 'oci': $dsn = array( - 'phptype' => 'oci8', - 'username' => $user, - 'password' => $pass, - 'service' => $name, - 'hostspec' => $host, - 'charset' => 'AL32UTF8', + 'phptype' => 'oci8', + 'username' => $user, + 'password' => $pass, + 'service' => $name, + 'hostspec' => $host, + 'charset' => 'AL32UTF8', ); break; case 'mssql': diff --git a/lib/user.php b/lib/user.php index 64aff3d9373..1743a4af8f2 100644 --- a/lib/user.php +++ b/lib/user.php @@ -610,7 +610,11 @@ class OC_User { */ public static function isEnabled($userid) { $sql = 'SELECT `userid` FROM `*PREFIX*preferences`' - .' WHERE `userid` = ? AND `appid` = ? AND `configkey` = ? AND to_char(`configvalue`) = ?'; + .' WHERE `userid` = ? AND `appid` = ? AND `configkey` = ? AND `configvalue` = ?'; + if (OC_Config::getValue( 'dbtype', 'sqlite' ) === 'oci') { //FIXME oracle hack + $sql = 'SELECT `userid` FROM `*PREFIX*preferences`' + .' WHERE `userid` = ? AND `appid` = ? AND `configkey` = ? AND to_char(`configvalue`) = ?'; + } $stmt = OC_DB::prepare($sql); if ( ! OC_DB::isError($stmt) ) { $result = $stmt->execute(array($userid, 'core', 'enabled', 'false')); -- 2.39.5