From 792e9717b23755b68773dee6e669ab8dbfe6d814 Mon Sep 17 00:00:00 2001 From: hide_d Date: Mon, 23 Jul 2018 22:37:30 +0900 Subject: [PATCH] =?UTF-8?q?FileDB=20=ED=81=B4=EB=9E=98=EC=8A=A4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + f_install/sql/err_log.sql | 12 ++++++++++++ src/sammo/FileDB.php | 19 +++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 f_install/sql/err_log.sql create mode 100644 src/sammo/FileDB.php diff --git a/.gitignore b/.gitignore index 796e3b87..61948b4b 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,4 @@ test.php phpinfo.php vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/* +*.sqlite3 diff --git a/f_install/sql/err_log.sql b/f_install/sql/err_log.sql new file mode 100644 index 00000000..cecd3a44 --- /dev/null +++ b/f_install/sql/err_log.sql @@ -0,0 +1,12 @@ +BEGIN TRANSACTION; +CREATE TABLE IF NOT EXISTS `err_log` ( + `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + `date` TEXT NOT NULL, + `err` TEXT NOT NULL, + `errstr` TEXT NOT NULL, + `trace` TEXT NOT NULL +); +CREATE INDEX IF NOT EXISTS `date` ON `err_log` ( + `date` DESC +); +COMMIT; diff --git a/src/sammo/FileDB.php b/src/sammo/FileDB.php new file mode 100644 index 00000000..6ebbd92e --- /dev/null +++ b/src/sammo/FileDB.php @@ -0,0 +1,19 @@ + 'sqlite', + 'database_file' => $path + ]); + if($schemaPath){ + $db->query(\file_get_contents($schemaPath)); + } + return $db; + } +} \ No newline at end of file