Commit 61c793c2 authored by zYne's avatar zYne

Refactored export drivers

parent c1c66b6b
This diff is collapsed.
...@@ -41,10 +41,9 @@ class Doctrine_Export_Oracle extends Doctrine_Export { ...@@ -41,10 +41,9 @@ class Doctrine_Export_Oracle extends Doctrine_Export {
* @access public * @access public
*/ */
public function createDatabase($name) { public function createDatabase($name) {
if (!$db->options['emulate_database']) { if (!$db->options['emulate_database'])
return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, throw new Doctrine_Export_Oracle_Exception('database creation is only supported if the "emulate_database" option is enabled');
'database creation is only supported if the "emulate_database" option is enabled', __FUNCTION__);
}
$username = $db->options['database_name_prefix'].$name; $username = $db->options['database_name_prefix'].$name;
$password = $db->dsn['password'] ? $db->dsn['password'] : $name; $password = $db->dsn['password'] ? $db->dsn['password'] : $name;
...@@ -53,9 +52,7 @@ class Doctrine_Export_Oracle extends Doctrine_Export { ...@@ -53,9 +52,7 @@ class Doctrine_Export_Oracle extends Doctrine_Export {
$query = 'CREATE USER '.$username.' IDENTIFIED BY '.$password.$tablespace; $query = 'CREATE USER '.$username.' IDENTIFIED BY '.$password.$tablespace;
$result = $db->standaloneQuery($query, null, true); $result = $db->standaloneQuery($query, null, true);
if (PEAR::isError($result)) {
return $result;
}
$query = 'GRANT CREATE SESSION, CREATE TABLE, UNLIMITED TABLESPACE, CREATE SEQUENCE, CREATE TRIGGER TO '.$username; $query = 'GRANT CREATE SESSION, CREATE TABLE, UNLIMITED TABLESPACE, CREATE SEQUENCE, CREATE TRIGGER TO '.$username;
$result = $db->standaloneQuery($query, null, true); $result = $db->standaloneQuery($query, null, true);
if (PEAR::isError($result)) { if (PEAR::isError($result)) {
...@@ -77,10 +74,10 @@ class Doctrine_Export_Oracle extends Doctrine_Export { ...@@ -77,10 +74,10 @@ class Doctrine_Export_Oracle extends Doctrine_Export {
* @access public * @access public
*/ */
public function dropDatabase($name) { public function dropDatabase($name) {
if (!$db->options['emulate_database']) { if (!$db->options['emulate_database'])
return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, throw new Doctrine_Export_Oracle_Exception('database dropping is only supported if the
'database dropping is only supported if the "emulate_database" option is enabled', __FUNCTION__); "emulate_database" option is enabled');
}
$username = $db->options['database_name_prefix'].$name; $username = $db->options['database_name_prefix'].$name;
return $db->standaloneQuery('DROP USER '.$username.' CASCADE', null, true); return $db->standaloneQuery('DROP USER '.$username.' CASCADE', null, true);
...@@ -339,9 +336,7 @@ END; ...@@ -339,9 +336,7 @@ END;
* @param boolean $check indicates whether the function should just check if the DBMS driver * @param boolean $check indicates whether the function should just check if the DBMS driver
* can perform the requested table alterations if the value is true or * can perform the requested table alterations if the value is true or
* actually perform them otherwise. * actually perform them otherwise.
* @access public * @return void
*
* @return mixed MDB2_OK on success, a MDB2 error on failure
*/ */
public function alterTable($name, $changes, $check) { public function alterTable($name, $changes, $check) {
...@@ -423,7 +418,7 @@ END; ...@@ -423,7 +418,7 @@ END;
* @param object $db database object that is extended by this class * @param object $db database object that is extended by this class
* @param string $seq_name name of the sequence to be created * @param string $seq_name name of the sequence to be created
* @param string $start start value of the sequence; default is 1 * @param string $start start value of the sequence; default is 1
* @return mixed MDB2_OK on success, a MDB2 error on failure * @return void
*/ */
public function createSequence($seq_name, $start = 1) { public function createSequence($seq_name, $start = 1) {
$sequence_name = $db->quoteIdentifier($db->getSequenceName($seq_name), true); $sequence_name = $db->quoteIdentifier($db->getSequenceName($seq_name), true);
...@@ -436,7 +431,7 @@ END; ...@@ -436,7 +431,7 @@ END;
* *
* @param object $db database object that is extended by this class * @param object $db database object that is extended by this class
* @param string $seq_name name of the sequence to be dropped * @param string $seq_name name of the sequence to be dropped
* @return mixed MDB2_OK on success, a MDB2 error on failure * @return void
*/ */
public function dropSequence($seq_name) { public function dropSequence($seq_name) {
$sequence_name = $db->quoteIdentifier($db->getSequenceName($seq_name), true); $sequence_name = $db->quoteIdentifier($db->getSequenceName($seq_name), true);
......
...@@ -143,7 +143,7 @@ class Doctrine_Export_Pgsql extends Doctrine_Export { ...@@ -143,7 +143,7 @@ class Doctrine_Export_Pgsql extends Doctrine_Export {
* @throws PDOException * @throws PDOException
* @return boolean * @return boolean
*/ */
function alterTable($name, $changes, $check) { public function alterTable($name, $changes, $check) {
foreach ($changes as $change_name => $change) { foreach ($changes as $change_name => $change) {
switch ($change_name) { switch ($change_name) {
case 'add': case 'add':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment