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
f2e6fa86
Commit
f2e6fa86
authored
Nov 24, 2013
by
Steve Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for column comments in SQL Server
parent
25a1cced
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
683 additions
and
23 deletions
+683
-23
SQLServerPlatform.php
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
+254
-13
SQLServerSchemaManager.php
lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
+11
-8
SQLServerSchemaManagerTest.php
...sts/DBAL/Functional/Schema/SQLServerSchemaManagerTest.php
+165
-0
SchemaManagerFunctionalTestCase.php
...BAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
+6
-2
SQLServerPlatformTest.php
...s/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php
+247
-0
No files found.
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
View file @
f2e6fa86
This diff is collapsed.
Click to expand it.
lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
View file @
f2e6fa86
...
@@ -79,7 +79,9 @@ class SQLServerSchemaManager extends AbstractSchemaManager
...
@@ -79,7 +79,9 @@ class SQLServerSchemaManager extends AbstractSchemaManager
break
;
break
;
}
}
$type
=
$this
->
_platform
->
getDoctrineTypeMapping
(
$dbType
);
$type
=
$this
->
_platform
->
getDoctrineTypeMapping
(
$dbType
);
$type
=
$this
->
extractDoctrineTypeFromComment
(
$tableColumn
[
'comment'
],
$type
);
$tableColumn
[
'comment'
]
=
$this
->
removeDoctrineTypeFromComment
(
$tableColumn
[
'comment'
],
$type
);
switch
(
$type
)
{
switch
(
$type
)
{
case
'char'
:
case
'char'
:
...
@@ -91,14 +93,15 @@ class SQLServerSchemaManager extends AbstractSchemaManager
...
@@ -91,14 +93,15 @@ class SQLServerSchemaManager extends AbstractSchemaManager
}
}
$options
=
array
(
$options
=
array
(
'length'
=>
(
$length
==
0
||
!
in_array
(
$type
,
array
(
'text'
,
'string'
)))
?
null
:
$length
,
'length'
=>
(
$length
==
0
||
!
in_array
(
$type
,
array
(
'text'
,
'string'
)))
?
null
:
$length
,
'unsigned'
=>
false
,
'unsigned'
=>
false
,
'fixed'
=>
(
bool
)
$fixed
,
'fixed'
=>
(
bool
)
$fixed
,
'default'
=>
$default
!==
'NULL'
?
$default
:
null
,
'default'
=>
$default
!==
'NULL'
?
$default
:
null
,
'notnull'
=>
(
bool
)
$tableColumn
[
'notnull'
],
'notnull'
=>
(
bool
)
$tableColumn
[
'notnull'
],
'scale'
=>
$tableColumn
[
'scale'
],
'scale'
=>
$tableColumn
[
'scale'
],
'precision'
=>
$tableColumn
[
'precision'
],
'precision'
=>
$tableColumn
[
'precision'
],
'autoincrement'
=>
(
bool
)
$tableColumn
[
'autoincrement'
],
'autoincrement'
=>
(
bool
)
$tableColumn
[
'autoincrement'
],
'comment'
=>
$tableColumn
[
'comment'
]
!==
''
?
$tableColumn
[
'comment'
]
:
null
,
);
);
$platformOptions
=
array
(
$platformOptions
=
array
(
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/SQLServerSchemaManagerTest.php
View file @
f2e6fa86
This diff is collapsed.
Click to expand it.
tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
View file @
f2e6fa86
...
@@ -522,7 +522,9 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
...
@@ -522,7 +522,9 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
*/
*/
public
function
testGetColumnComment
()
public
function
testGetColumnComment
()
{
{
if
(
!
$this
->
_conn
->
getDatabasePlatform
()
->
supportsInlineColumnComments
()
&&
!
$this
->
_conn
->
getDatabasePlatform
()
->
supportsCommentOnStatement
())
{
if
(
!
$this
->
_conn
->
getDatabasePlatform
()
->
supportsInlineColumnComments
()
&&
!
$this
->
_conn
->
getDatabasePlatform
()
->
supportsCommentOnStatement
()
&&
!
$this
->
_conn
->
getDatabasePlatform
()
->
getName
()
==
'mssql'
)
{
$this
->
markTestSkipped
(
'Database does not support column comments.'
);
$this
->
markTestSkipped
(
'Database does not support column comments.'
);
}
}
...
@@ -556,7 +558,9 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
...
@@ -556,7 +558,9 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
*/
*/
public
function
testAutomaticallyAppendCommentOnMarkedColumns
()
public
function
testAutomaticallyAppendCommentOnMarkedColumns
()
{
{
if
(
!
$this
->
_conn
->
getDatabasePlatform
()
->
supportsInlineColumnComments
()
&&
!
$this
->
_conn
->
getDatabasePlatform
()
->
supportsCommentOnStatement
())
{
if
(
!
$this
->
_conn
->
getDatabasePlatform
()
->
supportsInlineColumnComments
()
&&
!
$this
->
_conn
->
getDatabasePlatform
()
->
supportsCommentOnStatement
()
&&
!
$this
->
_conn
->
getDatabasePlatform
()
->
getName
()
==
'mssql'
)
{
$this
->
markTestSkipped
(
'Database does not support column comments.'
);
$this
->
markTestSkipped
(
'Database does not support column comments.'
);
}
}
...
...
tests/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php
View file @
f2e6fa86
This diff is collapsed.
Click to expand it.
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