summaryrefslogtreecommitdiff
path: root/db.php
diff options
context:
space:
mode:
Diffstat (limited to 'db.php')
-rw-r--r--db.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/db.php b/db.php
new file mode 100644
index 0000000..1dc8ce0
--- /dev/null
+++ b/db.php
@@ -0,0 +1,20 @@
+<?php
+class Db {
+ private static $instance;
+ private $dbh;
+
+ private function __construct() {
+ $this->dbh = new SQLite3(__DIR__ . "/" . SCRATCH_DB);
+ $this->dbh->busyTimeout(30*1000);
+ }
+
+ public static function get() {
+ if (self::$instance == null)
+ self::$instance = new self();
+
+ return self::$instance->dbh;
+ }
+
+};
+
+?>