Example #1
0
 /**
  * Get a list of tables that the current user can read.
  * @return string[] The table names.
  */
 public function getTableNames($checkGrants = true)
 {
     if (!$this->tableNames) {
         $this->tableNames = $this->query('SHOW TABLES')->fetchAll();
     }
     $out = [];
     foreach ($this->tableNames as $row) {
         $tableName = $row->{'Tables_in_' . Config::databaseName()};
         if (!$checkGrants || $this->checkGrant(Grants::READ, $tableName)) {
             $out[] = $tableName;
         }
     }
     return $out;
 }