require_once '../../MPLT.php'; $timer = new MPLT(); require_once '../../src/dalmp.php'; # ------------------------------------------------------------------------------ $timer->setMark('start'); $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"); $db->FetchMode('NUM'); $sql = 'SELECT * FROM City'; $rs = $db->Execute($sql); if ($rs) { while (($rows = $db->query()) != false) { list($r1, $r2, $r3) = $rows; echo "w1: {$r1}, w2: {$r2}, w3: {$r3}", $timer->isCli(1); } } $timer->setMark('while'); /** * doing the same but consuming more memory. * Below the returned $rs2 array is not referential. Because of that, the system * will use excesive memory. With large columns. */ $rs2 = $db->GetAll($sql); foreach ($rs2 as $value) { list($r1, $r2, $r3) = $value; echo "f1: {$r1}, f2: {$r2}, f3: {$r3}", $timer->isCli(1); }