40 $sql =
"select * from mimetype where 41 mimetype_name='application/x-rpm' 42 or mimetype_name='application/x-debian-package' 43 or mimetype_name='application/x-debian-source'";
44 $result = pg_query($PG_CONN, $sql);
46 while ($row = pg_fetch_assoc($result)) {
47 if ($row[
'mimetype_name'] ==
'application/x-rpm') {
48 $pkArray[0] = $row[
'mimetype_pk'];
49 }
else if ($row[
'mimetype_name'] ==
'application/x-debian-package') {
50 $pkArray[1] = $row[
'mimetype_pk'];
51 }
else if ($row[
'mimetype_name'] ==
'application/x-debian-source') {
52 $pkArray[2] = $row[
'mimetype_pk'];
55 pg_free_result($result);
72 &$NumSrcPkgs, &$NumBinPkgs, &$NumBinNoSrcPkgs)
76 list($rpm_mtpk, $deb_mtsrcpk, $deb_mtbinpk) = $MimetypeArray;
79 if ($uploadtree_row[
'pfile_mimetypefk'] == $deb_mtsrcpk) {
85 if ($uploadtree_row[
'pfile_mimetypefk'] == $deb_mtbinpk) {
87 $srcpkgmt = $deb_mtsrcpk;
91 $sql =
"select source from pkg_deb where pfile_fk=$uploadtree_row[pfile_fk] limit 1";
92 $result = pg_query($PG_CONN, $sql);
94 $row = pg_fetch_assoc($result);
95 $source = $row[
'source'];
96 pg_free_result($result);
105 if ($uploadtree_row[
'pfile_mimetypefk'] == $rpm_mtpk) {
106 $srcpkgmt = $rpm_mtpk;
108 $sql =
"select source_rpm from pkg_rpm where pfile_fk=$uploadtree_row[pfile_fk] limit 1";
109 $result = pg_query($PG_CONN, $sql);
111 $row = pg_fetch_assoc($result);
112 $source = $row[
'source_rpm'];
113 pg_free_result($result);
114 if ((substr($source, 0, 6) ==
"(none)") || empty($source)) {
123 if (empty($source)) {
129 $source =
trim($source);
130 $sql =
"select uploadtree_pk from uploadtree, pfile where 131 upload_fk=$uploadtree_row[upload_fk] and ufile_name='$source' 132 and pfile_fk=pfile_pk and pfile_mimetypefk=$srcpkgmt limit 1";
133 $result = pg_query($PG_CONN, $sql);
135 if (pg_num_rows($result) == 0) {
138 pg_free_result($result);
GetPkgMimetypes()
Get package mimetype.
IncrSrcBinCounts($uploadtree_row, $MimetypeArray, &$NumSrcPkgs, &$NumBinPkgs, &$NumBinNoSrcPkgs)
Increment counts of source package, binary package, and binary with no source.
foreach($Options as $Option=> $OptVal) if(0==$reference_flag &&0==$nomos_flag) $PG_CONN
list_t type structure used to keep various lists. (e.g. there are multiple lists).
DBCheckResult($result, $sql, $filenm, $lineno)
Check the postgres result for unexpected errors. If found, treat them as fatal.
char * trim(char *ptext)
Trimming whitespace.