Davis Harrison Dion Posted November 24, 2020 Share Posted November 24, 2020 Hello, We're setting up a PW app that has a dozen sqlite databases it will use for various tasks and analytics. Does anyone know if there are any modules with any sqlite connectivity in them? I haven't seen any on first glance. I know this is nebulous, but is there any advise on how to best "fold in" sqlite connectivity AND data into PW's existing structure? Thanks! Link to comment Share on other sites More sharing options...
netcarver Posted November 24, 2020 Share Posted November 24, 2020 @Davis Harrison Dion Hello, whilst there has been sporadic chat in the forums regarding sqlite over the years, I don't think we are any closer to seeing core support for it. I'm also unaware of any third party integration that's using it. I'd be delighted if I were wrong about that though; perhaps someone lurking in here does know how it can be done. 1 Link to comment Share on other sites More sharing options...
Davis Harrison Dion Posted November 24, 2020 Author Share Posted November 24, 2020 @netcarver Thanks! That's what I sort of thought. This project/client uses sqlite db's to sling datasets between apps and clients. I can certainly whip up some connectivity, but I would like to module-ize it and I'm not sure how to do it in such a way to be useful to anyone else. Link to comment Share on other sites More sharing options...
adrian Posted November 24, 2020 Share Posted November 24, 2020 Note sure if it suits your needs or not, but it's really easy to include https://dibiphp.com/ into PW and then you can query those sqlite databases within your template files / modules. You can put this in your init.php file: require_once __DIR__ . '/vendor/autoload.php'; $this->wire("dibi", new Dibi\Connection([ 'driver' => 'sqlite', 'host' => hostname, 'username' => user, 'password' => pass, 'database' => dbname, ])); and then you can query using the global $dibi variable like this: $result = $dibi->query('SELECT * FROM mytable'); foreach ($result as $row) { echo $row->fieldname; } 7 Link to comment Share on other sites More sharing options...
Davis Harrison Dion Posted December 1, 2020 Author Share Posted December 1, 2020 On 11/24/2020 at 3:03 PM, adrian said: Note sure if it suits your needs or not, but it's really easy to include https://dibiphp.com/ into PW and then you can query those sqlite databases within your template files / modules. You can put this in your init.php file: @adrian This is really neat...thanks for posting! 1 Link to comment Share on other sites More sharing options...
pwired Posted December 2, 2020 Share Posted December 2, 2020 Thanks Adrian for posting about this dibiphp, was looking for this for a long time. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now