From 4293e3575db05b9eb0bd310c38aa51bc11115997 Mon Sep 17 00:00:00 2001
From: Alessandro Vullo <avullo@ebi.ac.uk>
Date: Thu, 20 Oct 2016 15:18:28 +0100
Subject: [PATCH] [ENSCORESW-1997]. Enable local load data feature at the
 specific driver level.

Unfortunately, creating an appropriate test turns out to be extremely incovenient
as one must make sure the underlying DBD::mysql has been compiled against a C library
where this feature is turned off.

This approach has been tested at the base class level and it seems to be working, so this
is more for:
- the team to quickly have a look and make appropriate suggestions;
- Andy Y to set up a proper test environment, run a test and confirm, as we've discussed.
---
 modules/Bio/EnsEMBL/DBSQL/Driver/mysql.pm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/modules/Bio/EnsEMBL/DBSQL/Driver/mysql.pm b/modules/Bio/EnsEMBL/DBSQL/Driver/mysql.pm
index a81fba1129..2a900544f2 100644
--- a/modules/Bio/EnsEMBL/DBSQL/Driver/mysql.pm
+++ b/modules/Bio/EnsEMBL/DBSQL/Driver/mysql.pm
@@ -34,6 +34,20 @@ use strict;
 
 use base 'Bio::EnsEMBL::DBSQL::Driver';
 
+#
+# override parent's method to enable MySQL local load data in case DBD::mysql 
+# has been compiled against a C client library which has been built with
+# no support for this feature
+#
+sub connect_params {
+  my ($self, $conn) = @_;
+
+  my $params = $self->SUPER::connect_params($conn);
+  $params->{attributes}{mysql_local_infile} = 1;
+
+  return $params;
+}
+
 sub from_date_to_seconds {
     my ($self, $column) = @_;
     return "UNIX_TIMESTAMP($column)";
-- 
GitLab