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
3b79401b
Commit
3b79401b
authored
Sep 30, 2010
by
Lukas Kahwe Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WS fixes
parent
e9ab5672
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
35 deletions
+34
-35
MsSqlPlatform.php
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
+34
-35
No files found.
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
View file @
3b79401b
...
...
@@ -92,7 +92,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
.
';'
;
...
...
@@ -121,37 +121,36 @@ 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
);
...
...
@@ -174,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
);
}
...
...
@@ -222,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
));
...
...
@@ -291,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
)
...
...
@@ -386,8 +385,8 @@ DROP DATABASE ' . $name . ';';
$args
=
func_get_args
();
return
'('
.
implode
(
' + '
,
$args
)
.
')'
;
}
public
function
getListDatabasesSQL
()
public
function
getListDatabasesSQL
()
{
return
'SELECT * FROM SYS.DATABASES'
;
}
...
...
@@ -644,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