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
642fc86e
Unverified
Commit
642fc86e
authored
Apr 04, 2018
by
Simon Podlipsky
Committed by
Sergei Morozov
May 01, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert Postgres, Oracle and SQL Server increment_by & min_value to int when creating Sequence
parent
a6b7bb81
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
16 deletions
+18
-16
OracleSchemaManager.php
lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
+2
-2
PostgreSqlSchemaManager.php
lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
+1
-1
SQLServerSchemaManager.php
lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
+1
-1
Sequence.php
lib/Doctrine/DBAL/Schema/Sequence.php
+2
-2
SchemaManagerFunctionalTestCase.php
...BAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
+12
-10
No files found.
lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
View file @
642fc86e
...
...
@@ -303,8 +303,8 @@ class OracleSchemaManager extends AbstractSchemaManager
return
new
Sequence
(
$this
->
getQuotedIdentifierName
(
$sequence
[
'sequence_name'
]),
$sequence
[
'increment_by'
],
$sequence
[
'min_value'
]
(
int
)
$sequence
[
'increment_by'
],
(
int
)
$sequence
[
'min_value'
]
);
}
...
...
lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
View file @
642fc86e
...
...
@@ -311,7 +311,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
$sequence
+=
$data
;
}
return
new
Sequence
(
$sequenceName
,
$sequence
[
'increment_by'
],
$sequence
[
'min_value'
]);
return
new
Sequence
(
$sequenceName
,
(
int
)
$sequence
[
'increment_by'
],
(
int
)
$sequence
[
'min_value'
]);
}
/**
...
...
lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
View file @
642fc86e
...
...
@@ -76,7 +76,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager
*/
protected
function
_getPortableSequenceDefinition
(
$sequence
)
{
return
new
Sequence
(
$sequence
[
'name'
],
$sequence
[
'increment'
],
$sequence
[
'start_value'
]);
return
new
Sequence
(
$sequence
[
'name'
],
(
int
)
$sequence
[
'increment'
],
(
int
)
$sequence
[
'start_value'
]);
}
/**
...
...
lib/Doctrine/DBAL/Schema/Sequence.php
View file @
642fc86e
...
...
@@ -58,8 +58,8 @@ class Sequence extends AbstractAsset
{
$this
->
_setName
(
$name
);
$this
->
allocationSize
=
is_numeric
(
$allocationSize
)
?
$allocationSize
:
1
;
$this
->
initialValue
=
is_numeric
(
$initialValue
)
?
$initialValue
:
1
;
$this
->
cache
=
$cache
;
$this
->
initialValue
=
is_numeric
(
$initialValue
)
?
$initialValue
:
1
;
$this
->
cache
=
$cache
;
}
/**
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
View file @
642fc86e
...
...
@@ -123,7 +123,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$name
=
'dropcreate_sequences_test_seq'
;
$this
->
_sm
->
dropAndCreateSequence
(
new
\Doctrine\DBAL\Schema\
Sequence
(
$name
,
20
,
10
));
$this
->
_sm
->
dropAndCreateSequence
(
new
Sequence
(
$name
,
20
,
10
));
self
::
assertTrue
(
$this
->
hasElementWithName
(
$this
->
_sm
->
listSequences
(),
$name
));
}
...
...
@@ -142,11 +142,11 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
public
function
testListSequences
()
{
if
(
!
$this
->
_conn
->
getDatabasePlatform
()
->
supportsSequences
())
{
$this
->
markTestSkipped
(
$this
->
_conn
->
getDriver
()
->
getName
()
.
' does not support sequences.'
);
if
(
!
$this
->
_conn
->
getDatabasePlatform
()
->
supportsSequences
())
{
$this
->
markTestSkipped
(
$this
->
_conn
->
getDriver
()
->
getName
()
.
' does not support sequences.'
);
}
$sequence
=
new
\Doctrine\DBAL\Schema\
Sequence
(
'list_sequences_test_seq'
,
20
,
10
);
$sequence
=
new
Sequence
(
'list_sequences_test_seq'
,
20
,
10
);
$this
->
_sm
->
createSequence
(
$sequence
);
$sequences
=
$this
->
_sm
->
listSequences
();
...
...
@@ -154,16 +154,18 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
self
::
assertInternalType
(
'array'
,
$sequences
,
'listSequences() should return an array.'
);
$foundSequence
=
null
;
foreach
(
$sequences
as
$sequence
)
{
self
::
assertInstanceOf
(
'Doctrine\DBAL\Schema\Sequence'
,
$sequence
,
'Array elements of listSequences() should be Sequence instances.'
);
if
(
strtolower
(
$sequence
->
getName
())
==
'list_sequences_test_seq'
)
{
$foundSequence
=
$sequenc
e
;
foreach
(
$sequences
as
$sequence
)
{
self
::
assertInstanceOf
(
Sequence
::
class
,
$sequence
,
'Array elements of listSequences() should be Sequence instances.'
);
if
(
strtolower
(
$sequence
->
getName
())
!
==
'list_sequences_test_seq'
)
{
continu
e
;
}
$foundSequence
=
$sequence
;
}
self
::
assertNotNull
(
$foundSequence
,
"Sequence with name 'list_sequences_test_seq' was not found."
);
self
::
assert
Equals
(
20
,
$foundSequence
->
getAllocationSize
(),
"Allocation Size is expected to be 20."
);
self
::
assert
Equals
(
10
,
$foundSequence
->
getInitialValue
(),
"Initial Value is expected to be 10."
);
self
::
assert
Same
(
20
,
$foundSequence
->
getAllocationSize
(),
'Allocation Size is expected to be 20.'
);
self
::
assert
Same
(
10
,
$foundSequence
->
getInitialValue
(),
'Initial Value is expected to be 10.'
);
}
public
function
testListDatabases
()
...
...
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