<html><link rel="SHORTCUT ICON" href="favicon.ico">
<body background='textblue.jpg'>
<head><title> Atenae - Catalog Explorer for DB2</title></head><head><title> Atenae - Catalog Explorer for DB2</title></head>

<div align="left"><img src="atp.gif" width="120" height="120" onclick=window.open('ajdb.html','ajuda','width=300,height=200,scrollbars=yes')></div><div align="center"><a href='index.html'> Principal  </a>
&nbsp&nbsp
<a href='lista_db.php'> DBs  </a>
&nbsp&nbsp
<a href='stmtr3.php?sql=&q=0&dbasef=&dban=&tban=&tabela=&criador=&cran='> Query  </a></div>
&nbsp&nbsp
</div>


<?php

$dbconn = odbc_connect('DB2P', 'XMG', 'ETLGIT', SQL_CUR_USE_ODBC) ;

if ($dbconn != 0) {

   $stmt = "SELECT a.DBNAME, a.QTDT, b.QTDV
            from (select dbname, count(*) QTDT from sysibm.systables where type='T' group by dbname) a
            left join (select dbname, count(*) QTDV from sysibm.systables where type='V' group by dbname) b
            on a.dbname=b.dbname ";

   $result = odbc_exec($dbconn, $stmt) ;

   if ($result == 0) {
      $sqlerror = odbc_errormsg($dbconn);
      echo $sqlerror ; }

   else {

      echo "<table width='40%' border='0' align='center'>
           <caption>
           <H1>Databases</H1><BR>
           </caption>
           <tr> <th onclick=alert('nome_do_database') bgcolor='#FFFF9F' align='center' scope='col'> Database </th>
                <th onclick=alert('quantidade_de_tabelas_no_database') bgcolor='#FFFF9F' align='center' scope='col'> qtd. tabelas </th>
                <th onclick=alert('quantidade_de_views_no_database') bgcolor='#FFFF9F' align='center' scope='col'> qtd. views </th>
                <th onclick=alert('nmero_de_sequncia_na_pgina') bgcolor='#FFFF9F' align='center' scope='col'> seq </th>
           </tr>" ;

      $n=1;

      while ($row = odbc_fetch_array($result)) {
        echo "<tr onmouseover=style.backgroundColor='#e7e7e7' onmouseout=style.backgroundColor=''>
              <th align='left' scope='col'><a href='alerta.php?db=$row[DBNAME]&dias=7&qix=3'> $row[DBNAME] </th>
              <th align='center' scope='col'><a href='lista_tb_22.php?db=$row[DBNAME]&tp=T&or=2,3 asc '> $row[QTDT] </a></th>
              <th align='center' scope='col'><a href='lista_vi_21.php?db=$row[DBNAME]&tp=V&or=1,2 asc '> $row[QTDV] </a></th>
              <th bgcolor='#FFFF9F' align='center' scope='col'> $n </th>
              </tr>";
        $n++;
      }

     echo "</table> </body> </html>" ;

   }
}

odbc_close($dbconn);

?>

