Skip to content
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

Add keyword aware quote strategy #5903

Closed
wants to merge 7 commits into from

Conversation

Deltachaos
Copy link
Contributor

@Deltachaos Deltachaos commented Jun 27, 2016

Related to the discussion in doctrine/dbal#1592 it is probably a good idea to add this quote strategy. It can be enabled by the user optionally and therefore he should be aware of the upercase/lowercase issue in some DBMS.

For the integration of this into doctrine-bundle see this PR: doctrine/DoctrineBundle#553

Deltachaos added a commit to Deltachaos/DoctrineBundle that referenced this pull request Jun 27, 2016
For integration of doctrine/orm#5903 into DoctrineBundle.
@Ocramius
Copy link
Member

@guilhermeblanco can you take a look at this?

@Ocramius
Copy link
Member

@Deltachaos tests are missing tho

@Deltachaos
Copy link
Contributor Author

Deltachaos commented Jul 1, 2016

@Ocramius will add tests as soon as is see that there is a chance that this gets merged

$keywords = $platform->getReservedKeywordsList();
$parts = explode(".", $name);
foreach ($parts as $k => $v) {
$parts[$k] = ($force || $keywords->isKeyword($v)) ? $platform->quoteIdentifier($v) : $v;
Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary write of the unmodified value here, rather use normal if.

@Majkl578
Copy link
Contributor

Majkl578 commented Jul 1, 2016

It'd be really good to have a native way to quote reserved words. 👍
And it should probably become a default strategy, current behavior is really WTF for a newcomer.

* @since 2.6
* @author Maximilian Ruta <mr@xtain.net>
*/
class KeywordQuoteStrategy implements QuoteStrategy
Copy link
Contributor

@Majkl578 Majkl578 Jul 1, 2016

Choose a reason for hiding this comment

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

I think keyword may be a bit misleading, what about e.g. ReservedWordQuoteStrategy?

Deltachaos added a commit to Deltachaos/DoctrineBundle that referenced this pull request Jul 21, 2016
For integration of doctrine/orm#5903 into DoctrineBundle.
@Deltachaos
Copy link
Contributor Author

@Majkl578 tests are added and class was renamed

@mikeSimonson
Copy link
Contributor

@Deltachaos Do you still plan on fixing the broken tests?

@Deltachaos
Copy link
Contributor Author

@mikeSimonson yes i have this still on my list. But i can not guarantee to fix this within the next month. Probably start of next year.

@mikeSimonson
Copy link
Contributor

@Deltachaos Thanks

@billschaller
Copy link
Member

Quoting is deeply wtf in DBAL - 3.0 needs to address more than just reserved word quoting...

@Ocramius
Copy link
Member

@Deltachaos I think we're going for quoting-by-default in ORM 3.x, so I'm not sure if this will be required by then... /cc @guilhermeblanco just to confirm.

@Ocramius Ocramius added this to the 3.0 milestone Apr 13, 2018
@guilhermeblanco
Copy link
Member

@Ocramius everything is quoted (and cannot be turned off) in master.
QuoteStrategy support is also removed from ORM 3.X.

@Ocramius
Copy link
Member

Closing as duplicate then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants