Added a method to get the dbname in Command classes

This commit is contained in:
William DURAND 2011-06-22 13:48:43 +02:00
parent 2c6c884861
commit c7f5ed7e2b

View file

@ -292,6 +292,16 @@ EOT;
return array($name, $defaultConfig);
}
/**
* 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);
return $matches[1];
}
/**
* Write Propel output as summary.
*