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
869f7daa
Commit
869f7daa
authored
Mar 14, 2013
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DBAL-461] Add support for NUMERIC(N, M) type syntax in SQL Server.
parent
143c2510
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
4 deletions
+39
-4
AbstractSchemaManager.php
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
+3
-3
SQLServerSchemaManager.php
lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
+1
-1
DBAL461Test.php
tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php
+35
-0
No files found.
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
View file @
869f7daa
...
@@ -59,10 +59,10 @@ abstract class AbstractSchemaManager
...
@@ -59,10 +59,10 @@ abstract class AbstractSchemaManager
*
*
* @param \Doctrine\DBAL\Connection $conn
* @param \Doctrine\DBAL\Connection $conn
*/
*/
public
function
__construct
(
\Doctrine\DBAL\Connection
$conn
)
public
function
__construct
(
\Doctrine\DBAL\Connection
$conn
,
AbstractPlatform
$platform
=
null
)
{
{
$this
->
_conn
=
$conn
;
$this
->
_conn
=
$conn
;
$this
->
_platform
=
$this
->
_conn
->
getDatabasePlatform
();
$this
->
_platform
=
$
platform
?:
$
this
->
_conn
->
getDatabasePlatform
();
}
}
/**
/**
...
...
lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
View file @
869f7daa
...
@@ -49,7 +49,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager
...
@@ -49,7 +49,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager
*/
*/
protected
function
_getPortableTableColumnDefinition
(
$tableColumn
)
protected
function
_getPortableTableColumnDefinition
(
$tableColumn
)
{
{
$dbType
=
$tableColumn
[
'type'
]
;
$dbType
=
strtok
(
$tableColumn
[
'type'
],
'(), '
)
;
$fixed
=
null
;
$fixed
=
null
;
$length
=
(
int
)
$tableColumn
[
'length'
];
$length
=
(
int
)
$tableColumn
[
'length'
];
$default
=
$tableColumn
[
'default'
];
$default
=
$tableColumn
[
'default'
];
...
...
tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php
0 → 100644
View file @
869f7daa
<?php
namespace
Doctrine\Tests\DBAL\Functional\Ticket
;
use
Doctrine\DBAL\Schema\SQLServerSchemaManager
;
/**
* @group DBAL-461
*/
class
DBAL461Test
extends
\PHPUnit_Framework_TestCase
{
public
function
testIssue
()
{
$conn
=
$this
->
getMock
(
'Doctrine\DBAL\Connection'
,
array
(),
array
(),
''
,
false
);
$platform
=
$this
->
getMockForAbstractClass
(
'Doctrine\DBAL\Platforms\AbstractPlatform'
);
$platform
->
registerDoctrineTypeMapping
(
'numeric'
,
'decimal'
);
$schemaManager
=
new
SQLServerSchemaManager
(
$conn
,
$platform
);
$reflectionMethod
=
new
\ReflectionMethod
(
$schemaManager
,
'_getPortableTableColumnDefinition'
);
$reflectionMethod
->
setAccessible
(
true
);
$column
=
$reflectionMethod
->
invoke
(
$schemaManager
,
array
(
'type'
=>
'numeric(18,0)'
,
'length'
=>
null
,
'default'
=>
null
,
'notnull'
=>
false
,
'scale'
=>
18
,
'precision'
=>
0
,
'autoincrement'
=>
false
,
'collation'
=>
'foo'
,
));
$this
->
assertEquals
(
'Decimal'
,
(
string
)
$column
->
getType
());
}
}
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