READONLY check
This commit is contained in:
parent
3689fbd3ae
commit
8c01f072c2
1 changed files with 2 additions and 2 deletions
|
@ -3,14 +3,14 @@ class Database
|
||||||
{
|
{
|
||||||
public static $handle = null;
|
public static $handle = null;
|
||||||
|
|
||||||
public function __construct($createDatabase = false, bool $readonly = false)
|
public function __construct($createDatabase = false)
|
||||||
{
|
{
|
||||||
if (self::$handle === null) {
|
if (self::$handle === null) {
|
||||||
self::$handle = new SQLite3(SQLITE_DB);
|
self::$handle = new SQLite3(SQLITE_DB);
|
||||||
self::$handle->enableExceptions(true);
|
self::$handle->enableExceptions(true);
|
||||||
self::$handle->busyTimeout(60000);
|
self::$handle->busyTimeout(60000);
|
||||||
|
|
||||||
if ($readonly === true) {
|
if (!defined("READONLY")) {
|
||||||
self::$handle->exec("PRAGMA read_uncommitted = true");
|
self::$handle->exec("PRAGMA read_uncommitted = true");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue