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

Refactor Quoter #756

Merged
merged 5 commits into from
Sep 26, 2023
Merged

Refactor Quoter #756

merged 5 commits into from
Sep 26, 2023

Conversation

Tigrov
Copy link
Member

@Tigrov Tigrov commented Sep 23, 2023

  1. Added used function to use function block
  2. Replaced str_contains() with str_starts_with()
  3. Removed unnecessary chars from patterns of regular expression
  4. Fixed bug of quoteSql() for sql containing table with prefix (test)
  5. Fixed bug of getTableNameParts() for cases with different quotes for tables and columns (test)
  6. Fixed bug of quoteTableName() for sub-query with alias (test)
Q A
Is bugfix? ✔️
New feature?
Breaks BC?
Fixed issues -

@what-the-diff
Copy link

what-the-diff bot commented Sep 23, 2023

PR Summary

  • Refactoring of Quoter class
    This update makes a few changes to improve the Quoter class, which is responsible for creating and managing SQL (a type of programming language) statements. This includes handling special characters in column names, and managing table names that have aliases (which is like a nickname for the table).

  • New QuoteSql method
    A new method called quoteSql() is introduced. This addition makes sure SQL statements are correctly formatted.

  • Updates to existing methods
    The updates also improve existing methods, like quoteColumnName() and unquoteSimpleColumnName(). Now they can handle special characters more efficiently. The cleanUpTableNames() and quoteTableName() methods have also been improved to manage table names with aliases, sub-queries and different quote formats more effectively.

  • New Tests
    We've also added a few new tests in QuoterTest class to check these changes are working correctly. Among others, these tests check that SQL statements with table prefixes and table names with query aliases are handled properly. This ensures the high quality and reliability of the updated code.

@codecov
Copy link

codecov bot commented Sep 23, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (fb4c084) 99.73% compared to head (63bccfb) 99.73%.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #756   +/-   ##
=========================================
  Coverage     99.73%   99.73%           
+ Complexity     1269     1268    -1     
=========================================
  Files            63       63           
  Lines          3038     3045    +7     
=========================================
+ Hits           3030     3037    +7     
  Misses            8        8           
Files Coverage Δ
src/Schema/Quoter.php 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Tigrov Tigrov marked this pull request as ready for review September 23, 2023 07:36
@Tigrov Tigrov added the type:bug Bug label Sep 23, 2023
Copy link
Member

@vjik vjik left a comment

Choose a reason for hiding this comment

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

Looks good. Need add info to changelog only.

CHANGELOG.md Outdated Show resolved Hide resolved
@vjik vjik merged commit 264d589 into yiisoft:master Sep 26, 2023
86 of 87 checks passed
@Tigrov Tigrov deleted the refactor_quoter2 branch September 26, 2023 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants