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

Move getSQLResultCasing code into ORM from DBAL #8887

Closed
beberlei opened this issue Aug 5, 2021 · 2 comments · Fixed by #8934
Closed

Move getSQLResultCasing code into ORM from DBAL #8887

beberlei opened this issue Aug 5, 2021 · 2 comments · Fixed by #8934
Milestone

Comments

@beberlei
Copy link
Member

beberlei commented Aug 5, 2021

DBAL 2 deprecates and DBAL 3 removes the getSQLResultCasing API, which we use to work around Oracle, PostgreSQL and MySQL differences in the default result casing.

To avoid a larger refactoring and be forwards compatible, we need move this functionality into ORM and provide a strategy pattern with different implementations based on DBAL 2 or 3.

interface ResultCasingStrategy
{
    public function getSQLResultCasing(string $string) : string;
}
class DBAL2ResultCasingStrategy implements ResultCasingStrategy {
     public function getSQLResultCasing(string $string) : string {
         return $this->platform->getSQLResultCasing($string);
     }
}
class UpperCaseResultCasingStrategy implements ResultCasingStrategy {}
class LowerCaseResultCasingStrategy implements ResultCasingStrategy {}
class NullCasingStrategy implements ResultCasingStrategy {}

A factory method at some point in the ORM should select the right strategy based on DBAL version and database platform and make the service available to everyone who needs sql result casings.

@greg0ire
Copy link
Member

Actually, I don't think the factory part has been done. @beberlei , can you please review #8934 and tell us if more work is necessary?

@beberlei
Copy link
Member Author

@greg0ire its flexible enough that I believe this issue can be closed for now.

FredDut added a commit to FredDut/APYDataGridBundle that referenced this issue Aug 10, 2022

Verified

This commit was signed with the committer’s verified signature.
targos Michaël Zasso
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants