/**
  * Get a list of all Token Ranges tables that could be used by this script.
  * In most cases this will only return 1 table but if the script is using
  * sharded tables then this will return all of them.
  *
  * @return string[]
  */
 public function listAllRangeTables()
 {
     $tables = [];
     $db = TokenRange::conn();
     $tableName = TokenRange::tableName();
     if (strpos($tableName, '_') !== false) {
         $parts = explode("_", $tableName);
         $last = array_pop($parts);
         if (is_numeric($last)) {
             $tableBase = implode("_", $parts) . '_';
             $i = 1;
             while (true) {
                 $table = $tableBase . $i;
                 $res = $db->numRows("SHOW TABLES LIKE '" . $table . "'");
                 if ($res > 0) {
                     $tables[] = $table;
                 } else {
                     break;
                 }
                 $i++;
             }
         }
     }
     if (count($tables) == 0) {
         $tables = [$tableName];
     }
     return $tables;
 }