8 namespace Fossology\Lib\Dao;
29 $this->logger = $logger;
38 $statementName = __METHOD__;
40 $this->
dbManager->prepare($statementName,
"
43 INNER JOIN upload_packages up ON p.package_pk = up.package_fk
44 INNER JOIN upload_packages up2 ON p.package_pk = up2.package_fk
45 INNER JOIN upload u ON up2.upload_fk = u.upload_pk
46 WHERE up.upload_fk = $1
47 ORDER BY up2.upload_fk ASC");
48 $res = $this->
dbManager->execute($statementName, array($uploadId));
52 while ($row = $this->
dbManager->fetchArray($res)) {
53 $packageId = intval($row[
'package_pk']);
54 $packageName = $row[
'package_name'];
58 return $packageId > 0 ?
new Package($packageId, $packageName, $uploads) :
null;
66 $statementName = __METHOD__;
69 "INSERT INTO package (package_name) VALUES($1) RETURNING package_pk",
70 array($packageName), $statementName);
71 return new Package(intval($row[
'package_pk']), $packageName, array());
80 $statementName = __METHOD__;
83 "INSERT INTO upload_packages (package_fk, upload_fk) VALUES($1, $2)");
84 $res = $this->
dbManager->execute($statementName, array($package->
getId(), $uploadId));
findPackageForUpload($uploadId)
createPackage($packageName)
__construct(DbManager $dbManager, Logger $logger)
addUploadToPackage($uploadId, Package $package)
static createFromTable($row)
fo_dbManager * dbManager
fo_dbManager object