diff --git a/lib/Doctrine/Export/Firebird.php b/lib/Doctrine/Export/Firebird.php index 5e01aea9a..0eff4a6df 100644 --- a/lib/Doctrine/Export/Firebird.php +++ b/lib/Doctrine/Export/Firebird.php @@ -403,7 +403,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export * ) * @return void */ - public function createIndex($table, $name, array $definition) + public function createIndexSql($table, $name, array $definition) { $query = 'CREATE'; @@ -429,9 +429,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export } $query .= ' ('.implode(', ', $fields) . ')'; - $result = $this->conn->exec($query); - // todo: $this->_silentCommit(); - return $result; + return $query; } /** * create a constraint on a table diff --git a/lib/Doctrine/Export/Frontbase.php b/lib/Doctrine/Export/Frontbase.php index 343e0ace7..568aa5071 100644 --- a/lib/Doctrine/Export/Frontbase.php +++ b/lib/Doctrine/Export/Frontbase.php @@ -37,39 +37,35 @@ class Doctrine_Export_Frontbase extends Doctrine_Export * create a new database * * @param string $name name of the database that should be created - * @return boolean + * @return string */ - public function createDatabase($name) + public function createDatabaseSql($name) { $name = $this->conn->quoteIdentifier($name, true); - $query = 'CREATE DATABASE ' . $name; - - return $this->conn->exec($query); + return 'CREATE DATABASE ' . $name; } /** * drop an existing database * * @param string $name name of the database that should be dropped - * @return boolean + * @return string */ - public function dropDatabase($name) + public function dropDatabaseSql($name) { $name = $this->conn->quoteIdentifier($name, true); - $query = 'DELETE DATABASE ' . $name; - - return $this->conn->exec($query); + return 'DELETE DATABASE ' . $name; } /** * drop an existing table * * @param object $this->conns database object that is extended by this class * @param string $name name of the table that should be dropped - * @return integer + * @return string */ - public function dropTable($name) + public function dropTableSql($name) { $name = $this->conn->quoteIdentifier($name, true); - return $this->conn->exec('DROP TABLE ' . $name . ' CASCADE'); + return 'DROP TABLE ' . $name . ' CASCADE'; } /** * alter an existing table @@ -289,13 +285,13 @@ class Doctrine_Export_Frontbase extends Doctrine_Export * drop existing sequence * * @param string $seqName name of the sequence to be dropped - * @return boolean + * @return string */ - public function dropSequence($seqName) + public function dropSequenceSql($seqName) { $sequenceName = $this->conn->quoteIdentifier($this->conn->getSequenceName($seqName), true); - return $this->conn->exec('DROP TABLE ' . $sequenceName . ' CASCADE'); + return 'DROP TABLE ' . $sequenceName . ' CASCADE'; } /** * drop existing index @@ -304,11 +300,11 @@ class Doctrine_Export_Frontbase extends Doctrine_Export * @param string $name name of the index to be dropped * @return boolean */ - public function dropIndex($table, $name) + public function dropIndexSql($table, $name) { $table = $this->conn->quoteIdentifier($table, true); $name = $this->conn->quoteIdentifier($this->conn->getIndexName($name), true); - return $this->conn->exec('ALTER TABLE ' . $table . ' DROP INDEX ' . $name); + return 'ALTER TABLE ' . $table . ' DROP INDEX ' . $name; } } diff --git a/lib/Doctrine/Export/Mssql.php b/lib/Doctrine/Export/Mssql.php index 68ba5b796..40ef6a9ec 100644 --- a/lib/Doctrine/Export/Mssql.php +++ b/lib/Doctrine/Export/Mssql.php @@ -72,8 +72,7 @@ class Doctrine_Export_Mssql extends Doctrine_Export public function getTemporaryTableQuery() { return ''; - } - + } /** * alter an existing table * diff --git a/lib/Doctrine/Export/Mysql.php b/lib/Doctrine/Export/Mysql.php index 3bdb04a2d..5349cf1d0 100644 --- a/lib/Doctrine/Export/Mysql.php +++ b/lib/Doctrine/Export/Mysql.php @@ -95,11 +95,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export { $sql = $this->createTableSql($name, $fields, $options); - $this->conn->exec('SET FOREIGN_KEY_CHECKS = 0'); - $this->conn->execute($sql); - - $this->conn->exec('SET FOREIGN_KEY_CHECKS = 1'); } /** * create a new table @@ -615,10 +611,10 @@ class Doctrine_Export_Mysql extends Doctrine_Export if (!empty($definition['match'])) { $query .= ' MATCH ' . $definition['match']; } - if (!empty($definition['on_update'])) { + if (!empty($definition['onUpdate'])) { $query .= ' ON UPDATE ' . $this->getForeignKeyRefentialAction($definition['onUpdate']); } - if (!empty($definition['on_delete'])) { + if (!empty($definition['onDelete'])) { $query .= ' ON DELETE ' . $this->getForeignKeyRefentialAction($definition['onDelete']); } return $query; @@ -630,11 +626,11 @@ class Doctrine_Export_Mysql extends Doctrine_Export * @param string $name name of the index to be dropped * @return void */ - public function dropIndex($table, $name) + public function dropIndexSql($table, $name) { $table = $this->conn->quoteIdentifier($table, true); $name = $this->conn->quoteIdentifier($this->conn->formatter->getIndexName($name), true); - return $this->conn->exec('DROP INDEX ' . $name . ' ON ' . $table); + return 'DROP INDEX ' . $name . ' ON ' . $table; } /** * dropTable @@ -643,10 +639,10 @@ class Doctrine_Export_Mysql extends Doctrine_Export * @throws PDOException * @return void */ - public function dropTable($table) + public function dropTableSql($table) { $table = $this->conn->quoteIdentifier($table, true); - $this->conn->exec('DROP TABLE ' . $table); + return 'DROP TABLE ' . $table; } } diff --git a/lib/Doctrine/Export/Oracle.php b/lib/Doctrine/Export/Oracle.php index d66a91408..867d869a5 100644 --- a/lib/Doctrine/Export/Oracle.php +++ b/lib/Doctrine/Export/Oracle.php @@ -196,7 +196,7 @@ END; { $query = ''; if (isset($definition['onDelete'])) { - $query .= ' ON DELETE ' . $definition['on_delete']; + $query .= ' ON DELETE ' . $definition['onDelete']; } if (isset($definition['deferrable'])) { $query .= ' DEFERRABLE'; @@ -420,15 +420,6 @@ END; $result = $this->conn->exec('ALTER TABLE ' . $name . ' RENAME TO ' . $changeName); } } - /** - * getForeignKeyDeferredDeclaration - * - * @return string - */ - public function getForeignKeyDeferredDeclaration($deferred) - { - return ($deferred) ? 'INITIALLY DEFERRED DEFERRABLE' : ''; - } /** * create sequence * diff --git a/lib/Doctrine/Export/Pgsql.php b/lib/Doctrine/Export/Pgsql.php index 336f3bfe3..7d0f1f557 100644 --- a/lib/Doctrine/Export/Pgsql.php +++ b/lib/Doctrine/Export/Pgsql.php @@ -73,10 +73,10 @@ class Doctrine_Export_Pgsql extends Doctrine_Export $query .= ' MATCH ' . $definition['match']; } if (isset($definition['onUpdate'])) { - $query .= ' ON UPDATE ' . $definition['on_update']; + $query .= ' ON UPDATE ' . $definition['onUpdate']; } if (isset($definition['onDelete'])) { - $query .= ' ON DELETE ' . $definition['on_delete']; + $query .= ' ON DELETE ' . $definition['onDelete']; } if (isset($definition['deferrable'])) { $query .= ' DEFERRABLE'; diff --git a/lib/Doctrine/Export/Sqlite.php b/lib/Doctrine/Export/Sqlite.php index 1a0f0e6f4..fb9b7b55b 100644 --- a/lib/Doctrine/Export/Sqlite.php +++ b/lib/Doctrine/Export/Sqlite.php @@ -249,10 +249,10 @@ class Doctrine_Export_Sqlite extends Doctrine_Export $query .= ' MATCH ' . $definition['match']; } if (isset($definition['onUpdate'])) { - $query .= ' ON UPDATE ' . $definition['on_update']; + $query .= ' ON UPDATE ' . $definition['onUpdate']; } if (isset($definition['onDelete'])) { - $query .= ' ON DELETE ' . $definition['on_delete']; + $query .= ' ON DELETE ' . $definition['onDelete']; } if (isset($definition['deferrable'])) { $query .= ' DEFERRABLE'; @@ -308,11 +308,11 @@ class Doctrine_Export_Sqlite extends Doctrine_Export * drop existing sequence * * @param string $sequenceName name of the sequence to be dropped - * @return boolean + * @return string */ - public function dropSequence($sequenceName) + public function dropSequenceSql($sequenceName) { $sequenceName = $this->conn->quoteIdentifier($this->conn->getSequenceName($sequenceName), true); - return $this->conn->exec('DROP TABLE ' . $sequenceName); + return 'DROP TABLE ' . $sequenceName; } }