]> source.dussan.org Git - nextcloud-server.git/commitdiff
Change PDO Exceptions to Doctrine Exceptions
authorBart Visscher <bartv@thisnet.nl>
Sat, 23 Feb 2013 13:46:37 +0000 (14:46 +0100)
committerBart Visscher <bartv@thisnet.nl>
Mon, 25 Feb 2013 07:27:23 +0000 (08:27 +0100)
lib/db.php

index 54b6de947c3450a00a5a1a5500b3dd3806bf79b2..3b2590c31052ed07c41f83a83285e884ea04bcce 100644 (file)
@@ -191,7 +191,7 @@ class OC_DB {
        static public function prepare( $query , $limit=null, $offset=null ) {
 
                if (!is_null($limit) && $limit != -1) {
-                       //PDO does not handle limit and offset.
+                       //Doctrine does not handle limit and offset.
                        //FIXME: check limit notation for other dbs
                        //the following sql thus might needs to take into account db ways of representing it
                        //(oracle has no LIMIT / OFFSET)
@@ -222,7 +222,7 @@ class OC_DB {
                if (self::$backend == self::BACKEND_DOCTRINE) {
                        try {
                                $result=self::$connection->prepare($query);
-                       } catch(PDOException $e) {
+                       } catch(\Doctrine\DBAL\DBALException $e) {
                                throw new DatabaseException($e->getMessage(), $query);
                        }
                        $result=new DoctrineStatementWrapper($result);
@@ -345,7 +345,7 @@ class OC_DB {
         * @brief Insert a row if a matching row doesn't exists.
         * @param string $table. The table to insert into in the form '*PREFIX*tableName'
         * @param array $input. An array of fieldname/value pairs
-        * @returns The return value from PDOStatementWrapper->execute()
+        * @returns The return value from DoctrineStatementWrapper->execute()
         */
        public static function insertIfNotExist($table, $input) {
                self::connect();
@@ -370,7 +370,7 @@ class OC_DB {
                        try {
                                $stmt = self::prepare($query);
                                $result = $stmt->execute();
-                       } catch(PDOException $e) {
+                       } catch(\Doctrine\DBAL\DBALException $e) {
                                $entry = 'DB Error: "'.$e->getMessage() . '"<br />';
                                $entry .= 'Offending command was: ' . $query . '<br />';
                                OC_Log::write('core', $entry, OC_Log::FATAL);
@@ -402,7 +402,7 @@ class OC_DB {
 
                try {
                        $result = self::prepare($query);
-               } catch(PDOException $e) {
+               } catch(\Doctrine\DBAL\DBALException $e) {
                        $entry = 'DB Error: "'.$e->getMessage() . '"<br />';
                        $entry .= 'Offending command was: ' . $query.'<br />';
                        OC_Log::write('core', $entry, OC_Log::FATAL);