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
36c4ddd6
Commit
36c4ddd6
authored
Dec 31, 2013
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DBAL-752] Implement general fix to detect unsigned SQLite columns.
parent
acb5b9f2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
6 deletions
+56
-6
SqlitePlatform.php
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
+0
-1
SqliteSchemaManager.php
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
+11
-5
DBAL752Test.php
tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL752Test.php
+45
-0
No files found.
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
View file @
36c4ddd6
...
...
@@ -543,7 +543,6 @@ class SqlitePlatform extends AbstractPlatform
'decimal'
=>
'decimal'
,
'numeric'
=>
'decimal'
,
'blob'
=>
'blob'
,
'integer unsigned'
=>
'integer'
,
);
}
...
...
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
View file @
36c4ddd6
...
...
@@ -244,16 +244,22 @@ class SqliteSchemaManager extends AbstractSchemaManager
*/
protected
function
_getPortableTableColumnDefinition
(
$tableColumn
)
{
$
e
=
explode
(
'('
,
$tableColumn
[
'type'
]);
$tableColumn
[
'type'
]
=
$
e
[
0
];
if
(
isset
(
$
e
[
1
]))
{
$length
=
trim
(
$
e
[
1
],
')'
);
$
parts
=
explode
(
'('
,
$tableColumn
[
'type'
]);
$tableColumn
[
'type'
]
=
$
parts
[
0
];
if
(
isset
(
$
parts
[
1
]))
{
$length
=
trim
(
$
parts
[
1
],
')'
);
$tableColumn
[
'length'
]
=
$length
;
}
$dbType
=
strtolower
(
$tableColumn
[
'type'
]);
$length
=
isset
(
$tableColumn
[
'length'
])
?
$tableColumn
[
'length'
]
:
null
;
$unsigned
=
(
boolean
)
isset
(
$tableColumn
[
'unsigned'
])
?
$tableColumn
[
'unsigned'
]
:
false
;
$unsigned
=
false
;
if
(
strpos
(
$dbType
,
' unsigned'
)
!==
false
)
{
$dbType
=
str_replace
(
' unsigned'
,
''
,
$dbType
);
$unsigned
=
true
;
}
$fixed
=
false
;
$type
=
$this
->
_platform
->
getDoctrineTypeMapping
(
$dbType
);
$default
=
$tableColumn
[
'dflt_value'
];
...
...
tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL752Test.php
0 → 100644
View file @
36c4ddd6
<?php
namespace
Doctrine\Tests\DBAL\Functional\Ticket
;
use
Doctrine\DBAL\Schema\Table
;
/**
* @group DBAL-752
*/
class
DBAL752Test
extends
\Doctrine\Tests\DbalFunctionalTestCase
{
protected
function
setUp
()
{
parent
::
setUp
();
$platform
=
$this
->
_conn
->
getDatabasePlatform
()
->
getName
();
if
(
!
in_array
(
$platform
,
array
(
'sqlite'
)))
{
$this
->
markTestSkipped
(
'Related to SQLite only'
);
}
}
public
function
testUnsignedIntegerDetection
()
{
$this
->
_conn
->
exec
(
<<<SQL
CREATE TABLE dbal752_unsigneds (
id BIGINT UNSIGNED,
flag SMALLINT UNSIGNED,
masks INTEGER UNSIGNED
);
SQL
);
$schemaManager
=
$this
->
_conn
->
getSchemaManager
();
$fetchedTable
=
$schemaManager
->
listTableDetails
(
'dbal752_unsigneds'
);
$this
->
assertEquals
(
'bigint'
,
$fetchedTable
->
getColumn
(
'id'
)
->
getType
()
->
getName
());
$this
->
assertEquals
(
'smallint'
,
$fetchedTable
->
getColumn
(
'flag'
)
->
getType
()
->
getName
());
$this
->
assertEquals
(
'integer'
,
$fetchedTable
->
getColumn
(
'masks'
)
->
getType
()
->
getName
());
$this
->
assertTrue
(
$fetchedTable
->
getColumn
(
'id'
)
->
getUnsigned
());
$this
->
assertTrue
(
$fetchedTable
->
getColumn
(
'flag'
)
->
getUnsigned
());
$this
->
assertTrue
(
$fetchedTable
->
getColumn
(
'masks'
)
->
getUnsigned
());
}
}
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