db icon indicating copy to clipboard operation
db copied to clipboard

Process expressions inside param values when build a query

Open Tigrov opened this issue 1 year ago • 2 comments

  • Allows non-unique param names inside Expression::$params (they will be replaced with unique names)
  • Process Expression instances inside Expression::$params

Related PRs

  • https://github.com/yiisoft/db-sqlite/pull/289
  • https://github.com/yiisoft/db-mysql/pull/321
  • https://github.com/yiisoft/db-pgsql/pull/336
  • https://github.com/yiisoft/db-mssql/pull/293
  • https://github.com/yiisoft/db-oracle/pull/255
Q A
Is bugfix? ✔️
New feature? ✔️/❌
Breaks BC?
Fixed issues #805

Tigrov avatar Feb 06 '24 10:02 Tigrov

PR Summary

  • Addition of new file AbstractExpressionBuilder.php A new file that contains the AbstractExpressionBuilder class is added to help in the creation of various expressions for database queries.

  • Removal of ExpressionBuilder.php The ExpressionBuilder class, previously used for building expressions, is no longer needed. The file containing this class was deleted.

  • Changes in AbstractDQLQueryBuilder.php Several method modifications were made to simplify the building of queries. A significant change is that these methods now return a string rather than being void, and also receive additional parameters. The methods also utilize the quoter property for quoting column names.

  • Introduction of AbstractSqlParser.php This new file has the AbstractSqlParser class, which assists in parsing SQL statements and extracting placeholders from them.

  • Test adjustments in AbstractQueryBuilderTest.php & CommonCommandTest.php Tests were adjusted to now compare the quoted SQL output, a change to improve test accuracy. Also, several method parameters were modified to streamline and refine the testing process.

  • Addition of AbstractSqlParserTest.php This file was added to contain test cases for the new AbstractSqlParser class.

  • Modifications in QueryBuilderTest.php Similar to the other test modifications, this file had changes to test parameters and comparisons of quoted SQL output.

  • Addition of tests and cases in CommandProvider.php New test cases, with nested expressions and new parameters, were added to improve testing comprehensiveness.

  • Addition of new files Several new files, each containing specific classes and functionalities have been added. These include SqlParserProvider.php, DQLQueryBuilder.php, ExpressionBuilder.php, and SqlParser.php. These contribute to broadening the system's functionalities.

what-the-diff[bot] avatar Feb 06 '24 10:02 what-the-diff[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.56%. Comparing base (749c3f3) to head (fe50046). Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #806      +/-   ##
============================================
+ Coverage     99.55%   99.56%   +0.01%     
- Complexity     1277     1316      +39     
============================================
  Files            63       64       +1     
  Lines          3120     3228     +108     
============================================
+ Hits           3106     3214     +108     
  Misses           14       14              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Feb 06 '24 10:02 codecov[bot]