diff options
Diffstat (limited to 'lib/db.php')
-rw-r--r-- | lib/db.php | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/lib/db.php b/lib/db.php index 4c17cd0dbd1..02eac7cac9a 100644 --- a/lib/db.php +++ b/lib/db.php @@ -508,6 +508,21 @@ class OC_DB { self::$connection->commit(); self::$inTransaction=false; } + + /** + * check if a result is an error, works with MDB2 and PDOException + * @param mixed $result + * @return bool + */ + public static function isError($result){ + if(!$result){ + return true; + }elseif(self::$backend==self::BACKEND_MDB2 and PEAR::isError($result)){ + return true; + }else{ + return false; + } + } } /** @@ -527,11 +542,15 @@ class PDOStatementWrapper{ public function execute($input=array()){ $this->lastArguments=$input; if(count($input)>0){ - $this->statement->execute($input); + $result=$this->statement->execute($input); }else{ - $this->statement->execute(); + $result=$this->statement->execute(); + } + if($result){ + return $this; + }else{ + return false; } - return $this; } /** |