<?php
$dbi = new DbMysql;
$dbi->dbh = 'mysql://root:mysql@127.0.0.1/coffeetest';

$map = array();
$dbi->fetchMap("SHOW TABLES", $map);
$tables = array_keys($map);
for($i=0; $i<count($tables); $i++){
    echo($tables[$i]."\n");
    $sql = "SHOW INDEX FROM ".$tables[$i];
    $list = $dbi->fetchAll($sql);
    $indexs = array();
    foreach($list as $item){
        $indexs[$item['Key_name']][] = $item['Column_name'];
    }
    foreach($indexs as $key=>$val){
        echo("\t".$key."\t".implode(",",$val)."\n");
    }
}
?>

 

相关文章:

  • 2021-12-26
  • 2021-11-06
  • 2021-08-23
  • 2021-05-28
  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-01
  • 2022-03-10
  • 2021-09-01
  • 2021-07-29
  • 2022-12-23
  • 2021-07-25
  • 2021-11-30
相关资源
相似解决方案