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
0bb14561
Commit
0bb14561
authored
Sep 25, 2010
by
Juozas Kaziukenas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed string datatypes to unicode
parent
df0f0016
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
8 deletions
+16
-8
MsSqlPlatform.php
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
+2
-2
MsSqlSchemaManager.php
lib/Doctrine/DBAL/Schema/MsSqlSchemaManager.php
+8
-0
MsSqlPlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/MsSqlPlatformTest.php
+6
-6
No files found.
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
View file @
0bb14561
...
@@ -485,8 +485,8 @@ DROP DATABASE ' . $name . ';';
...
@@ -485,8 +485,8 @@ DROP DATABASE ' . $name . ';';
$length
=
(
$field
[
'length'
]
<=
$this
->
getVarcharMaxLength
())
?
$field
[
'length'
]
:
false
;
$length
=
(
$field
[
'length'
]
<=
$this
->
getVarcharMaxLength
())
?
$field
[
'length'
]
:
false
;
$fixed
=
(
isset
(
$field
[
'fixed'
]))
?
$field
[
'fixed'
]
:
false
;
$fixed
=
(
isset
(
$field
[
'fixed'
]))
?
$field
[
'fixed'
]
:
false
;
return
$fixed
?
(
$length
?
'CHAR('
.
$length
.
')'
:
'CHAR(255)'
)
return
$fixed
?
(
$length
?
'
N
CHAR('
.
$length
.
')'
:
'CHAR(255)'
)
:
(
$length
?
'
VARCHAR('
.
$length
.
')'
:
'
TEXT'
);
:
(
$length
?
'
NVARCHAR('
.
$length
.
')'
:
'N
TEXT'
);
}
}
/** @override */
/** @override */
...
...
lib/Doctrine/DBAL/Schema/MsSqlSchemaManager.php
View file @
0bb14561
...
@@ -76,6 +76,14 @@ class MsSqlSchemaManager extends AbstractSchemaManager
...
@@ -76,6 +76,14 @@ class MsSqlSchemaManager extends AbstractSchemaManager
$fixed
=
false
;
$fixed
=
false
;
break
;
break
;
}
}
switch
(
$dbType
)
{
case
'nchar'
:
case
'nvarchar'
:
case
'ntext'
:
// Unicode data requires 2 bytes per character
$length
=
$length
/
2
;
break
;
}
$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
,
...
...
tests/Doctrine/Tests/DBAL/Platforms/MsSqlPlatformTest.php
View file @
0bb14561
...
@@ -16,13 +16,13 @@ class MsSqlPlatformTest extends AbstractPlatformTestCase
...
@@ -16,13 +16,13 @@ class MsSqlPlatformTest extends AbstractPlatformTestCase
public
function
getGenerateTableSql
()
public
function
getGenerateTableSql
()
{
{
return
'CREATE TABLE test (id INT IDENTITY NOT NULL, test VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))'
;
return
'CREATE TABLE test (id INT IDENTITY NOT NULL, test
N
VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))'
;
}
}
public
function
getGenerateTableWithMultiColumnUniqueIndexSql
()
public
function
getGenerateTableWithMultiColumnUniqueIndexSql
()
{
{
return
array
(
return
array
(
'CREATE TABLE test (foo
VARCHAR(255) DEFAULT NULL, bar
VARCHAR(255) DEFAULT NULL)'
,
'CREATE TABLE test (foo
NVARCHAR(255) DEFAULT NULL, bar N
VARCHAR(255) DEFAULT NULL)'
,
'CREATE UNIQUE INDEX test_foo_bar_uniq ON test (foo, bar)'
'CREATE UNIQUE INDEX test_foo_bar_uniq ON test (foo, bar)'
);
);
}
}
...
@@ -33,7 +33,7 @@ class MsSqlPlatformTest extends AbstractPlatformTestCase
...
@@ -33,7 +33,7 @@ class MsSqlPlatformTest extends AbstractPlatformTestCase
'ALTER TABLE mytable RENAME TO userlist'
,
'ALTER TABLE mytable RENAME TO userlist'
,
'ALTER TABLE mytable ADD quota INT DEFAULT NULL'
,
'ALTER TABLE mytable ADD quota INT DEFAULT NULL'
,
'ALTER TABLE mytable DROP COLUMN foo'
,
'ALTER TABLE mytable DROP COLUMN foo'
,
'ALTER TABLE mytable CHANGE bar baz VARCHAR(255) DEFAULT \'def\' NOT NULL'
,
'ALTER TABLE mytable CHANGE bar baz
N
VARCHAR(255) DEFAULT \'def\' NOT NULL'
,
);
);
}
}
...
@@ -99,17 +99,17 @@ DDB;
...
@@ -99,17 +99,17 @@ DDB;
public
function
testGeneratesTypeDeclarationsForStrings
()
public
function
testGeneratesTypeDeclarationsForStrings
()
{
{
$this
->
assertEquals
(
$this
->
assertEquals
(
'CHAR(10)'
,
'
N
CHAR(10)'
,
$this
->
_platform
->
getVarcharTypeDeclarationSQL
(
$this
->
_platform
->
getVarcharTypeDeclarationSQL
(
array
(
'length'
=>
10
,
'fixed'
=>
true
)
array
(
'length'
=>
10
,
'fixed'
=>
true
)
));
));
$this
->
assertEquals
(
$this
->
assertEquals
(
'VARCHAR(50)'
,
'
N
VARCHAR(50)'
,
$this
->
_platform
->
getVarcharTypeDeclarationSQL
(
array
(
'length'
=>
50
)),
$this
->
_platform
->
getVarcharTypeDeclarationSQL
(
array
(
'length'
=>
50
)),
'Variable string declaration is not correct'
'Variable string declaration is not correct'
);
);
$this
->
assertEquals
(
$this
->
assertEquals
(
'TEXT'
,
'
N
TEXT'
,
$this
->
_platform
->
getVarcharTypeDeclarationSQL
(
array
()),
$this
->
_platform
->
getVarcharTypeDeclarationSQL
(
array
()),
'Long string declaration is not correct'
'Long string declaration is not correct'
);
);
...
...
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