]> source.dussan.org Git - nextcloud-server.git/commitdiff
Revert "Oracle compat: enable appconfig.configvalue to store empty strings"
authorArthur Schiwon <blizzz@owncloud.com>
Tue, 23 Jul 2013 17:55:47 +0000 (19:55 +0200)
committerArthur Schiwon <blizzz@owncloud.com>
Tue, 23 Jul 2013 17:55:47 +0000 (19:55 +0200)
This reverts commit 6c1e68acd8fbb98f8fbd54a38860481b4971bc28.

db_structure.xml
lib/db.php
lib/util.php

index 6f4e32889079d42ed1b43739a5494a18c5e9bfda..a292f69ce0493b9d8d36da76f6cf265199715919 100644 (file)
@@ -32,7 +32,7 @@
                        <field>
                                <name>configvalue</name>
                                <type>clob</type>
-                               <notnull>false</notnull>
+                               <notnull>true</notnull>
                        </field>
 
                        <index>
index 17e28ffd82d6ad5916595a401076a4f2dbc2d07f..2dc20001d1f06c76ccb66e68221e19fac7b40888 100644 (file)
@@ -185,7 +185,7 @@ class OC_DB {
                                        } else {
                                                        $dsn='sqlsrv:Server='.$host.';Database='.$name;
                                        }
-                                       break;
+                                       break;                    
                                default:
                                        return false;
                        }
@@ -365,12 +365,12 @@ class OC_DB {
                $query = self::processQuery( $query );
 
                self::connect();
-
+               
                if ($isManipulation === null) {
                        //try to guess, so we return the number of rows on manipulations
                        $isManipulation = self::isManipulation($query);
                }
-
+               
                // return the result
                if(self::$backend==self::BACKEND_MDB2) {
                        // differentiate between query and manipulation
@@ -401,11 +401,11 @@ class OC_DB {
                }
                return $result;
        }
-
+       
        /**
         * tries to guess the type of statement based on the first 10 characters
         * the current check allows some whitespace but does not work with IF EXISTS or other more complex statements
-        *
+        * 
         * @param string $sql
         */
        static public function isManipulation( $sql ) {
@@ -427,7 +427,7 @@ class OC_DB {
                }
                return false;
        }
-
+       
        /**
         * @brief gets last value of autoincrement
         * @param string $table The optional table name (will replace *PREFIX*) and add sequence suffix
@@ -583,25 +583,10 @@ 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'];
-
-                       $installedVersion = \OC_Config::getValue('version', '0.0.0');
-                       if (version_compare('5.0.15', $installedVersion, '<=')) {
-                               //configvalue in oc_appconfig must be allowed to contain NULL
-                               //because it is a CLOB, we need to move heaven and earth a bit
-                               //i.e. rename it and copy values
-                               $ociHandleAppconfig = true;
-                               $query = \OCP\DB::prepare('ALTER TABLE `*PREFIX*appconfig`
-                                       RENAME COLUMN `configvalue` TO `configvalue_tmp`');
-                               $result = $query->execute();
-                               if(\OCP\DB::isError($result)) {
-                                       OC_Log::write('core', 'Could not alter appconfig.'.
-                                               ', DB upgrade may fail.', OC_Log::WARN);
-                               }
-                       }
                }
 
                // read file
@@ -651,31 +636,6 @@ class OC_DB {
                        OC_Log::write('core', $message, OC_Log::FATAL);
                        throw new Exception($message);
                }
-
-               if(isset($ociHandleAppconfig)) {
-                       $query = \OCP\DB::prepare('
-                               INSERT INTO `*PREFIX*appconfig`
-                                       (`appid`, `configkey`, `configvalue`)
-                               SELECT `appid`, `configkey`, `configvalue_tmp` AS `configvalue`
-                               FROM `*PREFIX*appconfig`');
-                       $result = $query->execute();
-                       if(\OCP\DB::isError($result)) {
-                               OC_Log::write('core', 'Could not transfer appconfig.'.
-                                       'You may neet to copy values from appconfig.'.
-                                       'configvalue_tmp to appconfig.configvalue.', OC_Log::ERROR);
-                       } else {
-                               $query = \OCP\DB::prepare('ALTER TABLE `*PREFIX*appconfig`
-                                       DROP COLUMN `configvalue_tmp`');
-                               $result = $query->execute();
-                               if(\OCP\DB::isError($result)) {
-                                       OC_Log::write('core', 'Could not drop appconfig.'.
-                                               'configvalue_tmp, you can remove it by hand or just.'.
-                                               ' leave it.', OC_Log::INFO);
-                               }
-
-                       }
-               }
-
                return true;
        }
 
@@ -839,11 +799,11 @@ class OC_DB {
 
     private static function fixLimitClauseForMSSQL($query) {
         $limitLocation = stripos ($query, "LIMIT");
-
+        
         if ( $limitLocation === false ) {
             return $query;
-        }
-
+        } 
+        
         // total == 0 means all results - not zero results
         //
         // First number is either total or offset, locate it by first space
@@ -890,7 +850,7 @@ class OC_DB {
         }
         return $query;
     }
-
+    
        /**
         * @brief drop a table
         * @param string $tableName the table to drop
@@ -1072,7 +1032,7 @@ class PDOStatementWrapper{
                } else {
                        $result = $this->statement->execute();
                }
-
+               
                if ($result === false) {
                        return false;
                }
@@ -1172,7 +1132,7 @@ class PDOStatementWrapper{
                        die ($entry);
                }
        }
-
+    
        /**
         * provide numRows
         */
index 3920d0f900f5103a55c4f0d53b4341b770ba006b..86f3a7cac0132c3726b315c8eebbd4a24ddd8ac3 100755 (executable)
@@ -76,7 +76,7 @@ class OC_Util {
        public static function getVersion() {
                // hint: We only can count up. Reset minor/patchlevel when
                // updating major/minor version number.
-               return array(5, 00, 15, 1);
+               return array(5, 00, 15);
        }
 
        /**
@@ -824,7 +824,7 @@ class OC_Util {
                $theme = OC_Config::getValue("theme", '');
 
                if($theme === '') {
-
+                       
                        if(is_dir(OC::$SERVERROOT . '/themes/default')) {
                                $theme = 'default';
                        }