Implemented the DatabaseDrop command

This commit is contained in:
Kévin Gomez 2013-11-04 21:41:59 +00:00
commit a5cd6b86b6
2 changed files with 131 additions and 0 deletions

View file

@ -394,4 +394,22 @@ EOT;
return implode(PHP_EOL, $lines);
}
/**
* Extract the database name from a given DSN
*
* @param string $dsn A DSN
* @return string The database name extracted from the given DSN
*/
protected function parseDbName($dsn)
{
preg_match('#dbname=([a-zA-Z0-9\_]+)#', $dsn, $matches);
if (isset($matches[1])) {
return $matches[1];
}
// e.g. SQLite
return null;
}
}