ensembl-hive  2.8.1
mysql.pm
Go to the documentation of this file.
1 =head1 LICENSE
2 
3 See the NOTICE file distributed with this work for additional information
4 regarding copyright ownership.
5 
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9 
10  http://www.apache.org/licenses/LICENSE-2.0
11 
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17 
18 =cut
19 
20 =head1 CONTACT
21 
22  Please email comments or questions to the public Ensembl
23  developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.
24 
25  Questions may also be sent to the Ensembl help desk at
26  <http://www.ensembl.org/Help/Contact>.
27 
28 =cut
29 
30 package Bio::EnsEMBL::DBSQL::Driver::mysql;
31 
32 use warnings;
33 use strict;
34 
35 use base 'Bio::EnsEMBL::DBSQL::Driver';
36 
37 #
38 # override parent's method to enable MySQL local load data in case DBD::mysql
39 # has been compiled against a C client library which has been built with
40 # no support for this feature
41 #
42 sub connect_params {
43  my ($self, $conn) = @_;
44 
45  my $params = $self->SUPER::connect_params($conn);
46  $params->{attributes}{mysql_local_infile} = 1;
47 
48  return $params;
49 }
50 
51 sub from_date_to_seconds {
52  my ($self, $column) = @_;
53  return "UNIX_TIMESTAMP($column)";
54 }
55 
56 sub from_seconds_to_date {
57  my ($self, $seconds) = @_;
58  return "from_unixtime($seconds)";
59 }
60 
61 sub last_insert_id_args {
62  return (undef, undef, undef, undef);
63 }
64 
65 sub insert_ignore_clause {
66  return 'INSERT IGNORE';
67 }
68 
69 sub can_straight_join {
70  return 1;
71 }
72 
73 sub set_wait_timeout {
74  my ($self, $dbh, $timeout) = @_;
75  $dbh->do( "SET SESSION wait_timeout=${timeout}" );
76  return;
77 }
78 
79 1;