1
0

Show versions without OTA in different style.

This commit is contained in:
2017-12-17 19:33:33 +01:00
parent c8dd58aab1
commit 3de1b94816
3 changed files with 21 additions and 3 deletions

View File

@ -117,14 +117,23 @@ class SQLiteReader
return $result;
}
public function getAllVersionsForRef($ref = null)
public function getAllVersionsForRef($ref = null, $which = self::BOTH)
{
$sql = 'SELECT fv, tv FROM updates u LEFT JOIN files f ON u.file_sha1=f.sha1';
$where_arr = array();
$params_arr = array();
if (!is_null($ref)) {
$sql .= ' WHERE curef=?';
$where_arr[] = 'curef=?';
$params_arr[] = $ref;
}
if ($which == self::OTA_ONLY) {
$where_arr[] = 'fv IS NOT null';
} elseif ($which == self::FULL_ONLY) {
$where_arr[] = 'fv IS null';
}
if (count($where_arr) > 0) {
$sql .= ' WHERE ' . implode(' AND ', $where_arr);
}
$stmt = $this->pdo->prepare($sql);
$ok = $stmt->execute($params_arr);
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);