X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lib%2FDebbugs%2FDB%2FResultSet%2FSrcAssociation.pm;fp=lib%2FDebbugs%2FDB%2FResultSet%2FSrcAssociation.pm;h=047c54de06a903ce41aed9f87b0e9370c0c91e4c;hb=1e6633a3780f4fd53fc4303852e84d13cdad2dc6;hp=0000000000000000000000000000000000000000;hpb=466f7faff129a5699c7674f59900a92aa256175d;p=debbugs.git diff --git a/lib/Debbugs/DB/ResultSet/SrcAssociation.pm b/lib/Debbugs/DB/ResultSet/SrcAssociation.pm new file mode 100644 index 0000000..047c54d --- /dev/null +++ b/lib/Debbugs/DB/ResultSet/SrcAssociation.pm @@ -0,0 +1,48 @@ +# This module is part of debbugs, and is released +# under the terms of the GPL version 2, or any later version. See the +# file README and COPYING for more information. +# Copyright 2017 by Don Armstrong . +use utf8; +package Debbugs::DB::ResultSet::SrcAssociation; + +=head1 NAME + +Debbugs::DB::ResultSet::SrcAssociation - Source/Suite Associations + +=head1 SYNOPSIS + + + +=head1 DESCRIPTION + + + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::ResultSet'; + +use Debbugs::DB::Util qw(select_one); + + +sub insert_suite_src_ver_association { + my ($self,$suite_id,$src_ver_id) = @_; + return $self->result_source->schema->storage-> + dbh_do(sub { + my ($s,$dbh,$suite_id,$src_ver_id) = @_; + return select_one($dbh,<<'SQL',$suite_id,$src_ver_id); +INSERT INTO src_associations (suite,source) + VALUES (?,?) ON CONFLICT (suite,source) DO + UPDATE SET modified = NOW() +RETURNING id; +SQL + }, + $suite_id,$src_ver_id + ); +} + +1; + +__END__