You are here

public function PHPExcel_CachedObjectStorage_SQLite3::getCacheData in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/SQLite3.php \PHPExcel_CachedObjectStorage_SQLite3::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/SQLite3.php, line 130

Class

PHPExcel_CachedObjectStorage_SQLite3
PHPExcel_CachedObjectStorage_SQLite3

Code

public function getCacheData($pCoord) {
  if ($pCoord === $this->_currentObjectID) {
    return $this->_currentObject;
  }
  $this
    ->_storeData();
  $this->_selectQuery
    ->bindValue('id', $pCoord, SQLITE3_TEXT);
  $cellResult = $this->_selectQuery
    ->execute();
  if ($cellResult === FALSE) {
    throw new PHPExcel_Exception($this->_DBHandle
      ->lastErrorMsg());
  }
  $cellData = $cellResult
    ->fetchArray(SQLITE3_ASSOC);
  if ($cellData === FALSE) {

    //	Return null if requested entry doesn't exist in cache
    return NULL;
  }

  //	Set current entry to the requested entry
  $this->_currentObjectID = $pCoord;
  $this->_currentObject = unserialize($cellData['value']);

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

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