[Lsb-messages] /var/www/bzr/lsb/devel/dbadmin r300: Display class vtables in community data

Denis Silakov denis.silakov at rosalab.ru
Thu Jul 10 11:36:45 UTC 2014


------------------------------------------------------------
revno: 300
committer: Denis Silakov <denis.silakov at rosalab.ru>
branch nick: dbadmin
timestamp: Thu 2014-07-10 15:36:45 +0400
message:
  Display class vtables in community data
modified:
  browse/class_single.php
  browse/rawclass.php
  commons/about.php
  commons/query.inc
  distrosearch.inc
  rawclass.inc
-------------- next part --------------
=== modified file 'browse/class_single.php'
--- a/browse/class_single.php	2012-09-10 17:07:47 +0000
+++ b/browse/class_single.php	2014-07-10 11:36:45 +0000
@@ -9,12 +9,15 @@
 $admin_file = 'browse/'.$browse_file;
 $admin_param = 'mode=admin';
 
-$lsb_change_link="../browse/class_single.php";
-
 include("../cookie.inc");
 include("db.inc");
 include("../commons.inc");
 
+$lsb_change_link="../browse/class_single.php";
+if( $_REQUEST['cmd'] ) {
+    $lsb_change_link.= form_lsb_change_link();
+}
+
 $archfilter = 'None';
 $lsbversion = 'None';
 

=== modified file 'browse/rawclass.php'
--- a/browse/rawclass.php	2012-05-16 23:46:37 +0000
+++ b/browse/rawclass.php	2014-07-10 11:36:45 +0000
@@ -60,6 +60,10 @@
         check_request_numeric_params("RCid");
         display_rawclass_byid($_REQUEST['RCid']);
         break;
+    case "display-vtables" :
+        check_request_numeric_params("RCid", "RLid");
+        display_rawclass_vtables($_REQUEST['RCid'], $_REQUEST['RLid']);
+        break;
     case "list-bydistr" :
         check_request_numeric_params("Did");
         check_offset();

=== modified file 'commons/about.php'
--- a/commons/about.php	2012-09-11 06:28:58 +0000
+++ b/commons/about.php	2014-07-10 11:36:45 +0000
@@ -14,7 +14,7 @@
 
 <div style="width: 640px;">
 <h1>LSB Database Navigator</h1>
-<p><strong>Version 1.9.9</strong></p>
+<p><strong>Version 1.10</strong></p>
 Copyright &copy; 2007<script language="JavaScript" type="text/javascript">
           var d=new Date();
           yr=d.getFullYear();

=== modified file 'commons/query.inc'
--- a/commons/query.inc	2012-09-10 17:07:47 +0000
+++ b/commons/query.inc	2014-07-10 11:36:45 +0000
@@ -70,7 +70,7 @@
 function Query_value($query)
 {
     if( $row = Query_row($query) ) {
-        return $row[0];
+        return current($row);
     }
     else {
         return 0;

=== modified file 'distrosearch.inc'
--- a/distrosearch.inc	2013-08-14 15:24:27 +0000
+++ b/distrosearch.inc	2014-07-10 11:36:45 +0000
@@ -74,7 +74,13 @@
         print("checked='checked' ");
     }
 
-    print("onchange=\"location = '".$lsb_change_link."&amp;changeunofficial");
+    if( strstr($lsb_change_link, '?' ) ) {
+        print("onchange=\"location = '".$lsb_change_link."&amp;changeunofficial");
+    }
+    else {
+        print("onchange=\"location = '".$lsb_change_link."?changeunofficial");
+    }
+
     if( $unofficial_distrs_filter == "0" ) {
         print("=1'\"/>\n") ;
     }
@@ -185,9 +191,9 @@
                 $selectLibArchs = "SELECT DISTINCT Carch FROM $tableName";
                 $resLibArchs = Query($selectLibArchs);
                 foreach( $resLibArchs as $rowLibArchs ) {
-            	    if($bit_32 and $bit_64) {
-            		break;
-            	    }
+                    if($bit_32 and $bit_64) {
+                        break;
+                    }
                     switch ($rowLibArchs[0]) {
                         case 2:
                         case 6:
@@ -255,7 +261,8 @@
             display_rawlib_heading(false,false,true,true);
         }
         else if( $el_name == "class" ) {
-            display_rawclass_heading(false,false,false);
+            /* $needFilters=false, $grouped=false, $showname=false, $showvtables=true */
+            display_rawclass_heading(false,false,false,true);
         }
         else if( $el_name == "module" ) {
             display_rilm_distrinfo_heading();
@@ -280,7 +287,7 @@
                                 WHERE RIrcid=".$row['RCid']."
                                 AND RLRIrlid=".$row['RLid'];
                 $int_cnt=Query_value($selectNum);
-                display_rawclass_entry($row, $int_cnt, false);
+                display_rawclass_entry($row, $int_cnt, false, true);
             }
             else if( $el_name == "module" ) {
                 display_rilm_distrinfo_entry($row);

=== modified file 'rawclass.inc'
--- a/rawclass.inc	2012-09-10 17:07:47 +0000
+++ b/rawclass.inc	2014-07-10 11:36:45 +0000
@@ -24,7 +24,7 @@
     print_table_header( 'Name', 'Interfaces' );
 }
 
-function display_rawclass_heading($needFilters=false, $grouped=false, $showname=true)
+function display_rawclass_heading($needFilters=false, $grouped=false, $showname=true, $showvtables=false)
 {
     global $DistrNames,$Architecture,$ComponentNames,$change_link,$curDistr,$curComponent;
 
@@ -64,6 +64,9 @@
     if( !$showname ) {
         print("<th>Comment</th>\n");
     }
+    if( $showvtables ) {
+        print("<th>Virtual Tables</th>\n");
+    }
     print("</tr>\n");
 }
 
@@ -158,7 +161,7 @@
     print("</tr>\n");
 }
 
-function display_rawclass_entry($rawclass,$classNum,$showname=true)
+function display_rawclass_entry($rawclass, $classNum, $showname=true, $showvtables=false)
 {
     global $Architecture;
 
@@ -188,7 +191,7 @@
     // If we are not going to display class name, then we are actually displaying detailed statistics for one class;
     // let's be smarter in this case - compare lib arch with distro arch and display other comments, if any.
     if( !$showname ) {
-        print "<td>";
+        print("<td>");
         if( $rawclass['RLLlinkname'] and $rawclass['RLLlibname'] != $rawclass['RLname'] ) {
             print "Provided by ".$rawclass['RLLpath']."/".$rawclass['RLLlinkname']." which is a symlink to ".$rawclass['RLpath']."/".$rawclass['RLrunname'];
         }
@@ -197,7 +200,19 @@
         if( $rawclass['Darch'] != $rawclass['Darch'] and $rawclass['Darch'] ) {
             print "Library architecture (".$Architecture[$rawclass['Darch']].") differs from the distribution's one (".$Architecture[$rawclass['Darch']].").";
         }
-        print "</td>\n";
+        print("</td>\n");
+    }
+
+    if($showvtables) {
+        print("<td>");
+        $vtable_data_present = Query_value("SELECT 1 FROM RawVtable WHERE RVrcid=".$rawclass['RCid']." AND RVrlid=".$rawclass['RLid']." LIMIT 1");
+        if($vtable_data_present) {
+            print("<a href='rawclass.php?cmd=display-vtables&amp;RCid=".$rawclass['RCid']."&amp;RLid=".$rawclass['RLid']."'>Display...</a>");
+        }
+        else {
+            print("<font color='grey'>No data</font>");
+        }
+        print("</td>");
     }
 
     print("</tr>\n");
@@ -591,6 +606,74 @@
     display_rawclass_list_detailed("WHERE RawClass.RCid=$RCid ",false);
 }
 
+function display_rawclass_vtables($RCid, $RLid)
+{
+    global $Architecture;
+
+    print("<h1>Distribution Classes</h1>\n");
+
+    $ClassName = Query_value("SELECT RCname FROM RawClass WHERE RCid=$RCid");
+    if( !$ClassName) {
+        print("<em>Illegal raw class id</em><br/>");
+        return;
+    }
+
+    $select = "SELECT RLname,Cname,Darch,Dname,Dversion,RLversion,RLid,Cversion,Cid,Did FROM RawLibrary
+                LEFT JOIN Component on RLcomponent=Cid
+                LEFT JOIN Distribution on Cdistr=Did
+                WHERE RLid=$RLid ";
+    $res=Query($select);
+    if( count($res) ) {
+        $row=current($res);
+        print("<h2>Virtual Tables of '$ClassName' Class from '<a href=\"rawlib.php?cmd=list-byid&amp;RLid=".$row['RLid']."\">".$row['RLname']);
+        print("</a>' Library");
+        if($row['Cname']) {
+            print(" in '<a href=\"component.php?cmd=list-byid&amp;Cid=".$row['Cid']."\">".$row['Cname']."-".$row['Cversion']."</a>' Component");
+        }
+        if($row['Dname']) {
+            print(" in '<a href=\"distr.php?cmd=list-byid&amp;Did=".$row['Did']."\">".$row['Dname']." ".$row['Dversion']."</a>' Distribution");
+        }
+        if($row['Darch']) {
+            print(" on ".$Architecture[$row['Darch']]." Architecture");
+        }
+        print "</h2>\n";
+    }
+    else {
+        print("<em>Illegal raw library id</em><br/>");
+        return;
+    }
+
+    $select = "SELECT RawVtable.*, RIid, RIname, RIunmangled FROM RawVtable
+                LEFT JOIN RawInterface ON RIid=RVriid
+                WHERE RVrcid=$RCid
+                AND RVrlid=$RLid
+                ORDER BY RVvtpos, RVpos";
+    $res = Query($select);
+    $row = current($res);
+    $vtnum = -1;
+
+    if($row) {
+        print("<table class='wikitable'><tr><th>Position</th><th>Interface</th><th>Umnangled Entry Name</th></tr>");
+    }
+    else {
+        print("The database contains no data about virtual tables of this class.");
+        return;
+    }
+
+    while($row) {
+        if( $vtnum != $row['RVvtpos'] ) {
+            $vtnum = $row['RVvtpos'];
+            print("<tr><th colspan='3'>Vtable #$vtnum</th></tr>");
+        }
+
+        $int = $row['RIname'] ? "<a href='int_single.php?cmd=display&amp;id=".$row['RIid']."'>".$row['RIname']."</a>" : "NULL";
+        $unmangled = $row['RIunmangled'] ? htmlspecialchars($row['RIunmangled']) : "";
+        print("<tr><td>".$row['RVpos']."</td><td>".$int."</td><td>$unmangled</td></tr>");
+
+        $row = next($res);
+    }
+}
+
 function display_rawclass_byletter($prefix,$offset)
 {
     $pattern = escape_search_name($prefix);



More information about the lsb-messages mailing list