Skip to content

Database integration #70

Answered by clue
divine asked this question in Q&A
Sep 17, 2021 · 0 comments · 7 replies
Discussion options

You must be logged in to vote

@divine Thanks for bringing this up, excellent question!

I'm glad to hear you're interested and already support Framework X as a sponsor, so here's an excerpt form the upcoming documentation:

$factory = new Clue\React\SQLite\Factory();
$db = $factory->openLazy('count.db', null, ['idle' => 0.001]);

$app->get('/count', function (ServerRequestInterface $request) use ($db) {
    return $db->query('SELECT COUNT(*) AS count FROM hits')->then(function (Result $result) {
        return new Response(200, ['Content-Type' => 'text/plain'], $result->rows[0]['count'] . "\n");
    });
});

We're actually working on this very section in the documentation as we speak, but covering all the nasty details a…

Replies: 0 comments 7 replies

Comment options

You must be logged in to vote
6 replies
@clue
Comment options

@divine
Comment options

@clue
Comment options

@divine
Comment options

@clue
Comment options

Answer selected by divine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants