Jump to content

Recommended Posts

Posted

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!

Posted

@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.

  • Like 1
Posted

@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.

Posted

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;
}

 

  • Like 7

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...