8000 [DBAL-2555] Fix date and datetimetz type mapping on Oracle by deeky666 · Pull Request #2612 · doctrine/dbal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[DBAL-2555] Fix date and dat 8000 etimetz type mapping on Oracle #2612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 23, 2017

Conversation

deeky666
Copy link
Member

Fixes #2555

Oracle's DATE type was erroneously mapped to Doctrine's DateTime type. Although I wonder why nobody ever complained about that until now, the fix looks straight forward and also complies to what we have documented.

Additionally the instrospection of DateTimeTzType was wrong and has been fixed (wrong case in type comparison).

Tests pass locally.

@@ -102,7 +102,7 @@ protected function _getPortableTableColumnDefinition($tableColumn)

$dbType = strtolower($tableColumn['data_type']);
if (strpos($dbType, "timestamp(") === 0) {
if (strpos($dbType, "WITH TIME ZONE")) {
if (strpos($dbType, "with time zone")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this seems to be something that the DB engine doesn't guarantee, strtolower() should be used (or at least case insensitive matching).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test probably also needed with it, but unsure if practical

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a look at line 193 ;)
But besides that you reminded me that I forgot a unit test case for the mapping issue in the platform which I added now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is is covered by the functional test case btw. Not sure how else to test this :>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dammit, didn't read that, thanks :-)

@@ -102,7 +102,7 @@ protected function _getPortableTableColumnDefinition($tableColumn)

$dbType = strtolower($tableColumn['data_type']);
if (strpos($dbType, "timestamp(") === 0) {
if (strpos($dbType, "WITH TIME ZONE")) {
if (strpos($dbType, "with time zone")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dammit, didn't read that, thanks :-)

@@ -412,13 +412,19 @@ public function testAlterTableNotNULL()
$this->assertEquals($expectedSql, $this->_platform->getAlterTableSQL($tableDiff));
}

/**
* @group DBAK-2555
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DBAL 😉

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx, fixed

@Ocramius Ocramius assigned Ocramius and unassigned 8000 deeky666 Jan 23, 2017
@Ocramius Ocramius merged commit 4f7df7c into doctrine:master Jan 23, 2017
@Ocramius
Copy link
Member

:shipit:

Ocramius added a commit that referenced this pull request Jan 23, 2017
…-oracledb' into 2.5

Backport #2555 to 2.5
Backport #2612 to 2.5
@Ocramius
Copy link
Member

Backported via 8a13144

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

schema generation maps oracle DATE fields to datetime
3 participants
0