]> source.dussan.org Git - nextcloud-server.git/commitdiff
More style fixes
authorBart Visscher <bartv@thisnet.nl>
Wed, 7 Aug 2013 20:22:33 +0000 (22:22 +0200)
committerBart Visscher <bartv@thisnet.nl>
Wed, 7 Aug 2013 20:22:33 +0000 (22:22 +0200)
lib/db.php
lib/db/connection.php

index d004d491efb289f85bae1ed25869a1bcb8a1af20..ebd012c72f812f29cfed7e6da469471bb762aedb 100644 (file)
@@ -73,7 +73,7 @@ class OC_DB {
                }
 
                // do nothing if the connection already has been established
-               if(!self::$connection) {
+               if (!self::$connection) {
                        $config = new \Doctrine\DBAL\Configuration();
                        switch($type) {
                                case 'sqlite':
@@ -140,7 +140,7 @@ class OC_DB {
                                        return false;
                        }
                        $connectionParams['wrapperClass'] = 'OC\DB\Connection';
-                       $connectionParams['table_prefix'] = OC_Config::getValue( "dbtableprefix", "oc_" );
+                       $connectionParams['tablePrefix'] = OC_Config::getValue('dbtableprefix', 'oc_' );
                        try {
                                self::$connection = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
                                if ($type === 'sqlite' || $type === 'sqlite3') {
@@ -201,12 +201,12 @@ class OC_DB {
                
                // return the result
                try {
-                       $result=self::$connection->prepare($query, $limit, $offset);
-               } catch(\Doctrine\DBAL\DBALException $e) {
+                       $result = self::$connection->prepare($query, $limit, $offset);
+               } catch (\Doctrine\DBAL\DBALException $e) {
                        throw new \DatabaseException($e->getMessage(), $query);
                }
                // differentiate between query and manipulation
-               $result=new OC_DB_StatementWrapper($result, $isManipulation);
+               $result = new OC_DB_StatementWrapper($result, $isManipulation);
                return $result;
        }
 
@@ -218,19 +218,19 @@ class OC_DB {
         * @return bool
         */
        static public function isManipulation( $sql ) {
-               $selectOccurrence = stripos ($sql, "SELECT");
+               $selectOccurrence = stripos($sql, 'SELECT');
                if ($selectOccurrence !== false && $selectOccurrence < 10) {
                        return false;
                }
-               $insertOccurrence = stripos ($sql, "INSERT");
+               $insertOccurrence = stripos($sql, 'INSERT');
                if ($insertOccurrence !== false && $insertOccurrence < 10) {
                        return true;
                }
-               $updateOccurrence = stripos ($sql, "UPDATE");
+               $updateOccurrence = stripos($sql, 'UPDATE');
                if ($updateOccurrence !== false && $updateOccurrence < 10) {
                        return true;
                }
-               $deleteOccurrence = stripos ($sql, "DELETE");
+               $deleteOccurrence = stripos($sql, 'DELETE');
                if ($deleteOccurrence !== false && $deleteOccurrence < 10) {
                        return true;
                }
index e8905d041f0858e8d4dbed44b6323dcc42e5400e..2581969dbd0a34a7a1ab3d61e381f49810943095 100644 (file)
@@ -14,9 +14,9 @@ use Doctrine\Common\EventManager;
 
 class Connection extends \Doctrine\DBAL\Connection {
        /**
-        * @var string $table_prefix
+        * @var string $tablePrefix
         */
-       protected $table_prefix;
+       protected $tablePrefix;
 
        /**
         * @var \OC\DB\Adapter $adapter
@@ -45,12 +45,12 @@ class Connection extends \Doctrine\DBAL\Connection {
                if (!isset($params['adapter'])) {
                        throw new \Exception('adapter not set');
                }
-               if (!isset($params['table_prefix'])) {
-                       throw new \Exception('table_prefix not set');
+               if (!isset($params['tablePrefix'])) {
+                       throw new \Exception('tablePrefix not set');
                }
                parent::__construct($params, $driver, $config, $eventManager);
                $this->adapter = new $params['adapter']($this);
-               $this->table_prefix = $params['table_prefix'];
+               $this->tablePrefix = $params['tablePrefix'];
        }
 
        /**
@@ -183,7 +183,7 @@ class Connection extends \Doctrine\DBAL\Connection {
         * @return string
         */
        protected function replaceTablePrefix($statement) {
-               return str_replace( '*PREFIX*', $this->table_prefix, $statement );
+               return str_replace( '*PREFIX*', $this->tablePrefix, $statement );
        }
 
        public function enableQueryStatementCaching() {