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
5e86f6e3
Commit
5e86f6e3
authored
Oct 14, 2011
by
Miquel Rodríguez Telep / Michael Rodríguez-Torrent
Committed by
Benjamin Eberlei
Dec 18, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Strip quotes from SQLite default column string values
parent
a8fd3391
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
SqliteSchemaManager.php
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
+4
-0
SchemaManagerFunctionalTestCase.php
...BAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
+2
-2
No files found.
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
View file @
5e86f6e3
...
@@ -137,6 +137,10 @@ class SqliteSchemaManager extends AbstractSchemaManager
...
@@ -137,6 +137,10 @@ class SqliteSchemaManager extends AbstractSchemaManager
if
(
$default
==
'NULL'
)
{
if
(
$default
==
'NULL'
)
{
$default
=
null
;
$default
=
null
;
}
}
if
(
$default
!==
null
)
{
// SQLite returns strings wrapped in single quotes, so we need to strip them
$default
=
preg_replace
(
"/^'(.*)'$/"
,
'\1'
,
$default
);
}
$notnull
=
(
bool
)
$tableColumn
[
'notnull'
];
$notnull
=
(
bool
)
$tableColumn
[
'notnull'
];
if
(
!
isset
(
$tableColumn
[
'name'
]))
{
if
(
!
isset
(
$tableColumn
[
'name'
]))
{
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
View file @
5e86f6e3
...
@@ -99,7 +99,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
...
@@ -99,7 +99,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$table
=
new
\Doctrine\DBAL\Schema\Table
(
'list_table_columns'
);
$table
=
new
\Doctrine\DBAL\Schema\Table
(
'list_table_columns'
);
$table
->
addColumn
(
'id'
,
'integer'
,
array
(
'notnull'
=>
true
));
$table
->
addColumn
(
'id'
,
'integer'
,
array
(
'notnull'
=>
true
));
$table
->
addColumn
(
'test'
,
'string'
,
array
(
'length'
=>
255
,
'notnull'
=>
false
));
$table
->
addColumn
(
'test'
,
'string'
,
array
(
'length'
=>
255
,
'notnull'
=>
false
));
$table
->
addColumn
(
'foo'
,
'text'
,
array
(
'notnull'
=>
true
));
$table
->
addColumn
(
'foo'
,
'text'
,
array
(
'notnull'
=>
true
,
'default'
=>
'expected default'
));
$table
->
addColumn
(
'bar'
,
'decimal'
,
array
(
'precision'
=>
10
,
'scale'
=>
4
,
'notnull'
=>
false
));
$table
->
addColumn
(
'bar'
,
'decimal'
,
array
(
'precision'
=>
10
,
'scale'
=>
4
,
'notnull'
=>
false
));
$table
->
addColumn
(
'baz1'
,
'datetime'
);
$table
->
addColumn
(
'baz1'
,
'datetime'
);
$table
->
addColumn
(
'baz2'
,
'time'
);
$table
->
addColumn
(
'baz2'
,
'time'
);
...
@@ -138,7 +138,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
...
@@ -138,7 +138,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$this
->
assertEquals
(
false
,
$columns
[
'foo'
]
->
getunsigned
());
$this
->
assertEquals
(
false
,
$columns
[
'foo'
]
->
getunsigned
());
$this
->
assertEquals
(
false
,
$columns
[
'foo'
]
->
getfixed
());
$this
->
assertEquals
(
false
,
$columns
[
'foo'
]
->
getfixed
());
$this
->
assertEquals
(
true
,
$columns
[
'foo'
]
->
getnotnull
());
$this
->
assertEquals
(
true
,
$columns
[
'foo'
]
->
getnotnull
());
$this
->
assertEquals
(
null
,
$columns
[
'foo'
]
->
getdefault
());
$this
->
assertEquals
(
'expected default'
,
$columns
[
'foo'
]
->
getdefault
());
$this
->
assertInternalType
(
'array'
,
$columns
[
'foo'
]
->
getPlatformOptions
());
$this
->
assertInternalType
(
'array'
,
$columns
[
'foo'
]
->
getPlatformOptions
());
$this
->
assertEquals
(
'bar'
,
strtolower
(
$columns
[
'bar'
]
->
getname
()));
$this
->
assertEquals
(
'bar'
,
strtolower
(
$columns
[
'bar'
]
->
getname
()));
...
...
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