You are here

public function PHPExcel_CachedObjectStorage_SQLite::__construct 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::__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/SQLite.php, line 266

Class

PHPExcel_CachedObjectStorage_SQLite
PHPExcel_CachedObjectStorage_SQLite

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 SQLiteDatabase($_DBName);
    if ($this->_DBHandle === false) {
      throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle
        ->lastError()));
    }
    if (!$this->_DBHandle
      ->queryExec('CREATE TABLE kvp_' . $this->_TableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) {
      throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle
        ->lastError()));
    }
  }
}