Jump to content
Davis Harrison Dion

Sqlite -- Modules, Case Studies or Advise

Recommended Posts

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!

Share this post


Link to post
Share on other sites

@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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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!

  • Like 1

Share this post


Link to post
Share on other sites

Thanks Adrian for posting about this dibiphp, was looking for this for a long time.

Share this post


Link to post
Share on other sites

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