public function fetch($sql, $data, $single = false)
{
$sth = $this->getDb()->prepare($sql);
$result = $sth->execute($data);
if ($result === false) {
$error = $sth->errorInfo();
$this->lastError = 'DB ERROR: [' . $sth->errorCode() . '] ' . $error[2];
return false;
}
$results = $sth->fetchAll(\PDO::FETCH_ASSOC);
return $single === true ? array_shift($results) : $results;
}