1. Go to this page and download the library: Download pine3ree/p3-pdo library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$pdo = new pine3ree\PDO\Reconnecting\PDO(
$dsn = 'sqlite:my-db.sqlite3',
$username = '',
$password = '',
$options = [],
$ttl = 6 // drops the current connection after 6 seconds and establish a new one on demand
);
[
// every runned query including re-runs
'statements' => [
0 => [...],
1 => [...],
//....
n => [
'sql' => "SELECT * FROM `user` WHERE `id` = :id",
'iter' => 2, // the iteration index for this sql expression
'time' => 0.000254..., // in seconds.microseconds
'params' => [':id' => 123]
],
],
// queries indexed by sql expression
'reruns' => [
'md5(sql1)' => [...],
//...,
'md5(sqln)' => [
'sql' => "SELECT * FROM `users` WHERE `status` = 1",
'iter' => 5, // the number of iterations for this sql expression
'time' => 0.001473..., // total time for all re-runs
],
],
'time' => 23.5678, // total query time
'count' => 15, // total query count
];