$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\'';
}
// 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.
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 . '/%';
}
/**
* @brief Ensure that the fileinfo cache is filled
- & @note Uses OC_FileCache or a direct stat
+ * @note Uses OC_FileCache or a direct stat
*/
protected function getFileinfoCache() {
if (!isset($this->fileinfo_cache)) {
$query = self::prepare('SELECT lastval() AS id');
$row = $query->execute()->fetchRow();
return $row['id'];
- }
- if( $type == 'mssql' || $type == 'oci' ) {
+ } else if( $type === 'mssql' || $type === 'oci') {
if($table !== null) {
$prefix = OC_Config::getValue( "dbtableprefix", "oc_" );
$table = str_replace( '*PREFIX*', $prefix, $table );
}
return self::$connection->lastInsertId($table);
- }else{
+ } else {
if($table !== null) {
$prefix = OC_Config::getValue( "dbtableprefix", "oc_" );
$suffix = OC_Config::getValue( "dbsequencesuffix", "_id_seq" );
$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
self::connectScheme();
+
+ if(OC_Config::getValue('dbtype', 'sqlite')==='oci') {
+ //set dbname, it is unset because oci uses 'service' to connect
+ self::$schema->db->database_name=self::$schema->db->dsn['username'];
+ }
// read file
$content = file_get_contents( $file );
$content = str_replace( '<default>0000-00-00 00:00:00</default>',
'<default>CURRENT_TIMESTAMP</default>', $content );
}
+ if(OC_Config::getValue('dbtype', 'sqlite')==='oci') {
+ unset($previousSchema['charset']); //or MDB2 tries SHUTDOWN IMMEDIATE
+ $oldname = $previousSchema['name'];
+ $previousSchema['name']=OC_Config::getValue( "dbuser", $oldname );
+ //TODO check identifiers are at most 30 chars long
+ }
file_put_contents( $file2, $content );
$op = self::$schema->updateDatabase($file2, $previousSchema, array(), false);
$dbuser = $options['dbuser'];
$dbpass = $options['dbpass'];
$dbname = $options['dbname'];
- $dbtablespace = $options['dbtablespace'];
+ if (array_key_exists('dbtablespace', $options)) {
+ $dbtablespace = $options['dbtablespace'];
+ } else {
+ $dbtablespace = 'USERS';
+ }
$dbhost = isset($options['dbhost'])?$options['dbhost']:'';
$dbtableprefix = isset($options['dbtableprefix']) ? $options['dbtableprefix'] : 'oc_';
OC_Config::setValue('dbname', $dbname);
- OC_Config::setValue('dbtablespace', $dbtablespace);
OC_Config::setValue('dbhost', $dbhost);
OC_Config::setValue('dbtableprefix', $dbtableprefix);