Commit 8e18d1f6 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Revert "WS fixes"

This reverts commit 3b79401b to allow a sane merge of Juokaz patch.
parent 173d7ec1
......@@ -91,7 +91,7 @@ class MsSqlPlatform extends AbstractPlatform
*/
public function getDropDatabaseSQL($name)
{
return 'ALTER DATABASE [' . $name . ']
return 'ALTER DATABASE [' . $name . ']
SET SINGLE_USER --or RESTRICTED_USER
WITH ROLLBACK IMMEDIATE;
DROP DATABASE ' . $name . ';';
......@@ -120,36 +120,37 @@ DROP DATABASE ' . $name . ';';
return 'ALTER TABLE ' . $table . ' DROP CONSTRAINT ' . $foreignKey;
}
/**
/**
* @override
*/
public function getDropIndexSQL($index, $table=null)
public function getDropIndexSQL($index, $table=null)
{
if($index instanceof \Doctrine\DBAL\Schema\Index) {
$index_ = $index;
$index = $index->getName();
} else if(!is_string($index)) {
throw new \InvalidArgumentException('AbstractPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.');
}
if (!isset($table)) {
return 'DROP INDEX ' . $index;
} else {
if ($table instanceof \Doctrine\DBAL\Schema\Table) {
$table = $table->getName();
}
return "IF EXISTS (SELECT * FROM sysobjects WHERE name = '$index')
ALTER TABLE " . $this->quoteIdentifier($table) . " DROP CONSTRAINT " . $this->quoteIdentifier($index) . "
ELSE
DROP INDEX " . $this->quoteIdentifier($index) . " ON " . $this->quoteIdentifier($table);
}
if (!isset($table)) {
return 'DROP INDEX ' . $index;
} else {
if ($table instanceof \Doctrine\DBAL\Schema\Table) {
$table = $table->getName();
}
return "IF EXISTS (SELECT * FROM sysobjects WHERE name = '$index')
ALTER TABLE " . $this->quoteIdentifier($table) . " DROP CONSTRAINT " . $this->quoteIdentifier($index) . "
ELSE
DROP INDEX " . $this->quoteIdentifier($index) . " ON " . $this->quoteIdentifier($table);
}
}
/**
/**
* @override
*/
protected function _getCreateTableSQL($tableName, array $columns, array $options = array())
protected function _getCreateTableSQL($tableName, array $columns, array $options = array())
{
$columnListSql = $this->getColumnDeclarationListSQL($columns);
......@@ -172,8 +173,8 @@ DROP DATABASE ' . $name . ';';
$query .= ')';
$sql[] = $query;
if (isset($options['indexes']) && ! empty($options['indexes'])) {
if (isset($options['indexes']) && ! empty($options['indexes'])) {
foreach ($options['indexes'] AS $index) {
$sql[] = $this->getCreateIndexSQL($index, $tableName);
}
......@@ -220,9 +221,9 @@ DROP DATABASE ' . $name . ';';
$sql = array();
foreach ($queryParts as $query) {
$sql[] = 'ALTER TABLE ' . $diff->name . ' ' . $query;
}
foreach ($queryParts as $query) {
$sql[] = 'ALTER TABLE ' . $diff->name . ' ' . $query;
}
$sql = array_merge($sql, $this->_getAlterTableIndexForeignKeySQL($diff));
......@@ -289,24 +290,24 @@ DROP DATABASE ' . $name . ';';
{
return "exec sp_helpindex '" . $table . "'";
}
/**
/**
* @override
*/
public function getCreateViewSQL($name, $sql)
public function getCreateViewSQL($name, $sql)
{
return 'CREATE VIEW ' . $name . ' AS ' . $sql;
}
/**
/**
* @override
*/
public function getListViewsSQL($database)
public function getListViewsSQL($database)
{
return "SELECT name FROM sysobjects WHERE type = 'V' ORDER BY name";
}
/**
/**
* @override
*/
public function getDropViewSQL($name)
......@@ -384,8 +385,8 @@ DROP DATABASE ' . $name . ';';
$args = func_get_args();
return '(' . implode(' + ', $args) . ')';
}
public function getListDatabasesSQL()
public function getListDatabasesSQL()
{
return 'SELECT * FROM SYS.DATABASES';
}
......@@ -642,7 +643,7 @@ DROP DATABASE ' . $name . ';';
{
return 'Y-m-d H:i:s.u';
}
/**
* @override
*/
......
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