예제 #1
0
 protected function addDatabaseSource($databaseName, $databaseURI)
 {
     $info = @parse_url($databaseURI);
     if ($info === false || !is_array($info) || !isset($info['scheme'])) {
         throw new \browserfs\Exception('URL "' . $databaseURI . '" is not a valid database URI ( source = "' . $databaseName . '" )');
     }
     $dbType = $info['scheme'];
     $db = \browserfs\website\Database::factory($dbType, $info, $databaseName);
     $this->databases[$databaseName] = $db;
 }
예제 #2
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');
예제 #3
0
파일: MySQL.php 프로젝트: browserfs/website
 protected function __construct($config, $dsn)
 {
     // THIS SHOULD BE THE FIRST LINE OF CODE FOR A DATABASE DRIVER IMPLEMENTATION
     parent::__construct($config, $dsn);
 }