Example #1
0
            throw new \browserfs\Exception('getDIInjector must be called after setDIInjector!');
        }
        return $this->instantiator;
    }
    /**
     * Returns the default caching service of the database.
     * The default caching service of the database is storing database
     * schema, etc.
     *
     * @return \browserfs\website\Cache
     */
    public function getCache()
    {
        if ($this->cache === null) {
            if (array_key_exists('cacheSourceName', $this->initArgs)) {
                $cacheSourceName = $this->initArgs['cacheSourceName'];
                $this->cache = $this->getDIInjector()->getService('cache')->{$cacheSourceName}->createNamespace('db_schema_' . $this->dsn);
            } else {
                try {
                    $this->cache = $this->getDIInjector()->getService('cache')->default->createNamespace('db_schema_' . $this->dsn);
                } catch (\browserfs\Exception $e) {
                    $this->cache = new \browserfs\website\Cache\Driver\Memory(null, 'memory');
                }
            }
        }
        return $this->cache;
    }
    public abstract function execDumpFile($filePath);
}
\browserfs\website\Database::registerDriver('mysql', '\\' . __NAMESPACE__ . '\\Database\\Driver\\MySQL');