mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-25 23:06:03 +03:00
Add move cell method for SQLite.
TODO - modify SQLite3 to use parameterised statements consistently throughout
This commit is contained in:
parent
4e52db40dd
commit
ae9d9fd758
@ -117,13 +117,14 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
||||
if ($fromAddress === $this->_currentObjectID) {
|
||||
$this->_currentObjectID = $toAddress;
|
||||
}
|
||||
$this->_currentCellIsDirty = true;
|
||||
if (isset($this->_cellCache[$fromAddress])) {
|
||||
$this->_cellCache[$toAddress] = &$this->_cellCache[$fromAddress];
|
||||
unset($this->_cellCache[$fromAddress]);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
} // function isDataSet()
|
||||
} // function moveCell()
|
||||
|
||||
|
||||
/**
|
||||
|
@ -169,6 +169,32 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C
|
||||
} // function deleteCacheData()
|
||||
|
||||
|
||||
/**
|
||||
* Move a cell object from one address to another
|
||||
*
|
||||
* @param string $fromAddress Current address of the cell to move
|
||||
* @param string $toAddress Destination address of the cell to move
|
||||
* @return boolean
|
||||
*/
|
||||
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;
|
||||
} // function moveCell()
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
|
@ -173,6 +173,32 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_
|
||||
} // function deleteCacheData()
|
||||
|
||||
|
||||
/**
|
||||
* Move a cell object from one address to another
|
||||
*
|
||||
* @param string $fromAddress Current address of the cell to move
|
||||
* @param string $toAddress Destination address of the cell to move
|
||||
* @return boolean
|
||||
*/
|
||||
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;
|
||||
} // function moveCell()
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user