Closed mychidarko closed 1 year ago
Hello is there example how to connect to sqlite? i get error Leaf\Db::connect(): Argument #1 ($host) must be of type string, array given, called in
$app->get("/", function () use($app) {
$pdo = new PDO("sqlite:".__DIR__."/db.sqlite");
$stm = $pdo->query('SELECT * FROM ll_User');
$rows = $stm->fetchAll();
$db = new Leaf\Db;
$db->connect([
'host' => 'sqlite:'.__DIR__.'/db.sqlite',
'dbtype' => 'sqlite',
'pdoOptions' => 'sqlite:'.__DIR__.'/db.sqlite'
]);
$users = $db->select('ll_User')->where('id', '1')->fetchAll();
$app->response()->json(["message" => json_encode($rows)]);
});
db()->connect([
'dbname' => 'db2.sqlite',
'dbtype' => 'sqlite',
]);
Documentation needs to cover this
Db connection + documentation not extensive enough. It needs to cover popular db types like mssql and sqlite