public function PHPExcel_CachedObjectStorage_SQLite3::__construct in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/SQLite3.php \PHPExcel_CachedObjectStorage_SQLite3::__construct()
* Initialise this new cell collection * *
Parameters
PHPExcel_Worksheet $parent The worksheet for this cell collection:
Overrides PHPExcel_CachedObjectStorage_CacheBase::__construct
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ CachedObjectStorage/ SQLite3.php, line 299
Class
- PHPExcel_CachedObjectStorage_SQLite3
- PHPExcel_CachedObjectStorage_SQLite3
Code
public function __construct(PHPExcel_Worksheet $parent) {
parent::__construct($parent);
if (is_null($this->_DBHandle)) {
$this->_TableName = str_replace('.', '_', $this
->_getUniqueID());
$_DBName = ':memory:';
$this->_DBHandle = new SQLite3($_DBName);
if ($this->_DBHandle === false) {
throw new PHPExcel_Exception($this->_DBHandle
->lastErrorMsg());
}
if (!$this->_DBHandle
->exec('CREATE TABLE kvp_' . $this->_TableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) {
throw new PHPExcel_Exception($this->_DBHandle
->lastErrorMsg());
}
}
$this->_selectQuery = $this->_DBHandle
->prepare("SELECT value FROM kvp_" . $this->_TableName . " WHERE id = :id");
$this->_insertQuery = $this->_DBHandle
->prepare("INSERT OR REPLACE INTO kvp_" . $this->_TableName . " VALUES(:id,:data)");
$this->_updateQuery = $this->_DBHandle
->prepare("UPDATE kvp_" . $this->_TableName . " SET id=:toId WHERE id=:fromId");
$this->_deleteQuery = $this->_DBHandle
->prepare("DELETE FROM kvp_" . $this->_TableName . " WHERE id = :id");
}