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
22fbf520
Commit
22fbf520
authored
Nov 25, 2012
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'DBAL-387' into 2.2
parents
b961a3fc
7f81d250
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
4 deletions
+32
-4
SQLServerPlatform.php
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
+28
-0
SQLServerPlatformTest.php
...s/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php
+4
-4
No files found.
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
View file @
22fbf520
...
...
@@ -862,4 +862,32 @@ class SQLServerPlatform extends AbstractPlatform
{
return
'VARBINARY(MAX)'
;
}
/**
* {@inheritDoc}
*/
public
function
getDefaultValueDeclarationSQL
(
$field
)
{
if
(
!
isset
(
$field
[
'default'
]))
{
return
empty
(
$field
[
'notnull'
])
?
' NULL'
:
''
;
}
if
(
!
isset
(
$field
[
'type'
]))
{
return
" DEFAULT '"
.
$field
[
'default'
]
.
"'"
;
}
if
(
in_array
((
string
)
$field
[
'type'
],
array
(
'Integer'
,
'BigInteger'
,
'SmallInteger'
)))
{
return
" DEFAULT "
.
$field
[
'default'
];
}
if
((
string
)
$field
[
'type'
]
==
'DateTime'
&&
$field
[
'default'
]
==
$this
->
getCurrentTimestampSQL
())
{
return
" DEFAULT "
.
$this
->
getCurrentTimestampSQL
();
}
if
((
string
)
$field
[
'type'
]
==
'Boolean'
)
{
return
" DEFAULT '"
.
$this
->
convertBooleans
(
$field
[
'default'
])
.
"'"
;
}
return
" DEFAULT '"
.
$field
[
'default'
]
.
"'"
;
}
}
tests/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php
View file @
22fbf520
...
...
@@ -14,13 +14,13 @@ class SQLServerPlatformTest extends AbstractPlatformTestCase
public
function
getGenerateTableSql
()
{
return
'CREATE TABLE test (id INT IDENTITY NOT NULL, test NVARCHAR(255)
DEFAULT
NULL, PRIMARY KEY(id))'
;
return
'CREATE TABLE test (id INT IDENTITY NOT NULL, test NVARCHAR(255) NULL, PRIMARY KEY(id))'
;
}
public
function
getGenerateTableWithMultiColumnUniqueIndexSql
()
{
return
array
(
'CREATE TABLE test (foo NVARCHAR(255)
DEFAULT NULL, bar NVARCHAR(255) DEFAULT
NULL)'
,
'CREATE TABLE test (foo NVARCHAR(255)
NULL, bar NVARCHAR(255)
NULL)'
,
'CREATE UNIQUE INDEX UNIQ_D87F7E0C8C73652176FF8CAA ON test (foo, bar) WHERE foo IS NOT NULL AND bar IS NOT NULL'
);
}
...
...
@@ -28,8 +28,8 @@ class SQLServerPlatformTest extends AbstractPlatformTestCase
public
function
getGenerateAlterTableSql
()
{
return
array
(
'ALTER TABLE mytable
RENAME TO userlist
'
,
'ALTER TABLE mytable ADD quota INT
DEFAULT
NULL'
,
'ALTER TABLE mytable
sp_RENAME \'mytable\', \'userlist\'
'
,
'ALTER TABLE mytable ADD quota INT NULL'
,
'ALTER TABLE mytable DROP COLUMN foo'
,
'ALTER TABLE mytable ALTER COLUMN baz NVARCHAR(255) DEFAULT \'def\' NOT NULL'
,
'ALTER TABLE mytable ALTER COLUMN bloo BIT DEFAULT \'0\' NOT NULL'
,
...
...
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