2016-10-06 02:08:43 +00:00
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace JKingWeb\NewsSync\Db;
|
|
|
|
|
|
|
|
class DriverSQLite3 implements Driver {
|
|
|
|
use CommonPDO, CommonSQLite3;
|
|
|
|
|
|
|
|
protected $db;
|
|
|
|
|
2016-10-17 20:49:39 +00:00
|
|
|
private function __construct(\JKingWeb\NewsSync\RuntimeData $data, bool $install = false) {
|
2016-10-06 02:08:43 +00:00
|
|
|
// FIXME: stub
|
|
|
|
}
|
|
|
|
|
|
|
|
public function __destruct() {
|
|
|
|
// FIXME: stub
|
|
|
|
}
|
|
|
|
|
2016-10-17 20:49:39 +00:00
|
|
|
static public function create(\JKingWeb\NewsSync\RuntimeData $data, bool $install = false): Driver {
|
2016-10-06 02:08:43 +00:00
|
|
|
// check to make sure required extensions are loaded
|
|
|
|
if(class_exists("PDO") && in_array("sqlite",\PDO::getAvailableDrivers())) {
|
2016-10-17 20:49:39 +00:00
|
|
|
return new self($data, $install);
|
2016-10-06 02:08:43 +00:00
|
|
|
} else if(class_exists("SQLite3")) {
|
2016-10-17 20:49:39 +00:00
|
|
|
return new DriverSQLite3($data, $install);
|
2016-10-06 02:08:43 +00:00
|
|
|
} else {
|
|
|
|
throw new Exception("extMissing", self::driverName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|