aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2013-06-11 05:34:55 -0700
committerJörn Friedrich Dreyer <jfd@butonic.de>2013-06-11 05:34:55 -0700
commite238eeef6f1c2183a7cc0eaa9ef8b913a0eb2ee3 (patch)
tree3ca929d260f2b9919eef367c6dc6ace6b1d7010b /lib
parenta89dedf70d68eb9d887fefcf37c366d750313335 (diff)
parent5ec13742b312959f5e391e792c53433fb107975c (diff)
downloadnextcloud-server-e238eeef6f1c2183a7cc0eaa9ef8b913a0eb2ee3.tar.gz
nextcloud-server-e238eeef6f1c2183a7cc0eaa9ef8b913a0eb2ee3.zip
Merge pull request #3650 from owncloud/use_to_char_for_oracle_clob_comparisons
use to_char to allow comparing string to CLOB cloumns in oracle
Diffstat (limited to 'lib')
-rw-r--r--lib/app.php3
-rw-r--r--lib/connector/sabre/locks.php22
2 files changed, 20 insertions, 5 deletions
diff --git a/lib/app.php b/lib/app.php
index c6f6e92e60e..3e6cadfe2c9 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -174,7 +174,8 @@ class OC_App{
$apps=array('files');
$sql = 'SELECT `appid` FROM `*PREFIX*appconfig`'
.' WHERE `configkey` = \'enabled\' AND `configvalue`=\'yes\'';
- if (OC_Config::getValue( 'dbtype', 'sqlite' ) === 'oci') { //FIXME oracle hack
+ if (OC_Config::getValue( 'dbtype', 'sqlite' ) === 'oci') {
+ //FIXME oracle hack: need to explicitly cast CLOB to CHAR for comparison
$sql = 'SELECT `appid` FROM `*PREFIX*appconfig`'
.' WHERE `configkey` = \'enabled\' AND to_char(`configvalue`)=\'yes\'';
}
diff --git a/lib/connector/sabre/locks.php b/lib/connector/sabre/locks.php
index e58e584fb41..745523c7a5b 100644
--- a/lib/connector/sabre/locks.php
+++ b/lib/connector/sabre/locks.php
@@ -45,7 +45,12 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
// but otherwise reading locks from SQLite Databases will return
// nothing
$query = 'SELECT * FROM `*PREFIX*locks`'
- .' WHERE `userid` = ? AND (`created` + `timeout`) > '.time().' AND (( `uri` = ?)';
+ .' WHERE `userid` = ? AND (`created` + `timeout`) > '.time().' AND (( `uri` = ?)';
+ if (OC_Config::getValue( "dbtype") === 'oci') {
+ //FIXME oracle hack: need to explicitly cast CLOB to CHAR for comparison
+ $query = 'SELECT * FROM `*PREFIX*locks`'
+ .' WHERE `userid` = ? AND (`created` + `timeout`) > '.time().' AND (( to_char(`uri`) = ?)';
+ }
$params = array(OC_User::getUser(), $uri);
// We need to check locks for every part in the uri.
@@ -60,15 +65,24 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
if ($currentPath) $currentPath.='/';
$currentPath.=$part;
-
- $query.=' OR (`depth` != 0 AND `uri` = ?)';
+ //FIXME oracle hack: need to explicitly cast CLOB to CHAR for comparison
+ if (OC_Config::getValue( "dbtype") === 'oci') {
+ $query.=' OR (`depth` != 0 AND to_char(`uri`) = ?)';
+ } else {
+ $query.=' OR (`depth` != 0 AND `uri` = ?)';
+ }
$params[] = $currentPath;
}
if ($returnChildLocks) {
- $query.=' OR (`uri` LIKE ?)';
+ //FIXME oracle hack: need to explicitly cast CLOB to CHAR for comparison
+ if (OC_Config::getValue( "dbtype") === 'oci') {
+ $query.=' OR (to_char(`uri`) LIKE ?)';
+ } else {
+ $query.=' OR (`uri` LIKE ?)';
+ }
$params[] = $uri . '/%';
}