little bug fixes
This commit is contained in:
parent
e69284cc20
commit
c8ac51e864
@ -403,7 +403,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
|
|||||||
* )
|
* )
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function createIndex($table, $name, array $definition)
|
public function createIndexSql($table, $name, array $definition)
|
||||||
{
|
{
|
||||||
$query = 'CREATE';
|
$query = 'CREATE';
|
||||||
|
|
||||||
@ -429,9 +429,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export
|
|||||||
}
|
}
|
||||||
$query .= ' ('.implode(', ', $fields) . ')';
|
$query .= ' ('.implode(', ', $fields) . ')';
|
||||||
|
|
||||||
$result = $this->conn->exec($query);
|
return $query;
|
||||||
// todo: $this->_silentCommit();
|
|
||||||
return $result;
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* create a constraint on a table
|
* create a constraint on a table
|
||||||
|
@ -37,39 +37,35 @@ class Doctrine_Export_Frontbase extends Doctrine_Export
|
|||||||
* create a new database
|
* create a new database
|
||||||
*
|
*
|
||||||
* @param string $name name of the database that should be created
|
* @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);
|
$name = $this->conn->quoteIdentifier($name, true);
|
||||||
$query = 'CREATE DATABASE ' . $name;
|
return 'CREATE DATABASE ' . $name;
|
||||||
|
|
||||||
return $this->conn->exec($query);
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* drop an existing database
|
* drop an existing database
|
||||||
*
|
*
|
||||||
* @param string $name name of the database that should be dropped
|
* @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);
|
$name = $this->conn->quoteIdentifier($name, true);
|
||||||
$query = 'DELETE DATABASE ' . $name;
|
return 'DELETE DATABASE ' . $name;
|
||||||
|
|
||||||
return $this->conn->exec($query);
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* drop an existing table
|
* drop an existing table
|
||||||
*
|
*
|
||||||
* @param object $this->conns database object that is extended by this class
|
* @param object $this->conns database object that is extended by this class
|
||||||
* @param string $name name of the table that should be dropped
|
* @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);
|
$name = $this->conn->quoteIdentifier($name, true);
|
||||||
return $this->conn->exec('DROP TABLE ' . $name . ' CASCADE');
|
return 'DROP TABLE ' . $name . ' CASCADE';
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* alter an existing table
|
* alter an existing table
|
||||||
@ -289,13 +285,13 @@ class Doctrine_Export_Frontbase extends Doctrine_Export
|
|||||||
* drop existing sequence
|
* drop existing sequence
|
||||||
*
|
*
|
||||||
* @param string $seqName name of the sequence to be dropped
|
* @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);
|
$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
|
* drop existing index
|
||||||
@ -304,11 +300,11 @@ class Doctrine_Export_Frontbase extends Doctrine_Export
|
|||||||
* @param string $name name of the index to be dropped
|
* @param string $name name of the index to be dropped
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function dropIndex($table, $name)
|
public function dropIndexSql($table, $name)
|
||||||
{
|
{
|
||||||
$table = $this->conn->quoteIdentifier($table, true);
|
$table = $this->conn->quoteIdentifier($table, true);
|
||||||
$name = $this->conn->quoteIdentifier($this->conn->getIndexName($name), 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,8 +72,7 @@ class Doctrine_Export_Mssql extends Doctrine_Export
|
|||||||
public function getTemporaryTableQuery()
|
public function getTemporaryTableQuery()
|
||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* alter an existing table
|
* alter an existing table
|
||||||
*
|
*
|
||||||
|
@ -95,11 +95,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
|
|||||||
{
|
{
|
||||||
$sql = $this->createTableSql($name, $fields, $options);
|
$sql = $this->createTableSql($name, $fields, $options);
|
||||||
|
|
||||||
$this->conn->exec('SET FOREIGN_KEY_CHECKS = 0');
|
|
||||||
|
|
||||||
$this->conn->execute($sql);
|
$this->conn->execute($sql);
|
||||||
|
|
||||||
$this->conn->exec('SET FOREIGN_KEY_CHECKS = 1');
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* create a new table
|
* create a new table
|
||||||
@ -615,10 +611,10 @@ class Doctrine_Export_Mysql extends Doctrine_Export
|
|||||||
if (!empty($definition['match'])) {
|
if (!empty($definition['match'])) {
|
||||||
$query .= ' MATCH ' . $definition['match'];
|
$query .= ' MATCH ' . $definition['match'];
|
||||||
}
|
}
|
||||||
if (!empty($definition['on_update'])) {
|
if (!empty($definition['onUpdate'])) {
|
||||||
$query .= ' ON UPDATE ' . $this->getForeignKeyRefentialAction($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']);
|
$query .= ' ON DELETE ' . $this->getForeignKeyRefentialAction($definition['onDelete']);
|
||||||
}
|
}
|
||||||
return $query;
|
return $query;
|
||||||
@ -630,11 +626,11 @@ class Doctrine_Export_Mysql extends Doctrine_Export
|
|||||||
* @param string $name name of the index to be dropped
|
* @param string $name name of the index to be dropped
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function dropIndex($table, $name)
|
public function dropIndexSql($table, $name)
|
||||||
{
|
{
|
||||||
$table = $this->conn->quoteIdentifier($table, true);
|
$table = $this->conn->quoteIdentifier($table, true);
|
||||||
$name = $this->conn->quoteIdentifier($this->conn->formatter->getIndexName($name), 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
|
* dropTable
|
||||||
@ -643,10 +639,10 @@ class Doctrine_Export_Mysql extends Doctrine_Export
|
|||||||
* @throws PDOException
|
* @throws PDOException
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function dropTable($table)
|
public function dropTableSql($table)
|
||||||
{
|
{
|
||||||
$table = $this->conn->quoteIdentifier($table, true);
|
$table = $this->conn->quoteIdentifier($table, true);
|
||||||
$this->conn->exec('DROP TABLE ' . $table);
|
return 'DROP TABLE ' . $table;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ END;
|
|||||||
{
|
{
|
||||||
$query = '';
|
$query = '';
|
||||||
if (isset($definition['onDelete'])) {
|
if (isset($definition['onDelete'])) {
|
||||||
$query .= ' ON DELETE ' . $definition['on_delete'];
|
$query .= ' ON DELETE ' . $definition['onDelete'];
|
||||||
}
|
}
|
||||||
if (isset($definition['deferrable'])) {
|
if (isset($definition['deferrable'])) {
|
||||||
$query .= ' DEFERRABLE';
|
$query .= ' DEFERRABLE';
|
||||||
@ -420,15 +420,6 @@ END;
|
|||||||
$result = $this->conn->exec('ALTER TABLE ' . $name . ' RENAME TO ' . $changeName);
|
$result = $this->conn->exec('ALTER TABLE ' . $name . ' RENAME TO ' . $changeName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* getForeignKeyDeferredDeclaration
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getForeignKeyDeferredDeclaration($deferred)
|
|
||||||
{
|
|
||||||
return ($deferred) ? 'INITIALLY DEFERRED DEFERRABLE' : '';
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* create sequence
|
* create sequence
|
||||||
*
|
*
|
||||||
|
@ -73,10 +73,10 @@ class Doctrine_Export_Pgsql extends Doctrine_Export
|
|||||||
$query .= ' MATCH ' . $definition['match'];
|
$query .= ' MATCH ' . $definition['match'];
|
||||||
}
|
}
|
||||||
if (isset($definition['onUpdate'])) {
|
if (isset($definition['onUpdate'])) {
|
||||||
$query .= ' ON UPDATE ' . $definition['on_update'];
|
$query .= ' ON UPDATE ' . $definition['onUpdate'];
|
||||||
}
|
}
|
||||||
if (isset($definition['onDelete'])) {
|
if (isset($definition['onDelete'])) {
|
||||||
$query .= ' ON DELETE ' . $definition['on_delete'];
|
$query .= ' ON DELETE ' . $definition['onDelete'];
|
||||||
}
|
}
|
||||||
if (isset($definition['deferrable'])) {
|
if (isset($definition['deferrable'])) {
|
||||||
$query .= ' DEFERRABLE';
|
$query .= ' DEFERRABLE';
|
||||||
|
@ -249,10 +249,10 @@ class Doctrine_Export_Sqlite extends Doctrine_Export
|
|||||||
$query .= ' MATCH ' . $definition['match'];
|
$query .= ' MATCH ' . $definition['match'];
|
||||||
}
|
}
|
||||||
if (isset($definition['onUpdate'])) {
|
if (isset($definition['onUpdate'])) {
|
||||||
$query .= ' ON UPDATE ' . $definition['on_update'];
|
$query .= ' ON UPDATE ' . $definition['onUpdate'];
|
||||||
}
|
}
|
||||||
if (isset($definition['onDelete'])) {
|
if (isset($definition['onDelete'])) {
|
||||||
$query .= ' ON DELETE ' . $definition['on_delete'];
|
$query .= ' ON DELETE ' . $definition['onDelete'];
|
||||||
}
|
}
|
||||||
if (isset($definition['deferrable'])) {
|
if (isset($definition['deferrable'])) {
|
||||||
$query .= ' DEFERRABLE';
|
$query .= ' DEFERRABLE';
|
||||||
@ -308,11 +308,11 @@ class Doctrine_Export_Sqlite extends Doctrine_Export
|
|||||||
* drop existing sequence
|
* drop existing sequence
|
||||||
*
|
*
|
||||||
* @param string $sequenceName name of the sequence to be dropped
|
* @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);
|
$sequenceName = $this->conn->quoteIdentifier($this->conn->getSequenceName($sequenceName), true);
|
||||||
return $this->conn->exec('DROP TABLE ' . $sequenceName);
|
return 'DROP TABLE ' . $sequenceName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user