Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
8e18d1f6
Commit
8e18d1f6
authored
Oct 05, 2010
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "WS fixes"
This reverts commit
3b79401b
to allow a sane merge of Juokaz patch.
parent
173d7ec1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
34 deletions
+35
-34
MsSqlPlatform.php
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
+35
-34
No files found.
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
View file @
8e18d1f6
...
...
@@ -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
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment