Beispiel #1
0
<?php

require_once '../../MPLT.php';
$timer = new MPLT();
require_once '../../src/dalmp.php';
# ------------------------------------------------------------------------------
$user = getenv('MYSQL_USER') ?: 'root';
$password = getenv('MYSQL_PASS') ?: '';
$host = getenv('MYSQL_HOST') ?: '127.0.0.1';
$port = getenv('MYSQL_PORT') ?: '3306';
$db = new DALMP\Database("utf8://{$user}:{$password}@{$host}:{$port}/dalmp");
foreach ($db->GetCol('SHOW TABLES') as $table) {
    $rs = $db->Execute("OPTIMIZE TABLE {$table}");
    echo "optimizing {$table}: {$rs}", PHP_EOL;
    $rs = $db->Execute("REPAIR TABLE {$table} QUICK");
    echo "repairing {$table}: {$rs}", PHP_EOL;
}
# ------------------------------------------------------------------------------
echo PHP_EOL, str_repeat('-', 80), PHP_EOL, 'Time: ', $timer->getPageLoadTime(), ' - Memory: ', $timer->getMemoryUsage(1), PHP_EOL, str_repeat('-', 80), PHP_EOL;
Beispiel #2
0
 public function testGetCol()
 {
     $rs = $this->db->GetCol("SELECT * From Country WHERE Continent='Oceania' AND Population < 10000");
     $this->assertEquals(7, count($rs));
     $this->assertEquals(array('CCK', 'CXR', 'NFK', 'NIU', 'PCN', 'TKL', 'UMI'), $rs);
 }