for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace arc\store;
class ResultHandlers {
public static function getDBHandler($db)
{
return function($query, $args) use ($db) {
$q = $db->prepare('select * from nodes where '.$query);
$result = $q->execute($args);
$result
$dataset = [];
while ( $data = $q->fetch(\PDO::FETCH_ASSOC) ) {
$value = (object) $data;
$value->data = json_decode($value->data);
$value->ctime = strtotime($value->ctime);
$value->mtime = strtotime($value->mtime);
$path = $value->parent.$value->name.'/';
$dataset[$path] = $value;
}
return $dataset;
};
public static function getDBGeneratorHandler($db)
$q = $db->prepare('select * from nodes where '.$query, array(
\PDO::ATTR_CURSOR => \PDO::CURSOR_SCROLL
));
$data = $q->fetch(\PDO::FETCH_ASSOC);
while ($data) {
$path = $value->path;
yield $path => $value;