1 # This module is part of debbugs, and is released
2 # under the terms of the GPL version 2, or any later version. See the
3 # file README and COPYING for more information.
4 # Copyright 2017 by Don Armstrong <don@donarmstrong.com>.
6 package Debbugs::DB::ResultSet::BinPkg;
10 Debbugs::DB::ResultSet::BinPkg - Source Package
25 use base 'DBIx::Class::ResultSet';
27 sub bin_pkg_and_ver_in_suite {
28 my ($self,$suite) = @_;
29 $suite = $self->result_source->schema->
30 resultset('Suite')->get_suite_id($suite);
32 $self->search_rs({'bin_associations.suite' => $suite,
34 {join => {bin_vers => ['bin_associations','arch']},
35 result_class => 'DBIx::Class::ResultClass::HashRefInflator',
36 columns => [qw(me.pkg bin_vers.ver arch.arch bin_associations.id)]
44 return $self->result_source->schema->
45 select_one(<<'SQL',$pkg);
46 SELECT id FROM bin_pkg where pkg = ?;
50 sub get_or_create_bin_pkg_id {
52 return $self->result_source->schema->
53 select_one(<<'SQL',$pkg,$pkg);
55 INSERT INTO bin_pkg (pkg)
56 VALUES (?) ON CONFLICT (pkg) DO NOTHING RETURNING id
60 SELECT id FROM bin_pkg where pkg = ?