PHP code example of marcocesarato / cpdo
1. Go to this page and download the library: Download marcocesarato/cpdo 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/ */
marcocesarato / cpdo example snippets
$db = CPDO::connect($database_type, $database_name, $database_host = null, $database_user = null, $database_pswd = null);
$db->backup($backup_dir, $backup_tables = '*');
$db->disableCache();
$db->enableCache();
CPDOCache::disable();
CPDOCache::enable();
$db->enableDebug();
$db->disableDebug();
CPDOLogger::enable();
CPDOLogger::disable();
array (
'count' => 3,
'queries' =>
array (
'SET NAMES \'utf8\'' =>
array (
0 =>
array (
'time' => 1530610903,
'execution_time' => 0.000247955322265625,
'cached' => false,
),
1 =>
array (
'time' => 1530610903,
'execution_time' => 0.000077955322265625,
'cached' => false,
),
),
'SELECT id FROM _deleted_records_ WHERE table = \'settings\' LIMIT 1' =>
array (
0 =>
array (
'time' => 1530610903,
'execution_time' => 0.00050687789916992188,
'cached' => false,
),
),
),
)
// Your loader/includes... => with e/path/database.json';
$cache = file_get_contents($database_cache_path);
$cache = json_decode($cache); // Or unserialize (slower)
CPDOCache::populate($cache);
unset($cache);
// Your code...
$cache = CPDOCache::retrieve();
$cache = json_encode($cache); // Or serialize (slower)
file_put_contents($database_cache_path, $cache);
unset($cache);