]> source.dussan.org Git - nextcloud-server.git/commitdiff
oracle does not need sequence suffix, manually set database name to allow fetching...
authorJörn Friedrich Dreyer <jfd@butonic.de>
Fri, 14 Jun 2013 10:06:29 +0000 (12:06 +0200)
committerJörn Friedrich Dreyer <jfd@butonic.de>
Fri, 14 Jun 2013 10:06:29 +0000 (12:06 +0200)
lib/db.php

index cd96bcf9d31a1592c775d9abee1b80c3ad598911..a6b81aaba69afd943091274ce2fe72390eefe808 100644 (file)
@@ -460,7 +460,7 @@ class OC_DB {
                        $row = $result->fetchRow();
                        self::raiseExceptionOnError($row, 'fetching row for insertid failed');
                        return $row['id'];
-               } else if( $type === 'mssql') {
+               } else if( $type === 'mssql' || $type === 'oci') {
                        if($table !== null) {
                                $prefix = OC_Config::getValue( "dbtableprefix", "oc_" );
                                $table = str_replace( '*PREFIX*', $prefix, $table );
@@ -594,6 +594,11 @@ class OC_DB {
                $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 );
@@ -617,6 +622,12 @@ class OC_DB {
                        $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);