public function getTableInfo($table)
 {
     if (isset($this->tables[$table])) {
         return $this->tables[$table];
     }
     $columnMeta = $this->getColumnMetas($table);
     $sql = sprintf(self::TABLE_INFO_SQL, $table);
     $stmt = $this->pdo->prepare($sql);
     $stmt->execute();
     $stmt->setFetchMode(PDO::FETCH_ASSOC);
     $info = new HermitTableInfo();
     while ($row = $stmt->fetch()) {
         $columnName = $row['name'];
         $meta = $columnMeta[$columnName];
         $info->addColumn($columnName);
         $info->putType($columnName, $meta['pdo_type']);
         if (1 === (int) $row['pk']) {
             $info->addPrimaryKey($columnName);
         }
     }
     unset($stmt);
     return $this->tables[$table] = $info;
 }
 public function getTableInfo($table)
 {
     if (isset($this->tables[$table])) {
         return $this->tables[$table];
     }
     $sql = sprintf(self::TABLE_INFO_SQL, $table);
     $stmt = $this->pdo->prepare($sql);
     $stmt->execute();
     $count = $stmt->columnCount();
     $info = new HermitTableInfo();
     for ($i = 0; $i < $count; ++$i) {
         $meta = $stmt->getColumnMeta($i);
         $columnName = $meta['name'];
         $columnType = $meta['pdo_type'];
         $info->addColumn($columnName);
         $info->putType($columnName, $columnType);
         if (in_array('primary_key', $meta['flags'])) {
             $info->addPrimaryKey($columnName);
         }
     }
     $stmt->closeCursor();
     unset($stmt);
     return $this->tables[$table] = $info;
 }