use to_char only for oracle, whitespace

This commit is contained in:
Jörn Friedrich Dreyer 2013-05-08 16:18:24 +02:00
parent eceb3c8ed5
commit cbd5eb9a1a
3 changed files with 18 additions and 9 deletions

View file

@ -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);

View file

@ -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':

View file

@ -609,7 +609,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'));