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
df0f0016
Commit
df0f0016
authored
Sep 25, 2010
by
Juozas Kaziukenas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented initializeDoctrineTypeMappings()
parent
cb38ff56
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
94 deletions
+48
-94
MsSqlPlatform.php
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
+33
-1
MsSqlSchemaManager.php
lib/Doctrine/DBAL/Schema/MsSqlSchemaManager.php
+15
-93
No files found.
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
View file @
df0f0016
...
...
@@ -651,6 +651,38 @@ DROP DATABASE ' . $name . ';';
protected
function
initializeDoctrineTypeMappings
()
{
$this
->
doctrineTypeMapping
=
array
(
'bigint'
=>
'bigint'
,
'numeric'
=>
'decimal'
,
'bit'
=>
'boolean'
,
'smallint'
=>
'smallint'
,
'decimal'
=>
'decimal'
,
'smallmoney'
=>
'integer'
,
'int'
=>
'integer'
,
'tinyint'
=>
'smallint'
,
'money'
=>
'integer'
,
'float'
=>
'decimal'
,
'real'
=>
'decimal'
,
'date'
=>
'date'
,
'datetimeoffset'
=>
'datetimetz'
,
'datetime2'
=>
'datetime'
,
'smalldatetime'
=>
'datetime'
,
'datetime'
=>
'datetime'
,
'time'
=>
'time'
,
'char'
=>
'string'
,
'varchar'
=>
'string'
,
'text'
=>
'text'
,
'nchar'
=>
'string'
,
'nvarchar'
=>
'string'
,
'ntext'
=>
'text'
,
'binary'
=>
'text'
,
'varbinary'
=>
'text'
,
'image'
=>
'text'
,
);
}
}
lib/Doctrine/DBAL/Schema/MsSqlSchemaManager.php
View file @
df0f0016
...
...
@@ -53,116 +53,38 @@ class MsSqlSchemaManager extends AbstractSchemaManager
$tableColumn
[
'name'
]
=
''
;
}
// Map db type to Doctrine mapping type
switch
(
$dbType
)
{
case
'tinyint'
:
$type
=
'boolean'
;
break
;
case
'smallint'
:
$type
=
'smallint'
;
break
;
case
'mediumint'
:
$type
=
'integer'
;
break
;
case
'int'
:
case
'integer'
:
$type
=
'integer'
;
break
;
case
'bigint'
:
$type
=
'bigint'
;
break
;
case
'tinytext'
:
case
'mediumtext'
:
case
'longtext'
:
case
'text'
:
$type
=
'text'
;
$fixed
=
false
;
break
;
case
'varchar'
:
$fixed
=
false
;
case
'string'
:
$default
=
$tableColumn
[
'COLUMN_DEF'
];
while
(
$default
!=
(
$default2
=
preg_replace
(
"/^\((.*)\)$/"
,
'$1'
,
$default
)))
{
$default
=
$default2
;
}
$length
=
(
int
)
$tableColumn
[
'LENGTH'
];
$type
=
$this
->
_platform
->
getDoctrineTypeMapping
(
$dbType
);
switch
(
$type
)
{
case
'char'
:
$type
=
'string'
;
if
(
$tableColumn
[
'LENGTH'
]
==
'1'
)
{
$type
=
'boolean'
;
if
(
preg_match
(
'/^(is|has)/'
,
$tableColumn
[
'name'
]))
{
$type
=
array_reverse
(
$type
);
}
}
else
if
(
strstr
(
$dbType
,
'text'
))
{
$type
=
'text'
;
if
(
$decimal
==
'binary'
)
{
$type
=
'blob'
;
}
}
if
(
$fixed
!==
false
)
{
$fixed
=
true
;
}
$fixed
=
true
;
break
;
case
'set'
:
$fixed
=
false
;
$type
=
'text'
;
$type
=
'integer'
;
//FIXME:???
break
;
case
'date'
:
$type
=
'date'
;
break
;
case
'datetime'
:
case
'datetime2'
:
case
'timestamp'
:
case
'smalldatettime'
:
$type
=
'datetime'
;
break
;
case
'time'
:
$type
=
'time'
;
break
;
case
'float'
:
case
'double'
:
case
'real'
:
case
'numeric'
:
case
'decimal'
:
$type
=
'decimal'
;
break
;
case
'tinyblob'
:
case
'mediumblob'
:
case
'longblob'
:
case
'blob'
:
case
'binary'
:
case
'varbinary'
:
$type
=
'blob'
;
break
;
case
'year'
:
$type
=
'integer'
;
$type
=
'date'
;
break
;
case
'geometry'
:
case
'geometrycollection'
:
case
'point'
:
case
'multipoint'
:
case
'linestring'
:
case
'multilinestring'
:
case
'polygon'
:
case
'multipolygon'
:
$type
=
'blob'
;
break
;
default
:
$type
=
'string'
;
}
$default
=
$tableColumn
[
'COLUMN_DEF'
];
while
(
$default
!=
(
$default2
=
preg_replace
(
"/^\((.*)\)$/"
,
'$1'
,
$default
)))
{
$default
=
$default2
;
case
'text'
:
$fixed
=
false
;
break
;
}
$options
=
array
(
'length'
=>
(
(
int
)
$tableColumn
[
'LENGTH'
]
==
0
||
!
in_array
(
$type
,
array
(
'text'
,
'string'
)))
?
null
:
(
int
)
$tableColumn
[
'LENGTH'
]
,
'length'
=>
(
$length
==
0
||
!
in_array
(
$type
,
array
(
'text'
,
'string'
)))
?
null
:
$length
,
'unsigned'
=>
(
bool
)
$unsigned
,
'fixed'
=>
(
bool
)
$fixed
,
'default'
=>
$default
!==
'NULL'
?
$default
:
null
,
'notnull'
=>
(
bool
)
(
$tableColumn
[
'IS_NULLABLE'
]
!=
'YES'
),
'scale'
=>
$tableColumn
[
'SCALE'
],
'precision'
=>
$tableColumn
[
'PRECISION'
],
'unique'
=>
false
,
// @todo
'autoincrement'
=>
$autoincrement
,
);
...
...
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