ensembl-hive  2.7.0
SemaphoreAdaptor.pm
Go to the documentation of this file.
1 =pod
2 
3 =head1 NAME
4 
6 
7 =head1 SYNOPSIS
8 
9  $semaphore_adaptor = $db_adaptor->get_SemaphoreAdaptor;
10 
11  $semaphore_adaptor = $semaphore_object->adaptor;
12 
13 =head1 DESCRIPTION
14 
15  Module to encapsulate all db access for persistent class Semaphore.
16  There should be just one per application and database connection.
17 
18 =head1 LICENSE
19 
20  See the NOTICE file distributed with this work for additional information
21  regarding copyright ownership.
22 
23  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
24  You may obtain a copy of the License at
25 
26  http://www.apache.org/licenses/LICENSE-2.0
27 
28  Unless required by applicable law or agreed to in writing, software distributed under the License
29  is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30  See the License for the specific language governing permissions and limitations under the License.
31 
32 =head1 CONTACT
33 
34  Please subscribe to the Hive mailing list: http://listserver.ebi.ac.uk/mailman/listinfo/ehive-users to discuss Hive-related questions or to be notified of our updates
35 
36 =cut
37 
38 
39 package Bio::EnsEMBL::Hive::DBSQL::SemaphoreAdaptor;
40 
41 use strict;
42 use warnings;
43 
44 use base ('Bio::EnsEMBL::Hive::DBSQL::ObjectAdaptor');
45 
46 
47 sub default_table_name {
48  return 'semaphore';
49 }
50 
51 
52 sub object_class {
53  return 'Bio::EnsEMBL::Hive::Semaphore';
54 }
55 
56 
57 sub increment_column_by_inc_and_id {
58  my ($self, $column_name, $inc, $semaphore_id) = @_;
59 
60  my $sql = "UPDATE semaphore SET $column_name = $column_name + $inc WHERE semaphore_id = $semaphore_id";
61 
62  $self->dbc->protected_prepare_execute( [ $sql ],
63  sub { my ($after) = @_; $self->db->get_LogMessageAdaptor->store_hive_message( "performing $sql".$after, 'INFO' ); }
64  );
65 }
66 
67 
68 1;
Bio::EnsEMBL::Hive::DBSQL::SemaphoreAdaptor
Definition: SemaphoreAdaptor.pm:19
Bio::EnsEMBL::Hive::Version
Definition: Version.pm:19
Bio::EnsEMBL::Hive
Definition: Hive.pm:38