FileDB 클래스 추가
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user