Skip to content
Snippets Groups Projects
Commit 43cb7339 authored by Marek Szuba's avatar Marek Szuba
Browse files

BaseParser: inserts into "synonym" now explicitly specify columns

Part of the 2018 xref sprint has been devoted to making the xref
database schema a bit more self-constrained so that it could in
principle work with database engines other than MyISAM. One of the
changes made here has been the addition of an internal key column to the
table 'synonym'. Make sure inserts into that table do not get confused
by the possible presence of a new column.
parent 139c0b40
Branches feature/baseparser_synonym_columns
No related tags found
1 merge request!415Feature/baseparser synonym columns
......@@ -447,7 +447,7 @@ sub upload_xref_object_graphs {
my $xref_sth = $dbi->prepare('INSERT INTO xref (accession,version,label,description,source_id,species_id, info_type) VALUES(?,?,?,?,?,?,?)');
my $pri_insert_sth = $dbi->prepare('INSERT INTO primary_xref VALUES(?,?,?,?)');
my $pri_update_sth = $dbi->prepare('UPDATE primary_xref SET sequence=? WHERE xref_id=?');
my $syn_sth = $dbi->prepare('INSERT IGNORE INTO synonym VALUES(?,?)');
my $syn_sth = $dbi->prepare('INSERT IGNORE INTO synonym ( xref_id, synonym ) VALUES(?,?)');
my $xref_update_label_sth = $dbi->prepare('UPDATE xref SET label=? WHERE xref_id=?');
my $xref_update_descr_sth = $dbi->prepare('UPDATE xref SET description=? WHERE xref_id=?');
my $pair_sth = $dbi->prepare('INSERT INTO pairs VALUES(?,?,?)');
......@@ -1245,7 +1245,7 @@ sub add_to_syn_for_mult_sources{
my ($self, $acc, $sources, $syn, $species_id, $dbi) = @_;
$dbi = $self->dbi unless defined $dbi;
my $add_synonym_sth = $dbi->prepare('INSERT IGNORE INTO synonym VALUES(?,?)');
my $add_synonym_sth = $dbi->prepare('INSERT IGNORE INTO synonym ( xref_id, synonym ) VALUES(?,?)');
foreach my $source_id (@{$sources}){
my $xref_id = $self->get_xref($acc, $source_id, $species_id, $dbi);
......@@ -1266,7 +1266,7 @@ sub add_to_syn{
my ($self, $acc, $source_id, $syn, $species_id, $dbi) = @_;
$dbi = $self->dbi unless defined $dbi;
my $add_synonym_sth = $dbi->prepare('INSERT IGNORE INTO synonym VALUES(?,?)');
my $add_synonym_sth = $dbi->prepare('INSERT IGNORE INTO synonym ( xref_id, synonym ) VALUES(?,?)');
my $xref_id = $self->get_xref($acc, $source_id, $species_id, $dbi);
if(defined $xref_id){
$add_synonym_sth->execute( $xref_id, $syn )
......@@ -1288,7 +1288,7 @@ sub add_synonym{
my ($self, $xref_id, $syn, $dbi) = @_;
$dbi = $self->dbi unless defined $dbi;
my $add_synonym_sth = $dbi->prepare_cached('INSERT IGNORE INTO synonym VALUES(?,?)');
my $add_synonym_sth = $dbi->prepare_cached('INSERT IGNORE INTO synonym ( xref_id, synonym ) VALUES(?,?)');
$add_synonym_sth->execute( $xref_id, $syn )
or croak( $dbi->errstr()."\n $xref_id\n $syn\n\n" );
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment