From 18a4df8ca4e1dd5757ae94cc4711ed044279bb99 Mon Sep 17 00:00:00 2001
From: Andrew Yates <ayates@ebi.ac.uk>
Date: Mon, 21 May 2012 15:37:33 +0000
Subject: [PATCH] Slight re-working of method to avoid insert id issues and to
 still take in attributes

---
 modules/Bio/EnsEMBL/DBSQL/BaseAdaptor.pm | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/modules/Bio/EnsEMBL/DBSQL/BaseAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/BaseAdaptor.pm
index e173cf2d41..8b9731bca3 100755
--- a/modules/Bio/EnsEMBL/DBSQL/BaseAdaptor.pm
+++ b/modules/Bio/EnsEMBL/DBSQL/BaseAdaptor.pm
@@ -703,14 +703,18 @@ sub last_insert_id {
   my ($self, $field, $attributes, $table) = @_;
   my $dbc = $self->dbc();
   my $dbh = $dbc->db_handle();
+  my @args;
   if($dbc->driver() eq 'mysql') {
-    return $dbh->last_insert_id();
+    @args = (undef,undef,undef,undef);
   }
-  $attributes ||= {};
-  if(!$table) {
-    ($table) = $self->_tables();
+  else {
+    if(!$table) {
+      ($table) = $self->_tables();
+    }
+    @args = (undef, $dbc->dbname(), $table->[0], $field);
   }
-  return $dbh->last_insert_id(undef, $dbc->dbname(), $table->[0], $field, $attributes);
+  $attributes ||= {};
+  return $dbh->last_insert_id(@args, $attributes);
 }
 
 
-- 
GitLab