FileDB 클래스 추가

This commit is contained in:
2018-07-23 22:37:30 +09:00
parent 7b0cffcf30
commit 792e9717b2
3 changed files with 32 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace sammo;
//SQLite + catfan\Medoo
use \Medoo\Medoo;
class FileDB{
public static function DB(string $path, ?string $schemaPath = null) : Medoo{
//Note: reference count 적용. MySQL의 것과 다르게 동작함.
$db = new Medoo([
'database_type' => 'sqlite',
'database_file' => $path
]);
if($schemaPath){
$db->query(\file_get_contents($schemaPath));
}
return $db;
}
}