PHP Classes


Recommend this page to a friend!

      PHP Web Push Notifications Server  >  PHP Web Push Notifications Server package blog  >  How to Use a PHP Push...  >  All threads  >  MySQL  >  (Un) Subscribe thread alerts  
Summary:How to replace SQLite with MySQL
Date:2022-01-21 10:12:42

  1. MySQL   Reply   Report abuse  
Picture of Alex Alex - 2022-01-21 10:12:42
Hi Stefan, thank you very much for this package. Could you explain us precisely how to replace SQLite with MySQL?

I see 'PNDataProviderMySQL.php' and 'phpunit.xml', but I was hoping there would be some code to uncomment to use MySQL...

So where (in which file, at which line) should we modify files and with what code?

Last question: what are the files to remove to have a minimum but functional package?

I'd rather go study tests elsewhere and add their files if I need them rather than leave them in the folder by default and not know if they impact the system when I delete them.

In advance, thank you again!

  2. Re: MySQL   Reply   Report abuse  
Picture of Stefan Kientzler Stefan Kientzler - 2022-01-23 15:12:33 - In reply to message 1 from Alex
Hi Alex,

to work with MySQL, you only have to use the PNDataProviderMySQL
instead of the PNDataProviderSQLite.

In the example files, replace each call of
$oDP = new PNDataProviderSQLite(...);
$oDP = new PNDataProviderMySQL(<host>, <user>, <Pwd>, <DBName>);

where you have to pass the connection informations to your DB.

There aren't anything in the package that can be removed - in contrast to other packages that can be found on the net, this one is already reduced to the absolute minimum in order to work without any dependencies on other extensive libraries!

  3. Re: MySQL   Reply   Report abuse  
Picture of Alex Alex - 2022-01-24 09:15:18 - In reply to message 2 from Stefan Kientzler
Thank you Stefan!