[Lsb-messages] /var/www/bzr/lsb/devel/libtodb2 r30: Minor headertodb2 improvements

Denis Silakov denis.silakov at rosalab.ru
Tue May 1 13:08:38 UTC 2012


------------------------------------------------------------
revno: 30
committer: Denis Silakov <denis.silakov at rosalab.ru>
branch nick: libtodb2
timestamp: Tue 2012-05-01 17:08:38 +0400
message:
  Minor headertodb2 improvements
modified:
  headertodb2/prepare_sql.pl
  set_appearedin.pl
-------------- next part --------------
=== modified file 'headertodb2/prepare_sql.pl'
--- a/headertodb2/prepare_sql.pl	2012-03-21 09:22:26 +0000
+++ b/headertodb2/prepare_sql.pl	2012-05-01 13:08:38 +0000
@@ -414,9 +414,16 @@
     $old_Tname = $Tname;
     $old_Ttype = $Ttype;
 
-    $xh = $dbh->prepare("SELECT DISTINCT ATbasetype FROM Type JOIN ArchType ON ATtid=Tid WHERE Tname='$Tname' AND Ttype='$Ttype' AND ATbasetype>0")
+    $xh = $dbh->prepare("SELECT DISTINCT ATbasetype FROM Type JOIN ArchType ON ATtid=Tid WHERE Tname='$Tname' AND Ttype='$Ttype' AND ATbasetype>0 AND ATappearedin > '' AND ATwithdrawnin IS NULL")
         or die "Couldn't prepare type ($Tname, $Ttype) selection query: ".DBI->errstr;
     $xh->execute or die "Couldn't execute basetype ($Tname, $Ttype) query: ".DBI->errstr;
+
+    if( !$xh->rows ) {
+        $xh = $dbh->prepare("SELECT DISTINCT ATbasetype FROM Type JOIN ArchType ON ATtid=Tid WHERE Tname='$Tname' AND Ttype='$Ttype' AND ATbasetype>0")
+            or die "Couldn't prepare type ($Tname, $Ttype) selection query: ".DBI->errstr;
+        $xh->execute or die "Couldn't execute basetype ($Tname, $Ttype) query: ".DBI->errstr;
+    }
+
     if( $xh->rows > 1 ) {
         warn "Got more than one basetype for $Ttype '$Tname'";
     }
@@ -508,10 +515,13 @@
         }
     }
 
-    my ($Ptype) = $dbh->selectrow_array("SELECT Ptype FROM Interface JOIN Parameter ON Pint=Iid WHERE Iname='$Iname' AND Ilibrary='$library' AND Ppos=$Ppos");
-    if( $Ptype ) {
-        # parameter is already in place
-        next;
+    my ($Ppos_min) = $dbh->selectrow_array("SELECT MIN(Ppos) FROM Interface JOIN Parameter ON Pint=Iid WHERE Iname='$Iname' AND Ilibrary='$library'");
+    if( $Ppos_min ) {
+        my ($Ptype) = $dbh->selectrow_array("SELECT Ptype FROM Interface JOIN Parameter ON Pint=Iid WHERE Iname='$Iname' AND Ilibrary='$library' AND Ppos=".($Ppos+$Ppos_min));
+        if( $Ptype ) {
+            # parameter is already in place
+            next;
+        }
     }
 
     if( $dup_types{$Tname} ) {

=== modified file 'set_appearedin.pl'
--- a/set_appearedin.pl	2012-03-21 09:22:26 +0000
+++ b/set_appearedin.pl	2012-05-01 13:08:38 +0000
@@ -74,7 +74,7 @@
    	or die "Couldn't set ATappearedin: " . DBI->errstr;
 my $markIncludedMembersQuery = $dbh->prepare(
 "UPDATE TypeMember SET TMappearedin='$lsb_version' where TMmemberof = ? ")
-   	or die "Couldn't set ATappearedin: " . DBI->errstr;
+   	or die "Couldn't set TMappearedin: " . DBI->errstr;
 
 if( $mark_all ) {
     # Mark all interfaces as included
@@ -166,10 +166,11 @@
 
 $dbh->do( "update ArchType set ATappearedin='' where ATtid in (select Tid from tmp_typedefs)");
 
-my $str = "update ArchConst set ACappearedin = '$lsb_version' where ACcid in (select Cid from Constant where Cheadgroup in (select HGid from HeaderGroup where HGheader in (select Hid from Header where Hlib = (select Lid from Library where Lname = '$LibName'))));\n";
-print $str;
-$dbh->do( $str );
-
+if( $mark_all ) {
+    my $str = "update ArchConst set ACappearedin = '$lsb_version' where ACcid in (select Cid from Constant where Cheadgroup in (select HGid from HeaderGroup where HGheader in (select Hid from Header where Hlib = (select Lid from Library where Lname = '$LibName'))));\n";
+    print $str;
+    $dbh->do( $str );
+}
 
 #######################################################
 # Main routine - processes types recursevly



More information about the lsb-messages mailing list