Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Messenger] - formatDateTime is not correct in oracle #32427

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

Closed
roukmoute opened this issue Jul 8, 2019 · 4 comments
Closed

[Messenger] - formatDateTime is not correct in oracle #32427

roukmoute opened this issue Jul 8, 2019 · 4 comments

Comments

@roukmoute
Copy link
Contributor

roukmoute commented Jul 8, 2019

Symfony version(s) affected: 4.3.1

Description
ORA-01858: a non-numeric character was found where a numeric was expected

How to reproduce
Implement Messenger with Oracle

Possible Solution
If we remove \T from $dateTime->format('Y-m-d\TH:i:s'); in \Symfony\Component\Messenger\Transport\Doctrine\Connection::formatDateTime, it works.
I think it is a special things from Oracle, is there any specifity for format datime in relation to the database?

Could we use \Doctrine\DBAL\Types\DateTimeType instead?

Additional context
image

@weaverryan
Copy link
Member

Ping @vincenttouzet! What is the \T in the date string for? Is that a tab character? Doctrine DBAL seems to just use a space character for most platforms (https://github.com/doctrine/dbal/blob/ea92d5602028676d06021bebe8b806e24aa99f58/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php#L3313-L3316)... but it is true that using DateTimeType (or $this->driverConnection->getDatabasePlatform()->getDateTimeFormatString() would be better.

@vincenttouzet
Copy link
Contributor

@weaverryan Hum It's an old habit that I have. The T is part of the ISO 8601 DateTime format. But I think we can get rid of it in that case.

@weaverryan
Copy link
Member

If we use the database platform, I think we can entirely allow doctrine to handle this anyways :)

vincenttouzet added a commit to vincenttouzet/symfony that referenced this issue Jul 24, 2019
vincenttouzet added a commit to vincenttouzet/symfony that referenced this issue Jul 24, 2019
vincenttouzet added a commit to vincenttouzet/symfony that referenced this issue Jul 25, 2019
Tobion added a commit that referenced this issue Oct 25, 2019
… DateTime (roukmoute)

This PR was merged into the 4.3 branch.

Discussion
----------

[Messenger] use database platform to convert correctly the DateTime

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes
| Fixed tickets | #32427
| License       | MIT

In Doctrine Messenger the method `\Symfony\Component\Messenger\Transport\Doctrine\Connection::formatDateTime()` is used to format dateTime into this: `Y-m-d\TH:i:s`.
But this is not supported in all databases platform.

Here we use the database platform to convert correctly the dateTime.

Commits
-------

cfa1156 Format DateTime depending on database platform
symfony-splitter pushed a commit to symfony/messenger that referenced this issue Oct 25, 2019
… DateTime (roukmoute)

This PR was merged into the 4.3 branch.

Discussion
----------

[Messenger] use database platform to convert correctly the DateTime

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes
| Fixed tickets | symfony/symfony#32427
| License       | MIT

In Doctrine Messenger the method `\Symfony\Component\Messenger\Transport\Doctrine\Connection::formatDateTime()` is used to format dateTime into this: `Y-m-d\TH:i:s`.
But this is not supported in all databases platform.

Here we use the database platform to convert correctly the dateTime.

Commits
-------

cfa11561d1 Format DateTime depending on database platform
@roukmoute
Copy link
Contributor Author

Closed this in #32456

symfony-splitter pushed a commit to symfony/messenger that referenced this issue Jan 28, 2020
… DateTime (roukmoute)

This PR was merged into the 4.3 branch.

Discussion
----------

[Messenger] use database platform to convert correctly the DateTime

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes
| Fixed tickets | symfony/symfony#32427
| License       | MIT

In Doctrine Messenger the method `\Symfony\Component\Messenger\Transport\Doctrine\Connection::formatDateTime()` is used to format dateTime into this: `Y-m-d\TH:i:s`.
But this is not supported in all databases platform.

Here we use the database platform to convert correctly the dateTime.

Commits
-------

cfa11561d1 Format DateTime depending on database platform
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants