From 13a9413a8c3a1e1d17af655135cdb977c79e4d5f Mon Sep 17 00:00:00 2001 From: Dominik Bonsch Date: Mon, 19 Nov 2012 19:19:45 +0100 Subject: [PATCH] GH-78 replaced Exception with PHPExcel_Exception in all Cache classes --- Classes/PHPExcel/CachedObjectStorage/APC.php | 18 +++++++------- .../CachedObjectStorage/CacheBase.php | 4 +--- .../PHPExcel/CachedObjectStorage/DiscISAM.php | 3 --- .../PHPExcel/CachedObjectStorage/ICache.php | 8 +++---- .../PHPExcel/CachedObjectStorage/Memcache.php | 24 +++++++++---------- .../PHPExcel/CachedObjectStorage/Memory.php | 4 ++-- .../CachedObjectStorage/MemoryGZip.php | 6 ++--- .../CachedObjectStorage/MemorySerialized.php | 6 ++--- .../PHPExcel/CachedObjectStorage/PHPTemp.php | 6 ++--- .../PHPExcel/CachedObjectStorage/SQLite.php | 24 +++++++++---------- .../PHPExcel/CachedObjectStorage/SQLite3.php | 24 +++++++++---------- .../PHPExcel/CachedObjectStorage/Wincache.php | 20 ++++++++-------- 12 files changed, 71 insertions(+), 76 deletions(-) diff --git a/Classes/PHPExcel/CachedObjectStorage/APC.php b/Classes/PHPExcel/CachedObjectStorage/APC.php index e7c4919bf..463d07604 100644 --- a/Classes/PHPExcel/CachedObjectStorage/APC.php +++ b/Classes/PHPExcel/CachedObjectStorage/APC.php @@ -58,7 +58,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach * * @access private * @return void - * @throws Exception + * @throws PHPExcel_Exception */ private function _storeData() { if ($this->_currentCellIsDirty) { @@ -66,7 +66,7 @@ private function _storeData() { if (!apc_store($this->_cachePrefix.$this->_currentObjectID.'.cache',serialize($this->_currentObject),$this->_cacheTime)) { $this->__destruct(); - throw new Exception('Failed to store cell '.$this->_currentObjectID.' in APC'); + throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in APC'); } $this->_currentCellIsDirty = false; } @@ -81,7 +81,7 @@ private function _storeData() { * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { @@ -116,7 +116,7 @@ public function isDataSet($pCoord) { if ($success === false) { // Entry no longer exists in APC, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new Exception('Cell entry '.$pCoord.' no longer exists in APC'); + throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC'); } return true; } @@ -129,7 +129,7 @@ public function isDataSet($pCoord) { * * @access public * @param string $pCoord Coordinate of the cell - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { @@ -144,7 +144,7 @@ public function getCacheData($pCoord) { if ($obj === false) { // Entry no longer exists in APC, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new Exception('Cell entry '.$pCoord.' no longer exists in APC'); + throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC'); } } else { // Return null if requested entry doesn't exist in cache @@ -167,7 +167,7 @@ public function getCacheData($pCoord) { * * @access public * @param string $pCoord Coordinate address of the cell to delete - * @throws Exception + * @throws PHPExcel_Exception */ public function deleteCacheData($pCoord) { // Delete the entry from APC @@ -197,11 +197,11 @@ public function copyCellCollection(PHPExcel_Worksheet $parent) { if ($obj === false) { // Entry no longer exists in APC, so clear it from the cache array parent::deleteCacheData($cellID); - throw new Exception('Cell entry '.$cellID.' no longer exists in APC'); + throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in APC'); } if (!apc_store($newCachePrefix.$cellID.'.cache',$obj,$this->_cacheTime)) { $this->__destruct(); - throw new Exception('Failed to store cell '.$cellID.' in APC'); + throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in APC'); } } } diff --git a/Classes/PHPExcel/CachedObjectStorage/CacheBase.php b/Classes/PHPExcel/CachedObjectStorage/CacheBase.php index 822a655a0..63ff1b6a0 100644 --- a/Classes/PHPExcel/CachedObjectStorage/CacheBase.php +++ b/Classes/PHPExcel/CachedObjectStorage/CacheBase.php @@ -105,8 +105,7 @@ public function isDataSet($pCoord) { * Add or Update a cell in cache * * @param PHPExcel_Cell $cell Cell to update - * @return void - * @throws Exception + * @return void */ public function updateCacheData(PHPExcel_Cell $cell) { return $this->addCacheData($cell->getCoordinate(),$cell); @@ -117,7 +116,6 @@ public function updateCacheData(PHPExcel_Cell $cell) { * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete - * @throws Exception */ public function deleteCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { diff --git a/Classes/PHPExcel/CachedObjectStorage/DiscISAM.php b/Classes/PHPExcel/CachedObjectStorage/DiscISAM.php index 59f993ac3..6273c1e17 100644 --- a/Classes/PHPExcel/CachedObjectStorage/DiscISAM.php +++ b/Classes/PHPExcel/CachedObjectStorage/DiscISAM.php @@ -62,7 +62,6 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage * and the 'nullify' the current cell object * * @return void - * @throws Exception */ private function _storeData() { if ($this->_currentCellIsDirty) { @@ -86,7 +85,6 @@ private function _storeData() { * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { @@ -105,7 +103,6 @@ public function addCacheData($pCoord, PHPExcel_Cell $cell) { * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { diff --git a/Classes/PHPExcel/CachedObjectStorage/ICache.php b/Classes/PHPExcel/CachedObjectStorage/ICache.php index 1caceea7a..8b82f103c 100644 --- a/Classes/PHPExcel/CachedObjectStorage/ICache.php +++ b/Classes/PHPExcel/CachedObjectStorage/ICache.php @@ -41,7 +41,7 @@ interface PHPExcel_CachedObjectStorage_ICache * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell); @@ -50,7 +50,7 @@ public function addCacheData($pCoord, PHPExcel_Cell $cell); * * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function updateCacheData(PHPExcel_Cell $cell); @@ -59,7 +59,7 @@ public function updateCacheData(PHPExcel_Cell $cell); * * @param string $pCoord Coordinate address of the cell to retrieve * @return PHPExcel_Cell Cell that was found, or null if not found - * @throws Exception + * @throws PHPExcel_Exception */ public function getCacheData($pCoord); @@ -67,7 +67,7 @@ public function getCacheData($pCoord); * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete - * @throws Exception + * @throws PHPExcel_Exception */ public function deleteCacheData($pCoord); diff --git a/Classes/PHPExcel/CachedObjectStorage/Memcache.php b/Classes/PHPExcel/CachedObjectStorage/Memcache.php index a72fa1914..ea2da67f6 100644 --- a/Classes/PHPExcel/CachedObjectStorage/Memcache.php +++ b/Classes/PHPExcel/CachedObjectStorage/Memcache.php @@ -62,7 +62,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage * and the 'nullify' the current cell object * * @return void - * @throws Exception + * @throws PHPExcel_Exception */ private function _storeData() { if ($this->_currentCellIsDirty) { @@ -72,7 +72,7 @@ private function _storeData() { if (!$this->_memcache->replace($this->_cachePrefix.$this->_currentObjectID.'.cache',$obj,NULL,$this->_cacheTime)) { if (!$this->_memcache->add($this->_cachePrefix.$this->_currentObjectID.'.cache',$obj,NULL,$this->_cacheTime)) { $this->__destruct(); - throw new Exception('Failed to store cell '.$this->_currentObjectID.' in MemCache'); + throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in MemCache'); } } $this->_currentCellIsDirty = false; @@ -87,7 +87,7 @@ private function _storeData() { * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { @@ -121,7 +121,7 @@ public function isDataSet($pCoord) { if ($success === false) { // Entry no longer exists in Memcache, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new Exception('Cell entry '.$pCoord.' no longer exists in MemCache'); + throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache'); } return true; } @@ -133,7 +133,7 @@ public function isDataSet($pCoord) { * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { @@ -148,7 +148,7 @@ public function getCacheData($pCoord) { if ($obj === false) { // Entry no longer exists in Memcache, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new Exception('Cell entry '.$pCoord.' no longer exists in MemCache'); + throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache'); } } else { // Return null if requested entry doesn't exist in cache @@ -170,7 +170,7 @@ public function getCacheData($pCoord) { * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete - * @throws Exception + * @throws PHPExcel_Exception */ public function deleteCacheData($pCoord) { // Delete the entry from Memcache @@ -199,11 +199,11 @@ public function copyCellCollection(PHPExcel_Worksheet $parent) { if ($obj === false) { // Entry no longer exists in Memcache, so clear it from the cache array parent::deleteCacheData($cellID); - throw new Exception('Cell entry '.$cellID.' no longer exists in MemCache'); + throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in MemCache'); } if (!$this->_memcache->add($newCachePrefix.$cellID.'.cache',$obj,NULL,$this->_cacheTime)) { $this->__destruct(); - throw new Exception('Failed to store cell '.$cellID.' in MemCache'); + throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in MemCache'); } } } @@ -250,7 +250,7 @@ public function __construct(PHPExcel_Worksheet $parent, $arguments) { // Set a new Memcache object and connect to the Memcache server $this->_memcache = new Memcache(); if (!$this->_memcache->addServer($memcacheServer, $memcachePort, false, 50, 5, 5, true, array($this, 'failureCallback'))) { - throw new Exception('Could not connect to MemCache server at '.$memcacheServer.':'.$memcachePort); + throw new PHPExcel_Exception('Could not connect to MemCache server at '.$memcacheServer.':'.$memcachePort); } $this->_cacheTime = $cacheTime; @@ -264,10 +264,10 @@ public function __construct(PHPExcel_Worksheet $parent, $arguments) { * * @param string $host Memcache server * @param integer $port Memcache port - * @throws Exception + * @throws PHPExcel_Exception */ public function failureCallback($host, $port) { - throw new Exception('memcache '.$host.':'.$port.' failed'); + throw new PHPExcel_Exception('memcache '.$host.':'.$port.' failed'); } diff --git a/Classes/PHPExcel/CachedObjectStorage/Memory.php b/Classes/PHPExcel/CachedObjectStorage/Memory.php index be84c43d0..730e9e374 100644 --- a/Classes/PHPExcel/CachedObjectStorage/Memory.php +++ b/Classes/PHPExcel/CachedObjectStorage/Memory.php @@ -41,7 +41,7 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { $this->_cellCache[$pCoord] = $cell; @@ -53,7 +53,7 @@ public function addCacheData($pCoord, PHPExcel_Cell $cell) { * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { diff --git a/Classes/PHPExcel/CachedObjectStorage/MemoryGZip.php b/Classes/PHPExcel/CachedObjectStorage/MemoryGZip.php index 9ee3aaea5..5b4fcd0f0 100644 --- a/Classes/PHPExcel/CachedObjectStorage/MemoryGZip.php +++ b/Classes/PHPExcel/CachedObjectStorage/MemoryGZip.php @@ -40,7 +40,7 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora * and the 'nullify' the current cell object * * @return void - * @throws Exception + * @throws PHPExcel_Exception */ private function _storeData() { if ($this->_currentCellIsDirty) { @@ -59,7 +59,7 @@ private function _storeData() { * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { @@ -78,7 +78,7 @@ public function addCacheData($pCoord, PHPExcel_Cell $cell) { * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { diff --git a/Classes/PHPExcel/CachedObjectStorage/MemorySerialized.php b/Classes/PHPExcel/CachedObjectStorage/MemorySerialized.php index 82dc167b2..9aa305be2 100644 --- a/Classes/PHPExcel/CachedObjectStorage/MemorySerialized.php +++ b/Classes/PHPExcel/CachedObjectStorage/MemorySerialized.php @@ -40,7 +40,7 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec * and the 'nullify' the current cell object * * @return void - * @throws Exception + * @throws PHPExcel_Exception */ private function _storeData() { if ($this->_currentCellIsDirty) { @@ -59,7 +59,7 @@ private function _storeData() { * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { @@ -78,7 +78,7 @@ public function addCacheData($pCoord, PHPExcel_Cell $cell) { * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { diff --git a/Classes/PHPExcel/CachedObjectStorage/PHPTemp.php b/Classes/PHPExcel/CachedObjectStorage/PHPTemp.php index e5af520bf..75a47c99a 100644 --- a/Classes/PHPExcel/CachedObjectStorage/PHPTemp.php +++ b/Classes/PHPExcel/CachedObjectStorage/PHPTemp.php @@ -54,7 +54,7 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_ * and the 'nullify' the current cell object * * @return void - * @throws Exception + * @throws PHPExcel_Exception */ private function _storeData() { if ($this->_currentCellIsDirty) { @@ -78,7 +78,7 @@ private function _storeData() { * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { @@ -97,7 +97,7 @@ public function addCacheData($pCoord, PHPExcel_Cell $cell) { * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { diff --git a/Classes/PHPExcel/CachedObjectStorage/SQLite.php b/Classes/PHPExcel/CachedObjectStorage/SQLite.php index 56cc3f9bf..924132c8e 100644 --- a/Classes/PHPExcel/CachedObjectStorage/SQLite.php +++ b/Classes/PHPExcel/CachedObjectStorage/SQLite.php @@ -54,14 +54,14 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C * and the 'nullify' the current cell object * * @return void - * @throws Exception + * @throws PHPExcel_Exception */ private function _storeData() { if ($this->_currentCellIsDirty) { $this->_currentObject->detach(); if (!$this->_DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES('".$this->_currentObjectID."','".sqlite_escape_string(serialize($this->_currentObject))."')")) - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); $this->_currentCellIsDirty = false; } $this->_currentObjectID = $this->_currentObject = null; @@ -74,7 +74,7 @@ private function _storeData() { * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { @@ -93,7 +93,7 @@ public function addCacheData($pCoord, PHPExcel_Cell $cell) { * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { @@ -105,7 +105,7 @@ public function getCacheData($pCoord) { $query = "SELECT value FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; $cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC); if ($cellResultSet === false) { - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); } elseif ($cellResultSet->numRows() == 0) { // Return null if requested entry doesn't exist in cache return null; @@ -139,7 +139,7 @@ public function isDataSet($pCoord) { $query = "SELECT id FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; $cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC); if ($cellResultSet === false) { - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); } elseif ($cellResultSet->numRows() == 0) { // Return null if requested entry doesn't exist in cache return false; @@ -152,7 +152,7 @@ public function isDataSet($pCoord) { * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete - * @throws Exception + * @throws PHPExcel_Exception */ public function deleteCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { @@ -163,7 +163,7 @@ public function deleteCacheData($pCoord) { // Check if the requested entry exists in the cache $query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; if (!$this->_DBHandle->queryExec($query)) - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); $this->_currentCellIsDirty = false; } // function deleteCacheData() @@ -178,7 +178,7 @@ public function getCellList() { $query = "SELECT id FROM kvp_".$this->_TableName; $cellIdsResult = $this->_DBHandle->unbufferedQuery($query,SQLITE_ASSOC); if ($cellIdsResult === false) - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); $cellKeys = array(); foreach($cellIdsResult as $row) { @@ -200,7 +200,7 @@ public function copyCellCollection(PHPExcel_Worksheet $parent) { $tableName = str_replace('.','_',$this->_getUniqueID()); if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) AS SELECT * FROM kvp_'.$this->_TableName)) - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); // Copy the existing cell cache file $this->_TableName = $tableName; @@ -238,9 +238,9 @@ public function __construct(PHPExcel_Worksheet $parent) { $this->_DBHandle = new SQLiteDatabase($_DBName); if ($this->_DBHandle === false) - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); } } // function __construct() diff --git a/Classes/PHPExcel/CachedObjectStorage/SQLite3.php b/Classes/PHPExcel/CachedObjectStorage/SQLite3.php index 3c3cf745b..75ecc2156 100644 --- a/Classes/PHPExcel/CachedObjectStorage/SQLite3.php +++ b/Classes/PHPExcel/CachedObjectStorage/SQLite3.php @@ -54,7 +54,7 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ * and the 'nullify' the current cell object * * @return void - * @throws Exception + * @throws PHPExcel_Exception */ private function _storeData() { if ($this->_currentCellIsDirty) { @@ -65,7 +65,7 @@ private function _storeData() { $query->bindValue('data',serialize($this->_currentObject),SQLITE3_BLOB); $result = $query->execute(); if ($result === false) - throw new Exception($this->_DBHandle->lastErrorMsg()); + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); $this->_currentCellIsDirty = false; } $this->_currentObjectID = $this->_currentObject = null; @@ -78,7 +78,7 @@ private function _storeData() { * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { @@ -97,7 +97,7 @@ public function addCacheData($pCoord, PHPExcel_Cell $cell) { * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { @@ -109,7 +109,7 @@ public function getCacheData($pCoord) { $query = "SELECT value FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; $cellResult = $this->_DBHandle->querySingle($query); if ($cellResult === false) { - throw new Exception($this->_DBHandle->lastErrorMsg()); + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); } elseif (is_null($cellResult)) { // Return null if requested entry doesn't exist in cache return null; @@ -142,7 +142,7 @@ public function isDataSet($pCoord) { $query = "SELECT id FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; $cellResult = $this->_DBHandle->querySingle($query); if ($cellResult === false) { - throw new Exception($this->_DBHandle->lastErrorMsg()); + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); } elseif (is_null($cellResult)) { // Return null if requested entry doesn't exist in cache return false; @@ -155,7 +155,7 @@ public function isDataSet($pCoord) { * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete - * @throws Exception + * @throws PHPExcel_Exception */ public function deleteCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { @@ -167,7 +167,7 @@ public function deleteCacheData($pCoord) { $query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; $result = $this->_DBHandle->exec($query); if ($result === false) - throw new Exception($this->_DBHandle->lastErrorMsg()); + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); $this->_currentCellIsDirty = false; } // function deleteCacheData() @@ -182,7 +182,7 @@ public function getCellList() { $query = "SELECT id FROM kvp_".$this->_TableName; $cellIdsResult = $this->_DBHandle->query($query); if ($cellIdsResult === false) - throw new Exception($this->_DBHandle->lastErrorMsg()); + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); $cellKeys = array(); while ($row = $cellIdsResult->fetchArray(SQLITE3_ASSOC)) { @@ -204,7 +204,7 @@ public function copyCellCollection(PHPExcel_Worksheet $parent) { $tableName = str_replace('.','_',$this->_getUniqueID()); if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) AS SELECT * FROM kvp_'.$this->_TableName)) - throw new Exception($this->_DBHandle->lastErrorMsg()); + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); // Copy the existing cell cache file $this->_TableName = $tableName; @@ -242,9 +242,9 @@ public function __construct(PHPExcel_Worksheet $parent) { $this->_DBHandle = new SQLite3($_DBName); if ($this->_DBHandle === false) - throw new Exception($this->_DBHandle->lastErrorMsg()); + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) - throw new Exception($this->_DBHandle->lastErrorMsg()); + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); } } // function __construct() diff --git a/Classes/PHPExcel/CachedObjectStorage/Wincache.php b/Classes/PHPExcel/CachedObjectStorage/Wincache.php index 30fe7e1f5..0b95a8bb8 100644 --- a/Classes/PHPExcel/CachedObjectStorage/Wincache.php +++ b/Classes/PHPExcel/CachedObjectStorage/Wincache.php @@ -55,7 +55,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage * and the 'nullify' the current cell object * * @return void - * @throws Exception + * @throws PHPExcel_Exception */ private function _storeData() { if ($this->_currentCellIsDirty) { @@ -65,12 +65,12 @@ private function _storeData() { if (wincache_ucache_exists($this->_cachePrefix.$this->_currentObjectID.'.cache')) { if (!wincache_ucache_set($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) { $this->__destruct(); - throw new Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache'); + throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache'); } } else { if (!wincache_ucache_add($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) { $this->__destruct(); - throw new Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache'); + throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache'); } } $this->_currentCellIsDirty = false; @@ -86,7 +86,7 @@ private function _storeData() { * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { @@ -119,7 +119,7 @@ public function isDataSet($pCoord) { if ($success === false) { // Entry no longer exists in Wincache, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); + throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); } return true; } @@ -131,7 +131,7 @@ public function isDataSet($pCoord) { * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { @@ -148,7 +148,7 @@ public function getCacheData($pCoord) { if ($success === false) { // Entry no longer exists in WinCache, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); + throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); } } else { // Return null if requested entry doesn't exist in cache @@ -170,7 +170,7 @@ public function getCacheData($pCoord) { * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete - * @throws Exception + * @throws PHPExcel_Exception */ public function deleteCacheData($pCoord) { // Delete the entry from Wincache @@ -200,11 +200,11 @@ public function copyCellCollection(PHPExcel_Worksheet $parent) { if ($success === false) { // Entry no longer exists in WinCache, so clear it from the cache array parent::deleteCacheData($cellID); - throw new Exception('Cell entry '.$cellID.' no longer exists in Wincache'); + throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in Wincache'); } if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->_cacheTime)) { $this->__destruct(); - throw new Exception('Failed to store cell '.$cellID.' in Wincache'); + throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in Wincache'); } } }