[Lsb-messages] /var/www/bzr/lsb/devel/libtodb2 r38: Handle interfaces with same name, different lib better on add.

Jeff Licquia licquia at linuxfoundation.org
Fri Oct 4 18:07:51 UTC 2013


------------------------------------------------------------
revno: 38
committer: Jeff Licquia <licquia at linuxfoundation.org>
branch nick: libtodb2
timestamp: Fri 2013-10-04 14:07:51 -0400
message:
  Handle interfaces with same name, different lib better on add.
  
  prepare_sql.pl was querying for header info twice, but neglected to
  include the library info the second time.  So, if there was a new
  interface with a same-name interface in another library, it would
  generate incorrect SQL.  So, instead, only ask for the info once
  with the proper query and reuse it.
modified:
  headertodb2/prepare_sql.pl
-------------- next part --------------
=== modified file 'headertodb2/prepare_sql.pl'
--- a/headertodb2/prepare_sql.pl	2012-08-23 03:59:53 +0000
+++ b/headertodb2/prepare_sql.pl	2013-10-04 18:07:51 +0000
@@ -161,9 +161,9 @@
     $present = 0;
 
     my ($Hid) = $dbh->selectrow_array("select Hid from Header where Hname='$Iheader'");
+    my ($Iid,$cur_header) = $dbh->selectrow_array("SELECT Iid,Iheader FROM Interface WHERE Iname='$Iname' AND Ilibrary='$library'");
 
     if( $Lid ) {
-        my ($Iid,$cur_header) = $dbh->selectrow_array("SELECT Iid,Iheader FROM Interface WHERE Iname='$Iname' AND Ilibrary='$library'");
         if($Iid) {
             if( $cur_header and $Hid and $cur_header != $Hid ) {
                 warn "Interface '$Iname' is already assigned to another header";
@@ -190,7 +190,6 @@
     }
 
     if( !$present ) {
-        my ($Iid,$cur_header) = $dbh->selectrow_array("SELECT Iid,Iheader FROM Interface WHERE Iname='$Iname'");
         if($Iid) {
             print "SET \@Iid=(SELECT Iid FROM Interface WHERE Iname='$Iname' AND Iheader=$Hid AND Ilibrary='$library');\n";
             $present = 1;



More information about the lsb-messages mailing list