LazyRecord\TableStatus\MySQLTableStatus::querySummary PHP Метод

querySummary() публичный Метод

public querySummary ( array $tables )
$tables array
    public function querySummary(array $tables)
    {
        $dbName = $this->connection->query('SELECT database();')->fetchColumn();
        $query = $this->createStatusSummaryQuery();
        $query->where()->equal('table_schema', $dbName);
        if (count($tables)) {
            $query->where()->in('table_name', $tables);
        }
        $args = new ArgumentArray();
        $sql = $query->toSql($this->driver, $args);
        $stm = $this->connection->prepare($sql);
        $stm->execute($args->toArray());
        return $rows = $stm->fetchAll(PDO::FETCH_ASSOC);
    }

Usage Example

Пример #1
0
 public function execute()
 {
     $tables = func_get_args();
     $configLoader = $this->getConfigLoader(true);
     $dataSource = $this->getCurrentDataSourceId();
     $conn = $this->getCurrentConnection();
     $driver = $this->getCurrentQueryDriver();
     if ($driver instanceof PDOMySQLDriver) {
         $status = new MySQLTableStatus($conn, $driver);
         $this->logger->info('Table Status:');
         $rows = $status->queryDetails($tables);
         $this->displayRows($rows);
         $this->logger->newline();
         $this->logger->info('Table Status Summary:');
         $rows = $status->querySummary($tables);
         $this->displayRows($rows);
     } else {
         $this->logger->error('Driver not supported.');
     }
 }