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
|
||||
*/
|
||||
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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,6 @@ class Doctrine_Export_Mssql extends Doctrine_Export
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* alter an existing table
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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';
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user