You are here

public function PHPExcel_CachedObjectStorage_SQLite::getCacheData in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/SQLite.php \PHPExcel_CachedObjectStorage_SQLite::getCacheData()

Get cell at a specific coordinate

Parameters

string $pCoord Coordinate of the cell:

Return value

PHPExcel_Cell Cell that was found, or null if not found

Throws

PHPExcel_Exception

Overrides PHPExcel_CachedObjectStorage_ICache::getCacheData

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/SQLite.php, line 99

Class

PHPExcel_CachedObjectStorage_SQLite
PHPExcel_CachedObjectStorage_SQLite

Code

public function getCacheData($pCoord) {
  if ($pCoord === $this->_currentObjectID) {
    return $this->_currentObject;
  }
  $this
    ->_storeData();
  $query = "SELECT value FROM kvp_" . $this->_TableName . " WHERE id='" . $pCoord . "'";
  $cellResultSet = $this->_DBHandle
    ->query($query, SQLITE_ASSOC);
  if ($cellResultSet === false) {
    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;
  }

  //	Set current entry to the requested entry
  $this->_currentObjectID = $pCoord;
  $cellResult = $cellResultSet
    ->fetchSingle();
  $this->_currentObject = unserialize($cellResult);

  //    Re-attach this as the cell's parent
  $this->_currentObject
    ->attach($this);

  //	Return requested entry
  return $this->_currentObject;
}