60 if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
61 $this->_currentObject->detach();
63 if (!$this->_DBHandle->queryExec(
"INSERT OR REPLACE INTO kvp_".$this->_TableName.
" VALUES('".$this->_currentObjectID.
"','".sqlite_escape_string(serialize($this->_currentObject)).
"')"))
65 $this->_currentCellIsDirty =
false;
67 $this->_currentObjectID = $this->_currentObject = null;
80 if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
84 $this->_currentObjectID = $pCoord;
85 $this->_currentObject = $cell;
86 $this->_currentCellIsDirty =
true;
100 if ($pCoord === $this->_currentObjectID) {
105 $query =
"SELECT value FROM kvp_".$this->_TableName.
" WHERE id='".$pCoord.
"'";
106 $cellResultSet = $this->_DBHandle->query(
$query,SQLITE_ASSOC);
107 if ($cellResultSet ===
false) {
109 } elseif ($cellResultSet->numRows() == 0) {
115 $this->_currentObjectID = $pCoord;
117 $cellResult = $cellResultSet->fetchSingle();
118 $this->_currentObject = unserialize($cellResult);
120 $this->_currentObject->attach($this);
134 if ($pCoord === $this->_currentObjectID) {
139 $query =
"SELECT id FROM kvp_".$this->_TableName.
" WHERE id='".$pCoord.
"'";
140 $cellResultSet = $this->_DBHandle->query(
$query,SQLITE_ASSOC);
141 if ($cellResultSet ===
false) {
143 } elseif ($cellResultSet->numRows() == 0) {
158 if ($pCoord === $this->_currentObjectID) {
159 $this->_currentObject->detach();
160 $this->_currentObjectID = $this->_currentObject = null;
164 $query =
"DELETE FROM kvp_".$this->_TableName.
" WHERE id='".$pCoord.
"'";
165 if (!$this->_DBHandle->queryExec(
$query))
168 $this->_currentCellIsDirty =
false;
180 if ($fromAddress === $this->_currentObjectID) {
189 $query =
"UPDATE kvp_".$this->_TableName.
" SET id='".
$toAddress.
"' WHERE id='".$fromAddress.
"'";
190 $result = $this->_DBHandle->exec($query);
204 if ($this->_currentObjectID !== null) {
208 $query =
"SELECT id FROM kvp_".$this->_TableName;
209 $cellIdsResult = $this->_DBHandle->unbufferedQuery(
$query,SQLITE_ASSOC);
210 if ($cellIdsResult ===
false)
214 foreach($cellIdsResult as
$row) {
215 $cellKeys[] = $row[
'id'];
233 $tableName = str_replace(
'.',
'_',$this->
_getUniqueID());
234 if (!$this->_DBHandle->queryExec(
'CREATE TABLE kvp_'.$tableName.
' (id VARCHAR(12) PRIMARY KEY, value BLOB) 235 AS SELECT * FROM kvp_'.$this->_TableName))
239 $this->_TableName = $tableName;
249 if(!is_null($this->_currentObject)) {
250 $this->_currentObject->detach();
251 $this->_currentObject = $this->_currentObjectID = null;
254 $this->_parent = null;
267 parent::__construct($parent);
268 if (is_null($this->_DBHandle)) {
269 $this->_TableName = str_replace(
'.',
'_',$this->
_getUniqueID());
270 $_DBName =
':memory:';
272 $this->_DBHandle =
new SQLiteDatabase($_DBName);
273 if ($this->_DBHandle ===
false)
275 if (!$this->_DBHandle->queryExec(
'CREATE TABLE kvp_'.$this->_TableName.
' (id VARCHAR(12) PRIMARY KEY, value BLOB)'))
285 if (!is_null($this->_DBHandle)) {
286 $this->_DBHandle->queryExec(
'DROP TABLE kvp_'.$this->_TableName);
288 $this->_DBHandle = null;
299 if (!function_exists(
'sqlite_open')) {
addCacheData($pCoord, PHPExcel_Cell $cell)
Add or Update a cell in cache identified by coordinate address.
isDataSet($pCoord)
Is a value set for an indexed cell?
moveCell($fromAddress, $toAddress)
Move a cell object from one address to another.
__destruct()
Destroy this cell collection.
getCellList()
Get a list of all cell addresses currently held in cache.
_getUniqueID()
Generate a unique ID for cache referencing.
__construct(PHPExcel_Worksheet $parent)
Initialise this new cell collection.
Create styles array
The data for the language used.
unsetWorksheetCells()
Clear the cell collection and disconnect from our parent.
copyCellCollection(PHPExcel_Worksheet $parent)
Clone the cell collection.
_storeData()
Store cell data in cache for the current cell object if it's "dirty", and the 'nullify' the current c...
getCacheData($pCoord)
Get cell at a specific coordinate.
static cacheMethodIsAvailable()
Identify whether the caching method is currently available Some methods are dependent on the availabi...
deleteCacheData($pCoord)
Delete a cell in cache identified by coordinate address.