You are here

public function PHPExcel_CachedObjectStorage_SQLite::moveCell 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::moveCell()

* Move a cell object from one address to another * *

Parameters

string $fromAddress Current address of the cell to move: * @param string $toAddress Destination address of the cell to move * @return boolean

Overrides PHPExcel_CachedObjectStorage_CacheBase::moveCell

File

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

Class

PHPExcel_CachedObjectStorage_SQLite
PHPExcel_CachedObjectStorage_SQLite

Code

public function moveCell($fromAddress, $toAddress) {
  if ($fromAddress === $this->_currentObjectID) {
    $this->_currentObjectID = $toAddress;
  }
  $query = "DELETE FROM kvp_" . $this->_TableName . " WHERE id='" . $toAddress . "'";
  $result = $this->_DBHandle
    ->exec($query);
  if ($result === false) {
    throw new PHPExcel_Exception($this->_DBHandle
      ->lastErrorMsg());
  }
  $query = "UPDATE kvp_" . $this->_TableName . " SET id='" . $toAddress . "' WHERE id='" . $fromAddress . "'";
  $result = $this->_DBHandle
    ->exec($query);
  if ($result === false) {
    throw new PHPExcel_Exception($this->_DBHandle
      ->lastErrorMsg());
  }
  return TRUE;
}