示例#1
0
	public function setConnection(NConnection $connection)
	{
		$this->connection = $connection;
		if ($this->cacheStorage) {
			$this->cache = new NCache($this->cacheStorage, 'Nette.Database.' . md5($connection->getDsn()));
			$this->structure = $this->loadedStructure = ($tmp=$this->cache->load('structure')) ? $tmp : $this->structure;
		}
	}
	public function setConnection(NConnection $connection)
	{
		$this->connection = $connection;
		if (!in_array($this->connection->getAttribute(PDO::ATTR_DRIVER_NAME), array('mysql'))) {
			throw new NotSupportedException("NDiscoveredReflections supports only mysql driver");
		}

		if ($this->cacheStorage) {
			$this->cache = new NCache($this->cacheStorage, 'Nette.Database.' . md5($connection->getDsn()));
			$this->structure = ($tmp=$this->cache->load('structure')) ? $tmp : $this->structure;
		}
	}